-
Notifications
You must be signed in to change notification settings - Fork 94
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
Customizations for @JsonTypeInfo and @JsonSubTypes in generated interfaces #40
Comments
The scenario you describe does seem useful. We'll need to look into whether it is feasible to support. We do have the ability to map types by specifying it in a config in the gradle task. This config handles mapping schema types to Java/Kotlin classes. Might be able to leverage that for generating the @JsonTypeInfo as you mentioned. |
Sorry for the late reply, I just got around to read your reply. I tried your suggestion and it works quite well (Thanks for that). So i added a mapping for my custom interface "Animal" with necessary @JsonTypeInfo like this:
This works fine, but the only issue is, that the code generator is still generating another interface class with the name "Animal". That a little bit confusing. Is there an option to prevent this? |
I have a similar use case. It would be great if the type info and the sub types could be customized. Much appreciated! |
I see, we should be able to fix that, i.e., if given a mapped type config for something that would otherwise be generated, avoid generating that class. I think that is a bug in the current implementation. |
First of all, I really like your new GraphQL framework and this code generation plugin! It makes lots of stuff easier. I tried a few things and ran into a limitation using this code generator.
For example a schema looks like this:
The resulting interface for Animal has the following JsonTypeInfo:
The problem with this is, that I would like use a custom @JsonSubTypes configuration, using an existing property mapped to an enum value. It should look something like this:
I realize that this is probably a complex issue, but I would like to know if something like this is even possible or a too specific problem?
With this the generator could be used to create a GraphQL schema for an existing service or database and create an lightweight GraphQL service ontop.
The text was updated successfully, but these errors were encountered: