Skip to content

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

Merged
merged 1 commit into from
May 20, 2025

Conversation

thedadams
Copy link
Contributor

No description provided.

@@ -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 {
Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

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

image

@thedadams thedadams force-pushed the openapi-v3.1-support branch from fa31e6c to b77836f Compare May 20, 2025 16:08
Comment on lines +400 to +419
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
}
}
Copy link
Contributor Author

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.

@thedadams thedadams force-pushed the openapi-v3.1-support branch from b77836f to 65c3ec2 Compare May 20, 2025 16:12
@thedadams thedadams merged commit 559876f into gptscript-ai:main May 20, 2025
10 checks passed
@thedadams thedadams deleted the openapi-v3.1-support branch May 20, 2025 20:55
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.

3 participants