-
Notifications
You must be signed in to change notification settings - Fork 297
chore: switch to huma for OpenAPI v3.1 support #973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -373,6 +373,147 @@ func parseServer(server *openapi3.Server) (string, error) { | |||
return s, nil | |||
} | |||
|
|||
// openAPI3SchemaToHumaV2Schema converts an openapi3.Schema to a humav2.Schema | |||
func openAPI3SchemaToHumaV2Schema(schema *openapi3.Schema) *humav2.Schema { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Junie did this for me. I checked it out and it seems good, but would appreciate some eyes on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fa31e6c
to
b77836f
Compare
if schema.Min != nil { | ||
minVal := *schema.Min | ||
result.Minimum = &minVal | ||
|
||
// In OpenAPI 3, ExclusiveMin is a boolean flag that applies to Min | ||
// In OpenAPI 3.1, ExclusiveMinimum is a separate value | ||
if schema.ExclusiveMin { | ||
result.ExclusiveMinimum = &minVal | ||
} | ||
} | ||
if schema.Max != nil { | ||
maxVal := *schema.Max | ||
result.Maximum = &maxVal | ||
|
||
// In OpenAPI 3, ExclusiveMax is a boolean flag that applies to Max | ||
// In OpenAPI 3.1, ExclusiveMaximum is a separate value | ||
if schema.ExclusiveMax { | ||
result.ExclusiveMaximum = &maxVal | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the real reason we needed to switch.
Signed-off-by: Donnie Adams <[email protected]>
b77836f
to
65c3ec2
Compare
No description provided.