Closed moritzkalwa closed 3 weeks ago
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 Double(value)
or in C# Convert.ToDouble(int)
(are you only referring to C# for this issue, or all languages?)
And this is gonna be in conjunction with how each generator do their type mapping https://github.com/asyncapi/modelina/blob/6c87ed2967faeb9d9a5190455d40e97d80d7c3e4/src/generators/csharp/CSharpConstrainer.ts#L41
From that, you might need to force those values to different language values, i.e. in Java you could have
Double(value)
or in C#Convert.ToDouble(int)
(are you only referring to C# for this issue, or all languages?)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.
So you're suggesting ensuring the types at runtime?
Can you clarify?
I would very much prefer keeping consistency, at least for those generators that already implement the constantConstrainer.
Agree 👍
So you're suggesting ensuring the types at runtime?
Can you clarify?
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 1208.2
from the input and the place you render it, you might do Convert.ToDouble(${constValue})
in Modelina which renders as Convert.ToDouble(1208.2)
in the model, which of course then becomes at runtime they are converted, yes 🙂
This issue has been automatically marked as stale because it has not had recent activity :sleeping:
It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.
There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.
Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.
Thank you for your patience :heart:
Reason/Context
Please try answering few of those questions
Description
Please try answering few of those questions
ConstrainedFloatModel
ConstrainedIntegerModel
andConstrainedBooleanModel
.