Skip to content
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

request_body type in #[path] is not required to exist #500

Closed
djrenren opened this issue Feb 24, 2023 · 2 comments · Fixed by #1018
Closed

request_body type in #[path] is not required to exist #500

djrenren opened this issue Feb 24, 2023 · 2 comments · Fixed by #1018
Labels
enhancement New feature or request

Comments

@djrenren
Copy link
Contributor

It looks like the parameter to request_body is dumbly translated to a string. This means, if you write a non-existant type there, it will happily accept that.

We should emit even just a basic use that ensures the type exists.

@juhaku
Copy link
Owner

juhaku commented Apr 15, 2023

@djrenren

request_body is not required as expected, because one might perform a request that does not have a request body as it is not required to exists in schema either.

Yeah, currently there is no validation of any sort regarding the input value. Though this could be improved absolutely. I am currently working on related functionalities so I can take a look at this as well soon.

@juhaku
Copy link
Owner

juhaku commented Nov 20, 2023

Related #801

@juhaku juhaku moved this from Todo to In Progress in utoipa kanban Sep 2, 2024
juhaku added a commit that referenced this issue Sep 2, 2024
This will affect in all places where schema is being rendered. These are
`value_type = ..` `request_body`, `response_body = ...` to name few.
This is still very much work in progress but aims to enforce
`PartialSchema` implementation for every type that is being used in
OpenAPI spec generated by utoipa.

The `Schema` trait will be split to `PartialSchema` and `Schema` and
`Schema` will extend the `PartialSchema` trait. `PartialSchema` will
provide the actual schema and `Schema` will provide name and other data
related to the schema itself. This is useful since we already provide
`PartialSchema` implementation for many standard Rust types and not all
types need the full schema but only the schema definition. This makes
schema definition implementation easier by juts allowing users to
manually implement `PartialSchema` type for their type if needed. Still
as usual the implementation can be automatically derived with `ToSchema`
derive trait.

Fixes #500 Fixes #801
juhaku added a commit that referenced this issue Sep 3, 2024
This will affect in all places where schema is being rendered. These are
`value_type = ..` `request_body`, `response_body = ...` to name few.
This aims to enforce `PartialSchema` implementation for every type
that is being used in OpenAPI spec generated by utoipa.

The `Schema` trait will be split to `PartialSchema` and `Schema` and
`Schema` will extend the `PartialSchema` trait. `PartialSchema` will
provide the actual schema and `Schema` will provide name and other data
related to the schema itself. This is useful since we already provide
`PartialSchema` implementation for many standard Rust types and not all
types need the full schema but only the schema definition. This makes
schema definition implementation easier by juts allowing users to
manually implement `PartialSchema` type for their type if needed. Still
as usual the implementation can be automatically derived with `ToSchema`
derive trait.

Fixes #500 Fixes #801
juhaku added a commit that referenced this issue Sep 3, 2024
This will affect in all places where schema is being rendered. These are
`value_type = ..` `request_body`, `response_body = ...` to name few.
This aims to enforce `PartialSchema` implementation for every type
that is being used in OpenAPI spec generated by utoipa.

The `Schema` trait will be split to `PartialSchema` and `Schema` and
`Schema` will extend the `PartialSchema` trait. `PartialSchema` will
provide the actual schema and `Schema` will provide name and other data
related to the schema itself. This is useful since we already provide
`PartialSchema` implementation for many standard Rust types and not all
types need the full schema but only the schema definition. This makes
schema definition implementation easier by juts allowing users to
manually implement `PartialSchema` type for their type if needed. Still
as usual the implementation can be automatically derived with `ToSchema`
derive trait.

Fixes #500 Fixes #801
juhaku added a commit that referenced this issue Sep 3, 2024
This will affect in all places where schema is being rendered. These are
`value_type = ..` `request_body`, `response_body = ...` to name few.
This aims to enforce `PartialSchema` implementation for every type
that is being used in OpenAPI spec generated by utoipa.

The `Schema` trait will be split to `PartialSchema` and `Schema` and
`Schema` will extend the `PartialSchema` trait. `PartialSchema` will
provide the actual schema and `Schema` will provide name and other data
related to the schema itself. This is useful since we already provide
`PartialSchema` implementation for many standard Rust types and not all
types need the full schema but only the schema definition. This makes
schema definition implementation easier by juts allowing users to
manually implement `PartialSchema` type for their type if needed. Still
as usual the implementation can be automatically derived with `ToSchema`
derive trait.

Fixes #500 Fixes #801
juhaku added a commit that referenced this issue Sep 3, 2024
This will affect in all places where schema is being rendered. These are
`value_type = ..` `request_body`, `response_body = ...` to name few.
This aims to enforce `PartialSchema` implementation for every type
that is being used in OpenAPI spec generated by utoipa.

The `Schema` trait will be split to `PartialSchema` and `Schema` and
`Schema` will extend the `PartialSchema` trait. `PartialSchema` will
provide the actual schema and `Schema` will provide name and other data
related to the schema itself. This is useful since we already provide
`PartialSchema` implementation for many standard Rust types and not all
types need the full schema but only the schema definition. This makes
schema definition implementation easier by juts allowing users to
manually implement `PartialSchema` type for their type if needed. Still
as usual the implementation can be automatically derived with `ToSchema`
derive trait.

Fixes #500 Fixes #801
juhaku added a commit that referenced this issue Sep 3, 2024
This will affect in all places where schema is being rendered. These are
`value_type = ..` `request_body`, `response_body = ...` to name few.
This aims to enforce `PartialSchema` implementation for every type
that is being used in OpenAPI spec generated by utoipa.

The `Schema` trait will be split to `PartialSchema` and `Schema` and
`Schema` will extend the `PartialSchema` trait. `PartialSchema` will
provide the actual schema and `Schema` will provide name and other data
related to the schema itself. This is useful since we already provide
`PartialSchema` implementation for many standard Rust types and not all
types need the full schema but only the schema definition. This makes
schema definition implementation easier by juts allowing users to
manually implement `PartialSchema` type for their type if needed. Still
as usual the implementation can be automatically derived with `ToSchema`
derive trait.

Fixes #500 Fixes #801
juhaku added a commit that referenced this issue Sep 3, 2024
This will affect in all places where schema is being rendered. These are
`value_type = ..` `request_body`, `response_body = ...` to name few.
This aims to enforce `PartialSchema` implementation for every type
that is being used in OpenAPI spec generated by utoipa.

The `Schema` trait will be split to `PartialSchema` and `Schema` and
`Schema` will extend the `PartialSchema` trait. `PartialSchema` will
provide the actual schema and `Schema` will provide name and other data
related to the schema itself. This is useful since we already provide
`PartialSchema` implementation for many standard Rust types and not all
types need the full schema but only the schema definition. This makes
schema definition implementation easier by juts allowing users to
manually implement `PartialSchema` type for their type if needed. Still
as usual the implementation can be automatically derived with `ToSchema`
derive trait.

Fixes #500 Fixes #801
juhaku added a commit that referenced this issue Sep 3, 2024
This will affect in all places where schema is being rendered. These are
`value_type = ..` `request_body`, `response_body = ...` to name few.
This aims to enforce `PartialSchema` implementation for every type
that is being used in OpenAPI spec generated by utoipa.

The `Schema` trait will be split to `PartialSchema` and `Schema` and
`Schema` will extend the `PartialSchema` trait. `PartialSchema` will
provide the actual schema and `Schema` will provide name and other data
related to the schema itself. This is useful since we already provide
`PartialSchema` implementation for many standard Rust types and not all
types need the full schema but only the schema definition. This makes
schema definition implementation easier by juts allowing users to
manually implement `PartialSchema` type for their type if needed. Still
as usual the implementation can be automatically derived with `ToSchema`
derive trait.

Fixes #500 Fixes #801
@juhaku juhaku closed this as completed in b473b99 Sep 3, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in utoipa kanban Sep 3, 2024
@juhaku juhaku moved this from Done to Released in utoipa kanban Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Released
Development

Successfully merging a pull request may close this issue.

2 participants