Skip to content

Conversation

@VegetarianOrc
Copy link
Collaborator

  • Add _validate_nexus_name() helper that raises ValueError for invalid names
  • Validate names are non-empty and not whitespace-only
  • Validate names can be URL-encoded (rejects invalid Unicode like lone surrogates)
  • Include invalid value in error messages for easier debugging
  • Add comprehensive tests for all validation cases

Per the spec: "The service name and operation name MUST not be empty and
may contain any arbitrary character sequence as long as they're encoded
into the URL."

- Add _validate_nexus_name() helper that raises ValueError for invalid names
- Validate names are non-empty and not whitespace-only
- Validate names can be URL-encoded (rejects invalid Unicode like lone surrogates)
- Include invalid value in error messages for easier debugging
- Add comprehensive tests for all validation cases

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@VegetarianOrc VegetarianOrc requested a review from a team as a code owner January 14, 2026 20:00
VegetarianOrc and others added 3 commits January 14, 2026 12:07
Explicitly specify UTF-8 encoding when opening test files to avoid
Windows defaulting to cp1252 encoding.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…tion

- Add exception chaining (`from e`) in _validate_nexus_name() to preserve
  original exception context for debugging
- Use _validate_nexus_name() in OperationDefinition.from_operation() for
  consistent validation and error messages across all code paths
- Update test to match new error message format

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Quinn-With-Two-Ns
Copy link

Did we check if any other SDK does this validation?

@VegetarianOrc
Copy link
Collaborator Author

Did we check if any other SDK does this validation?

I did forget to check before doing this, my bad!

Go & Java don't have this in so the responsibility lies in any HTTP implementation to fail requests sent for operations that can't be URL encoded. That seems like a reasonable tradeoff to me. Happy to close this if you agree.

@Quinn-With-Two-Ns
Copy link

Yeah that's fine with me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants