-
-
Notifications
You must be signed in to change notification settings - Fork 159
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
Allow literal types other than 'string' to be used and properly interpreted as const values #1823
Comments
From the input perspective, you only have valid JS values that it can be: https://www.w3schools.com/js/js_datatypes.asp From that, you might need to force those values to different language values, i.e. in Java you could have And this is gonna be in conjunction with how each generator do their type mapping
|
So you're suggesting ensuring the types at runtime? I would very much prefer keeping consistency, at least for those generators that already implement the constantConstrainer. |
Can you clarify?
Agree 👍 |
I am honestly just a little confused myself 😅 Those methods are part of Java/C# so we would could use them in our generated models, the real conversion would then only happen at runtime though, right? |
Yes, for example, the const value might be |
Reason/Context
Please try answering few of those questions
The behaviour of the const field is inconsistent without a reason (that im aware of)
The const field will support all literal types.
Description
Please try answering few of those questions
The constant constrainers for all languages need to be adapted to also work with
ConstrainedFloatModel
ConstrainedIntegerModel
andConstrainedBooleanModel
.Yes, the generated models will have different types and const properties will no longer have a setter.
I am not sure yet if we should verify that the const values are valid and fit their type. Would really love some input on this.
The text was updated successfully, but these errors were encountered: