-
Notifications
You must be signed in to change notification settings - Fork 106
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
Polimorphic adapters #258
Comments
It would be helpful if you could provide more info, but you can pair discriminator with name to have a value for each subtype; which is I'm assuming what you want. DSL-JSON does not support adapters for such configuration at the moment, although it should be relatively straightforward to implement it. |
Yes, you are right. I tried that and now gives me this error: Unfortunatly I can't assure that type will be the first item because it comes from external API. Is there a workaround for this? |
Not really. The only workaround is you implement your own converter with this logic. |
I have another issue related to @JsonConverter.
But if in feat2 there's a @CompiledJson with an Instant field, it fails to compile because of missing converter. Any ideas? |
The only thing which comes to mind is some problem with incremental compilation. |
I tried looking into your project but compilation fails with
I dont have time to fix it or debug why its not compiling out of the box |
Please try this one: |
Still doesn't work.
Anyway... from what I've seen I dont see why you expect this to work at all. There is no dependency between the projects (lib1 and lib2) |
Hello, i'm trying to replace moshi with dsl-json.
In moshi is possible to implement adapters for a certain interface with multiple implementations:
This basically tells moshi to use the type field to map the correct implementation based on the value defined in a Enum.
I know that there is a descriminator but this doesnt allow mapping a custom value.
Is this approach possible to implement in dsl-json?
The text was updated successfully, but these errors were encountered: