Skip hidden fields in OpenAPI documentation#32
Merged
moutonjeremy merged 5 commits intomainfrom Feb 7, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for hiding specific struct fields from generated OpenAPI docs via openapi:"-", applied consistently across schema generation and auto-parameter extraction, with tests and an example update.
Changes:
- Skip
openapi:"-"fields when collecting referenced types and when generating component schemas. - Skip
openapi:"-"fields when extracting OpenAPI path/query/header parameters from input structs. - Add tests and update the simple example to demonstrate hidden fields while keeping them available for runtime parsing/serialization.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
fiberoapi.go |
Skips openapi:"-" fields during type collection and schema generation so hidden fields don’t appear in components/schemas. |
common.go |
Skips openapi:"-" fields during parameter extraction so hidden query/path/header fields don’t appear in operation parameters. |
openapi_hidden_test.go |
Adds coverage to ensure hidden fields are excluded from body schemas and query parameters in the emitted OpenAPI JSON. |
_examples/simple/main.go |
Demonstrates hidden fields in example request/response structs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Implement functionality to exclude fields marked as hidden from OpenAPI documentation in both parameter extraction and schema generation. Add tests to ensure hidden fields do not appear in the generated OpenAPI schema and query parameters. Include hidden fields in the CreateUserInput and CreateUserOutput structures for runtime processing.