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

KnownFormat disparity between utoipa and utoipa-gen #1175

Closed
jeff-hiner opened this issue Oct 30, 2024 · 2 comments · Fixed by #1178
Closed

KnownFormat disparity between utoipa and utoipa-gen #1175

jeff-hiner opened this issue Oct 30, 2024 · 2 comments · Fixed by #1178
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@jeff-hiner
Copy link

I noticed this when trying to apply #[schema(format = Ipv4)] inside the derive for ToSchema to an element of type std::net::Ipv4Addr. I got an error message saying it wasn't one of the supported types, even though it's present in utoipa 5:

https://docs.rs/utoipa/latest/utoipa/openapi/schema/enum.KnownFormat.html

Apparently the enum inside utoipa-gen is distinct because it's in a proc-macro crate (named the same), and doesn't include this variant at all:

https://github.com/juhaku/utoipa/blob/master/utoipa-gen/src/schema_type.rs#L308

@juhaku
Copy link
Owner

juhaku commented Oct 30, 2024

Oh man, I must have missed it out, Need to check their correctness and add those missing.

@juhaku juhaku moved this to Todo in utoipa kanban Oct 30, 2024
@juhaku juhaku added bug Something isn't working good first issue Good for newcomers labels Oct 30, 2024
@juhaku juhaku moved this from Todo to In Progress in utoipa kanban Nov 1, 2024
juhaku added a commit that referenced this issue Nov 1, 2024
This commit adds missing new formats introduced in OpenAPI 3.1 upgrade
also to `utoipa-gen` macro parsing.

Closes #1175
juhaku added a commit that referenced this issue Nov 1, 2024
This commit adds missing new formats introduced in OpenAPI 3.1 upgrade
also to `utoipa-gen` macro parsing.

Closes #1175
@juhaku
Copy link
Owner

juhaku commented Nov 1, 2024

@jeff-hiner Now there is a PR to fix this, however you get the same result with providing custom format with literal str #[schema(format = "ipv4")].

@juhaku juhaku closed this as completed in ca643ef Nov 1, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in utoipa kanban Nov 1, 2024
@juhaku juhaku moved this from Done to Released in utoipa kanban Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
Status: Released
Development

Successfully merging a pull request may close this issue.

2 participants