Skip to content

Skip hidden fields in OpenAPI documentation#32

Merged
moutonjeremy merged 5 commits intomainfrom
feat-openapi-hide
Feb 7, 2026
Merged

Skip hidden fields in OpenAPI documentation#32
moutonjeremy merged 5 commits intomainfrom
feat-openapi-hide

Conversation

@moutonjeremy
Copy link
Member

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.

Copilot AI review requested due to automatic review settings February 7, 2026 11:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@moutonjeremy moutonjeremy merged commit 7cac566 into main Feb 7, 2026
10 checks passed
@moutonjeremy moutonjeremy deleted the feat-openapi-hide branch February 7, 2026 14:23
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.

1 participant