Conversation
Enhance field parser to recognize 'omitempty' in JSON tags, updating IsRequired logic and adding corresponding test cases. Update README to document the new behavior. Signed-off-by: Andy Stoneberg <astonebe@redhat.com>
BuildCustomSchemaV3's ARRAY case was setting result.Spec.AdditionalProperties when it should have set result.Spec.Items. AdditionalProperties is the JSON Schema field for maps with arbitrary value types, not for array element schemas. Downstream code that walks schema.Items.Schema.Spec (e.g. complementSchema's array branch) nil-derefs when a field uses `swaggertype:"array,T"` on a Go type whose natural schema isn't already array-shaped — typically generic wrappers like CommaArray[T]. Aligns with the v2 path, which uses spec.ArrayProperty(schema) to wrap the item schema with a properly populated Items. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ShouldSkip was returning true for any field whose json tag was missing or empty, even though FieldName already falls back to the form tag (and then the configured naming strategy) when JsonName returns empty. The short-circuit hid form-only fields entirely — most visibly, query parameter structs whose fields are bound via `form:"..."` (gin's ShouldBindQuery convention) disappeared from the generated spec under --requiredByDefault. Realign with the v2 behavior: only skip on the `json:"-"` exclude idiom; absence of a json tag falls through. Extract the predicate as isJsonIgnored() so the intent reads at the call site. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The v3 doc writer copied the v2 writer's printDoc, which prepends a
`"schemes": {{ marshal .Schemes }}` line. schemes is a Swagger 2.0 field
with no place in OpenAPI 3.1, so the rendered doc carried a stray
`"schemes": null` that strict 3.1 validators reject. Drop the injection
from the oas3 path; the v2 writer keeps it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Describe the PR
cherry-picked omitempty support from master branch and added omitzero support as well as pointer type to be treated as optional
Additional context
v2 is out of sync with master by a large margin