-
Notifications
You must be signed in to change notification settings - Fork 225
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
Supporting sqlx Json<T> #952
Comments
@ElysaSrc Could you elaborate bit more how you would like the support to be? How it should behave? |
Currently I must annotate all Json fields of my struct that is requested though sqlx with the inner type, I was wondering if maybe it could be inferred so when we have a json it directly infer a T type in the openapi scheme ? |
Okay, so it should infer the inner type. This needs some looking into to assess what can be done there. |
@ElysaSrc
With crates dependency: sqlx = { version = "0.8", default-features = false, features = [
"json",
], optional = true } Somehow it does not "find" the type even though it is there and LSP is able to access it anyhow. Does it need some sort of DB to be there before it can actually be used, Should not since the only feature flag that it seemingly requires is the "json" even though it is not explicitly mentioned. This is quite weird and IMO should not happen, nevertheless it hinders the implementation quite a bit. Another approach is to implement generic support for anything that seems like a |
When using sqlx, requests are checked at compile time so it requieres either a cache or a live database, but my guess here is it should not be an issue with just parsing the type ?
I'm not aware enough of utoipa internals to have an opinion here, I'd say that the less it messes up with current usages the better it is. Maybe add an optional feature flag for such behavior ? |
I think it'd be nice to support (behind a feature flag) the
Json<T>
because, currently the typing is lost on this element on the OpenAPI generated file.The text was updated successfully, but these errors were encountered: