-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename Component to Schema #243
Rename Component to Schema #243
Conversation
@juhaku how does this look? It's not completely ready, but before I put the work in to polish it up and fix any broken compilation and tests, wanted to get your feedback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow.. this is crude work. Looks pretty good. There was couple of cases where derive_to_schema
should have been utoipa::ToSchema
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🏆 Super
@juhaku thanks! Still a couple more TODO items and this will be ready, hopefully in about 30 minutes 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Rename in |
…ents(schemas(...), responses(...))]
Fixed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great.. hard work of you 🙂 Many thanks
As outlined in the discussion #215 (comment)
Public facing breaking changes:
Component
enum toSchema
.Component
trait toToSchema
.ComponentType
toSchemaType
.ComponentFormat
toSchemaFormat
.#[component(...)]
struct/enum/field attributes to#[schema(...)]
.Property
fieldcomponent_type
toschema_type
.Object
fieldcomponent_type
toschema_type
.Array
fieldcomponent_type
toschema_type
.Ref
methodfrom_component_name()
tofrom_schema_name()
.ComponentBuilder
's methodsschema()
andschema_from_iter()
now acceptInto<RefOr<Schema>>
instead ofInto<Schema>
, so schema components can either be references or inline definitions. For calls which were passingInto<Schema>
implementations likeObjectBuilder
(e.g..schema(ObjectBuilder::new())
), now needs to be wrapped in.schema(Schema::from(ObjectBuilder::new()))
in order to resolve the type.#[openapi(components(...), responses(...)]
to#[openapi(components(schemas(...), responses(...))]
.Internal changes:
ComponentAttr
toSchemaAttr
.TODO:
utoipa-gen/src/schema/component
module/sopenapi
derive attribute Response references, IntoResponseComponent and IntoResponses #215 (comment)Components
acceptRefOr
forschemas
field, so schema components can be references.