[Nitro CLI] Handle duplicated names#9649
Open
tobias-tengler wants to merge 1 commit intomainfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Nitro CLI client to recognize duplicate-name creation failures for clients, OpenAPI collections, and MCP feature collections, so the CLI can return a friendlier error when the backend rejects a duplicate resource name.
Changes:
- Added a new
DuplicateNameErrorGraphQL fragment and included it in the three relevant create mutations. - Updated CLI command handlers to map duplicate-name mutation errors to a dedicated user-facing message.
- Extended command tests to cover the new duplicate-name error path for client, OpenAPI, and MCP creation.
Reviewed changes
Copilot reviewed 11 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/Nitro/Common/src/ChilliCream.Nitro.Client/persisted/operations.json |
Regenerates persisted operation payloads/hashes to include the new duplicate-name fragment usage. |
src/Nitro/Common/src/ChilliCream.Nitro.Client/OpenApi/Operations/CreateOpenApiCollectionCommand.graphql |
Adds DuplicateNameError to OpenAPI collection creation errors. |
src/Nitro/Common/src/ChilliCream.Nitro.Client/Mcp/Operations/CreateMcpFeatureCollectionCommand.graphql |
Adds DuplicateNameError to MCP feature collection creation errors. |
src/Nitro/Common/src/ChilliCream.Nitro.Client/fragments.graphql |
Defines the shared DuplicateNameError fragment. |
src/Nitro/Common/src/ChilliCream.Nitro.Client/Clients/Operations/CreateClientCommand.graphql |
Adds DuplicateNameError to client creation errors. |
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/OpenApi/CreateOpenApiCollectionCommandTests.cs |
Adds coverage for duplicate-name handling in OpenAPI create command tests. |
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Mcp/CreateMcpFeatureCollectionCommandTests.cs |
Adds coverage for duplicate-name handling in MCP create command tests. |
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Clients/CreateClientCommandTests.cs |
Adds coverage for duplicate-name handling in client create command tests. |
src/Nitro/CommandLine/src/CommandLine/Messages.cs |
Introduces a shared duplicate-name message helper. |
src/Nitro/CommandLine/src/CommandLine/Commands/OpenApi/CreateOpenApiCollectionCommand.cs |
Maps OpenAPI duplicate-name errors to the new shared message. |
src/Nitro/CommandLine/src/CommandLine/Commands/Mcp/CreateMcpFeatureCollectionCommand.cs |
Maps MCP duplicate-name errors to the new shared message. |
src/Nitro/CommandLine/src/CommandLine/Commands/Clients/CreateClientCommand.cs |
Maps client duplicate-name errors to the new shared message. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| => $"Unexpected mutation error: {error.Message}"; | ||
|
|
||
| public static string DuplicateName(string name, string entity) | ||
| => $"The name '{name}' is already in use by another {entity}."; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.