Next release 2.0.0 #181
juhaku
announced in
Announcements
Replies: 2 comments 4 replies
-
Great! Thanks @juhaku, |
Beta Was this translation helpful? Give feedback.
3 replies
-
@juhaku, congratulations on this release, and great migration documentation here! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Heads up 📣
The next release will be quite a biggie. It will introduce breaking changes to various places and new features as well.
What will change and is know at this point is listed below with examples. The list is not final and may change whenever there is something new to report. This is to notify users already using the library to prepare for changes that will occur when updating to the next major release.The list is final since the new version 2.0.0 has been released.
Path params type will be using Pascal case instead of lower case
This applies to all parameter types
path, header, cookie, query
which will be changed toPath, Header, Cookie, Query
. This is to make the type to match to theParameterIn
enum type and allow common parsing logic to be shared in multiple places whereParameterIn
can be defined.Before 2.0.0 parameter type was written all in lowercase as seen below.
In 2.0.0 types will be in pascal case.
Actix web
IntoParams
will not be automaticBefore 2.0.0
IntoParams
will automatically expectPath<...>
orQuery<...>
wrapped handler function arguments to have implementation forIntoParams
trait.From 2.0.0 onwards this behaviour will change so that it won't expect
Path<...>
orQuery<...>
types to haveIntoParams
implementation unless type is defined within#[utoipa::path(....params(...) )]
.This change is to allow users explicitly state whether they want to use
IntoParams
with their types or not and to allow users to use combination ofIntoParmas
and regular tuple style parameters for better control of the parameters.From 2.0.0 onwards types need to be explisitly defined within
params
.ComponentFormat in #[component(...)] accepts variant
Before 2.0.0 ComponentFormat needed to defined as a whole component format enum e.g
#[component(format = ComponentFormat::Binary)]
.From 2.0.0 onwards format can be defined by giving a specific variant of the
ComponentFormat
enum. This unifies the api syntax to behave similarly to theParameterIn
andParameterStyle
enums.Define Binary variant of the
ComponentFormat
enum.ComponentFormat will change to SchemaFormat in 2.0.0.
Component derive changes in 2.0.0
From 2.0.0 onwards
#[derive(Component)]
will be#[derive(ToSchema)]
. Change is to follow more closely the OpenAPI spec since actually OpenAPI has many different type ofcomponents
thanschema components
one of which areresponse components
.Also all
#[component(...)]
attributes will change accordinly as#[schema(...)]
Also
ComponentFormat
will change toSchemaFormat
from 2.0.0 onwards same asComponentType
will change toSchemaType
.OpenApi derive changes in 2.0.0
Before 2.0.0 openapi derive supported syntax
From 2.0.0 onwards the syntax changes to:
This change is to make API more consistent with the actual OpenAPI spec. Handlers are behind the scenes OpenAPI
path
objects. Similarly OpenAPIcomponents
are not justschema
objects butresponses
and parameters and many more.Link to the OpenAPI spec: https://swagger.io/specification/
No more separate Property and PropertyBuilder in 2.0.0
From 2.0.0 onwards the Property type and PropertyBuilder will be removed and Object and ObjectBuilder will provide the Property and PropertyBuilder related functionality. See additional details over here #254. If you are using derives this change does not affect you but if you have manual implementation of types this will be a breaking change for you. But mostly changing
PropertyBuilder
withObjectBuilder
will do the trick.PropertyBuilder::new().schema_type(SchemaType::String)
ObjectBuilder::new().schema_type(SchemaType::String)
Property::new(SchemaType::String)
Object::with_type(SchemaType::String)
Value type
Any
is nowObject
Before 2.0.0
value_type = Any
was used to declaretype: object
in OpenAPI spec. But from 2.0.0 onwards it is declared withvalue_type = Object
. #256No more
chrono_with_format
featureFrom 2.0.0 onwards there is no seprate feature flag for
chrono_with_format
instead there is only one feature flag for chrono which ischrono
. This feature flag includes the formats fromchrono_with_format
feature. This is to simplify things and most of the time formats is wanted to be present in the generated api doc. There is no way to get rid of the additional format from now on but it should not matter since they wont harm anyone while being present.Beta Was this translation helpful? Give feedback.
All reactions