salvo-rs / salvo

A powerful web framework built with a simplified design.
https://salvo.rs
Apache License 2.0
3.26k stars 197 forks source link

oapi: Migrate to OpenAPI spec 3.1.0 #860

Closed chrislearn closed 1 month ago

chrislearn commented 1 month ago

Add support for deriving content_encoding and content_media_type on struct named fields.

In OpenAPI 3.0 the request body and response body with type string and format binary, byte, base64 was considered a application/octet-stream. However the OpenAPI 3.1 does not require such and and the schema can be completely ignored in such cases.

This commit will remove the old behaviour where [u8] was rendered as type: string format: binary for recognizing application/octet-stream. From now on the content schema will be resolved as is which means that [u8] will be rendered as type: array of items: int32.

Update documentation and add more known formats according to the https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#section-7.3