Skip to content
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

[BUG] In 2.11.12 fields that are not required appear as required in generated model #661

Closed
mrares opened this issue Oct 16, 2023 · 1 comment
Assignees
Labels
bug Something isn't working Triage needed

Comments

@mrares
Copy link
Contributor

mrares commented Oct 16, 2023

Describe the bug
Starting in 2.11.12 (the behaviour is not present in 2.11.11, which I reverted to), fields in the model not present in the required list are being generated as required in the model. I suspect this has something to do with #650

My json doesn't specify nullable on the fields, it just omits the non-required ones from the required list. If I ALSO set nullable: true on the fields not in the required list, then I get the proper behaviour again. Sadly, Strapi doesn't generate the nullable property on the fields.

To Reproduce
Please attach swagger and code snippet of generated value

Expected behavior
If a list of required properties is provided, then any property not explicitly marked as nullable: false should be assumed to be nullable: true.

Swagger specification link
Link to swagger/OpenApi documentation

Library version used:
2.11.12

Additional context
I am generating swagger.json from Strapi (famous for it's very poor abilities to generate the api docs)

@mrares mrares added bug Something isn't working Triage needed labels Oct 16, 2023
@Vovanella95
Copy link
Collaborator

Hi @mrares , yes, it depends from nullableFields generator option. I will add it to README.

I make it true by default. So bug should be fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Triage needed
Projects
None yet
Development

No branches or pull requests

3 participants