Upcoming Release 3.0.0 #456
juhaku
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Lot has changed since the previous release and it has been quite a while too. But as the saying goes "patience will be rewarded" so it does in this occasion as well hereby the time has come to release utoipa 3.0.0 which includes quite a few improvements all around. Without further ado,here is the list of breaking changes that one should keep in mind.
Changes in utoipa
ToSchema
traitPreviously the
schema
function returned only theSchema
type.In 3.0.0 the
schema
function return type will returnRefOf<Schema>
to support$ref
schemas in#/components/schemas
according to the OpenAPI spec. (It used to be possible in 1.x.x).Also from 3.0.0 onwards
schema
function will return a tuple containing the name of the schema and the schema or reference to the schema. Trait also has newly introduced lifetimes to reduce allocations on schema names, but not sure whether that is necesary in this case though.No more
json
crate featureFrom 3.0.0 onwards people who have used
default-features = false
inCargo.toml
to disablejson
feature might want to change their dependency declaration especially if they have explicitly declaredjson
feature. Declaringjson
dependency when updating to 3.0.0 will fail to compile. It is removed from the dependencies to simpler code in utoipa and afterall it is necessary for full OpenAPI type definitions and is when OpenAPI is being rendered to JSON.Components::responses
changes toBTreeMap
From 3.0.0 onwards utoipa
Components::responses
will change toBTreeMap
to keep the responses order constant.Content::examples
field type changesPreviously in 2.x.x the
examples
field only allowedExample
types.From 3.0.0 onwards the
examples
field will allowRefOr<Example>
to allow$ref
examples according to the OpenAPI spec.Changes in utoipa
ToResponse
traitPrior in 2.x.x.
response
function allowed only theResponse
type with the response name.From 3.0.0 onwards the
response
function return type isRefOr<Response>
to allow users to use$ref
values in#/components/responses
according to the OpenAPI spec.Also from 3.0.0 onwards the response trait uses lifetimes on names instead of heap allocated values.
Changes in
ComponentsBuilder
From 3.0.0 onwards
ComponentsBuilder::response_from_into
will be renamed toComponentsBuilder::response_from
.Removed
json_response_ref
method fromResponseExt
From 3.0.0 onwards the
json_response_ref
method is removed fromResponseExt
implemented forResponse
when crate featureopenapi_extensions
is enabled. It is incorrect and against the OpenAPI spec hence removed.Renamed
json_component_ref
method tojson_schema_ref
From 3.0.0 onwards the
json_component_ref
method both onResponseExt
andRequestBodyExt
is renamed tojson_schema_ref
to be consistent with the rest of the utoipa library and to follow better the OpenAPI spec.Beta Was this translation helpful? Give feedback.
All reactions