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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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, querywhich will be changed toPath, Header, Cookie, Query. This is to make the type to match to theParameterInenum type and allow common parsing logic to be shared in multiple places whereParameterIncan 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
IntoParamswill not be automaticBefore 2.0.0
IntoParamswill automatically expectPath<...>orQuery<...>wrapped handler function arguments to have implementation forIntoParamstrait.From 2.0.0 onwards this behaviour will change so that it won't expect
Path<...>orQuery<...>types to haveIntoParamsimplementation unless type is defined within#[utoipa::path(....params(...) )].This change is to allow users explicitly state whether they want to use
IntoParamswith their types or not and to allow users to use combination ofIntoParmasand 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
ComponentFormatenum. This unifies the api syntax to behave similarly to theParameterInandParameterStyleenums.Define Binary variant of the
ComponentFormatenum.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 ofcomponentsthanschema componentsone of which areresponse components.Also all
#[component(...)]attributes will change accordinly as#[schema(...)]Also
ComponentFormatwill change toSchemaFormatfrom 2.0.0 onwards same asComponentTypewill 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
pathobjects. Similarly OpenAPIcomponentsare not justschemaobjects butresponsesand 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
PropertyBuilderwithObjectBuilderwill 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
Anyis nowObjectBefore 2.0.0
value_type = Anywas used to declaretype: objectin OpenAPI spec. But from 2.0.0 onwards it is declared withvalue_type = Object. #256No more
chrono_with_formatfeatureFrom 2.0.0 onwards there is no seprate feature flag for
chrono_with_formatinstead there is only one feature flag for chrono which ischrono. This feature flag includes the formats fromchrono_with_formatfeature. 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