这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@danielgtaylor
Copy link
Owner

This PR adds an optional huma.SchemaProvider interface, which a type can implement to provide its own custom JSON Schema, disabling the built-in schema generator and enabling customized behavior for request/response body fields.

When combined with custom serialization logic, this can enable use-cases like determining whether a field was sent at all, is null, or is a value. A new example is added to showcase this functionality.

As part of this work, a small change in huma.go is made to properly set the operation.requestBody.required OpenAPI field, and this field is then later checked to determine whether the body is required. This works much better with custom operation schemas, which would not be required before even when that field was set.

Fixes #137.

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.

Support nullable type

2 participants