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
"Autosize" union type accepts string formatted number #30
Comments
Whatever decision we end up making let's not do this one. I can see this be a major problem in the long run. |
A string formatted number is not acceptable in the current schema because of this validator: I realize that validators don't translate into the OpenAPI schema file, though, so that's probably why you thought this. We'll have to come up with some system for you to be aware of the validators on the C# side going forward. In any case, this one situation of floats and strings has caused so much headache and I really just want a solution at this point. Should we just change this to |
@chriswmackey is |
For the case of the For the On a side note, I just realized that the |
@chriswmackey for In terms of accepting None for these number type parameters, any case that generates a json file with null (None) value to these number type parameters, will still crash the c#. Because they are still not Nullable type. As you said, it will work not putting these optional keys ( From python/c# developer perspective, when do we really need to assign a Null value to these optional parameters, as we don't have to assign anything instead of putting a Null. Here are two examples: Technically, I can, and have changed a the c# generator's template, to make all non-required parameters Nullable. But I still don't think we should accept None for these Optional parameters. At SDK level, we should take care of optional parameters for its default value if user(developers) don't assign value to them, instead of accepting nulls from user(developers). To summarize above comments:
Please let me know if you think otherwise. |
@MingboPeng , In the first case of string formatted numbers, I am unclear on why something akin to the validator we have in Pydantic couldn't be implemented on your side. Second, you'll have to clarify what you mean by "not accepting Let's just set up a call. We've had these issues hanging over our head for a while and changing them is going to involve fair amount of work and PRs across several repos that I I really don't want to have to revert if we're wrong. So let's just set up a call and get a final decision between you, @mostaphaRoudsari and I. |
I just wanted to document what we decided as a final solution to these issues this morning:
I'll work on implementing this solution today. |
This commit addresses [this issue here](ladybug-tools#30).
This commit addresses [this issue here](ladybug-tools#30).
This commit addresses [this issue here](#30).
Took a while to address but it' finally implemented. |
Hi @chriswmackey, for some reason, the new "NoLimit" is not exported to OpenAPI correctly. |
Unfortunately, nothing I've tried seems to get rid of the extra |
I have noticed that I can get this extra
This all seems to odd to me since the lack of the Let's get Mostapha's thoughts and, if he doesn't know of any clean way to prevent the extra |
I can confirm that the schema_extra capability can get the job done but it feels pretty hacky. I'll hold off now before going any further. |
@chriswmackey I think this is what we discovered previously: Union doesn't like Field in Pydantic. |
It looks like a bug to me. My other comment was only clarifying that the sample that you linked to was related to a different topic. You should go ahead and report it. It looks like adding using the combination of Union and Field makes unnecessary nested allOf objects. It might be that we should use Field differently with Union or it is simply a bug in Pydantic. It is good that you have already figured out a workaround for now. |
Sorry for incorrectly paraphrasing, @mostaphaRoudsari . I just knew that you wanted us to investigate more before reporting it. If we agree that this smells like a bug, I'll open an issue on Pydantic github. The code to recreate the issue should be minimal so hopefully they can tell us pretty quickly if it's a bug or not. I may also just implement my workaround for now, though I can see that Pydantic is still making frequent releases (they just released 1.4) so I won't spend much time on it. |
I'm just noting that I put in the workaround as part of this PR: I also reported this issue on the Pydantic github: |
@chriswmackey
Currently, those autosizable parameters accepts either number or string, but it should be only accepting "autosize"/"autocalculate" if the input is string. In current schema design, a string formatted number is also accepted, but it could potentially cause a problem.
The text was updated successfully, but these errors were encountered: