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

#[schema(inline)] for enums like for structs #727

Closed
smndtrl opened this issue Aug 9, 2023 · 5 comments · Fixed by #963
Closed

#[schema(inline)] for enums like for structs #727

smndtrl opened this issue Aug 9, 2023 · 5 comments · Fixed by #963

Comments

@smndtrl
Copy link

smndtrl commented Aug 9, 2023

After digging through utoipa-gen tests, I was wondering, if there's a possibility for using sth like #[schema(inline)] for enums so that definitions that were otherwise end up being referenced are inlined.

enum Auth {
    #[schema(inline)] 
    BasicAuth(BasicAuth),
    ClientCertAuth { certificate: Vec<u8> },
}

would end up being a schema without any $ref. Maybe it would make sense to move the #[schema(inline)] to the actual type like this BasicAuth(#[schema(inline)] BasicAuth)

We have another system that doesn't handle $ref too well. Having the #[schema(inline)] for structs, it would be nice for enums as well.

@juhaku
Copy link
Owner

juhaku commented Aug 9, 2023

Pretty good idea. Surely this is something that could be explored in future and if possible added to the library as well. Also PRs are welcome if there is enough interest on implementing this feature.

@JMLX42
Copy link
Contributor

JMLX42 commented Jun 11, 2024

@juhaku if that's still on the table I'll try to do it.

@JMLX42
Copy link
Contributor

JMLX42 commented Jun 20, 2024

@juhaku @smndtrl PR: #963

@juhaku
Copy link
Owner

juhaku commented Jul 17, 2024

@JMLX42 great, all the help is welcome 🙂

@juhaku juhaku linked a pull request Sep 19, 2024 that will close this issue
@juhaku
Copy link
Owner

juhaku commented Sep 19, 2024

Done in the PR @JMLX42 pointed above

@juhaku juhaku closed this as completed Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants