Allow interpreter override #870
artur-ciocanu
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
|
I honestly don't see anything wrong with this, great suggestion @artur-ciocanu! It's backward compatible and a feature we can slowly roll out, so I see no issues with pursuing this 🙂 Do you want to take a crack at it? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem statement
Today
modelinaallows different customizations viapresetmechanism. It works great for most of the cases, however there are situations when customizing the code generator output is impossible, because of some of the hard-coded logic that can be found inprocessorsandinterpreter.For example, if we want to customize the output of the schema field that have
additionalProperties, then we really have no choice, but to accept that any field that looks like this:Will be translated into something like this (e.g. Java code gen):
Which is quite unfortunate since we can do anything useful with this Java class. I would argue that the above schema declaration should generate something like this:
I would like to mention that if we use a schema like this:
Or
Then we get a property of type
Object. As far as I can tell all the 3 schema definitions are equivalent from code generation perspective, however sinceInterpretAdditionalPropertiescan't be customized we can't do anything about it.Possible solution
One possible solution is to allow clients to pass custom
interpretersfor all the different properties likeoneOf,anyOf,additionalItems,additionalProperties, etc. This is somewhat similar to the way we can create custompresetsand add them via config.@jonaslagoni let me know your thoughts? Is this something that we could try in
nextbranch?Beta Was this translation helpful? Give feedback.
All reactions