-
-
Notifications
You must be signed in to change notification settings - Fork 226
Open
Description
I would like to file a feature request to allow setting loose validation to all schemas.
I'm using oapi-codegen to generate the models for a very large and complex third-party schema. This third party schema can be updated with new fields at any time and might brake my API if I don't update it with these new fields.
Sadly I can't add the field struct to allow additional properties since these structs are auto generated. It would be helpful if I could have a way to allow additional properties for all my schemas.
As a workaround, i'm using the OnAddOperation
to set it, but it would be so much better if it was possible to set it as part of the api configuration.
// Loosen up schema validation to allow additional properties
apiConfig.OnAddOperation = append(apiConfig.OnAddOperation, func(oapi *huma.OpenAPI, op *huma.Operation) {
for _, schema := range oapi.Components.Schemas.Map() {
schema.AdditionalProperties = true
}
})
Metadata
Metadata
Assignees
Labels
No labels