Skip to content

Conversation

domdomegg
Copy link
Member

Enhanced Go struct tags throughout pkg/api/v0/types.go and pkg/model/types.go to better align with the OpenAPI specification.

Changes

  • Added comprehensive doc tags with detailed field descriptions matching OpenAPI
  • Added example tags showing valid values for fields (e.g., "io.github.user/weather", "npx")
  • Added format tags (uri, date-time) for better type specification
  • Added pattern and enum tags for validation constraints
  • Added placeholder field to Input struct matching OpenAPI spec
  • Removed redundant comments in favor of inline struct tags

These changes improve code clarity and make the types more self-documenting, while maintaining compatibility with the OpenAPI schema definitions in docs/reference/api/openapi.yaml.

Enhanced Go struct tags throughout pkg/api/v0/types.go and pkg/model/types.go to better align with the OpenAPI specification:

- Added comprehensive doc tags with detailed field descriptions
- Added example tags showing valid values for fields
- Added format tags (uri, date-time) for better type specification
- Added pattern and enum tags for validation constraints
- Added placeholder field to Input struct matching OpenAPI spec
- Removed redundant comments in favor of inline struct tags

These changes improve code clarity and make the types more self-documenting, while maintaining compatibility with the OpenAPI schema definitions.
@domdomegg
Copy link
Member Author

Most of this came from diffing the specs with:

# Start the server
make dev-compose

# Wait for server to be ready, then fetch and compare
curl -s http://localhost:8080/openapi.yaml | yq -o json | jq -S > /tmp/localhost-openapi.json
yq -o json docs/reference/api/openapi.yaml | jq -S > /tmp/docs-openapi.json
diff -u /tmp/docs-openapi.json /tmp/localhost-openapi.json > schemas.diff

And then going through and trying to align these as much as possible

@domdomegg domdomegg force-pushed the adamj/improve-golang-type-docs branch from eefda60 to 5246f8d Compare October 7, 2025 22:18
Updated test expectations to align with actual Huma framework behavior
where schema validation occurs before handler execution:

- Changed expected status from 400 to 422 (Unprocessable Entity)
- Updated error message checks to match Huma's pattern validation error
- Fixed "invalid token" test to use valid server name format

Schema validation in Huma happens at the framework level before the
handler function runs, so invalid server names (with multiple slashes,
no slashes, etc.) return 422 with pattern matching errors rather than
custom 400 errors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@domdomegg domdomegg force-pushed the adamj/improve-golang-type-docs branch from 5246f8d to 3ee0672 Compare October 7, 2025 22:18
@domdomegg
Copy link
Member Author

I have no idea why go is panicking now: https://github.com/modelcontextprotocol/registry/actions/runs/18327735919/job/52196150090?pr=631

Stacktrace not very helpful, and the changes really don't seem like they would cause this.

rdimitrov
rdimitrov previously approved these changes Oct 8, 2025
@rdimitrov rdimitrov dismissed their stale review October 8, 2025 07:00

I had this opened on the file changes and missed the failing checks

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.

2 participants