Skip to content

fix(openapi3): handle yaml:",inline" tag for embedded structs#2141

Open
JAORMX wants to merge 1 commit intoswaggo:v2from
JAORMX:fix/yaml-inline-embedded-structs
Open

fix(openapi3): handle yaml:",inline" tag for embedded structs#2141
JAORMX wants to merge 1 commit intoswaggo:v2from
JAORMX:fix/yaml-inline-embedded-structs

Conversation

@JAORMX
Copy link
Copy Markdown

@JAORMX JAORMX commented Feb 2, 2026

Describe the PR

Fix embedded struct fields being omitted from OpenAPI 3.x schema when using yaml:",inline" tag.

The v3 field parser's ShouldSkip() was incorrectly skipping fields when JsonName() returned an empty string. This caused embedded struct fields with yaml:",inline" (but no json tag) to be skipped entirely.

The fix changes ShouldSkip() to only skip fields explicitly marked with json:"-", matching the behavior of the Swagger 2.0 parser.

Relation issue

Fixes #2140

The v3 field parser's ShouldSkip() function was incorrectly skipping
embedded struct fields that had yaml:",inline" tags but no json tag.
This caused the embedded struct's fields to be omitted from the
generated OpenAPI schema.

The issue was that ShouldSkip() checked if JsonName() returned empty
string and skipped the field. But for embedded fields with yaml:",inline"
(and no json tag), JsonName() returns "" which incorrectly triggered
the skip.

The fix changes ShouldSkip() to only skip fields explicitly marked with
json:"-", matching the behavior of the Swagger 2.0 parser.

Fixes swaggo#2140

Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com>
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