swagger-axios-codegen icon indicating copy to clipboard operation
swagger-axios-codegen copied to clipboard

Bugfix/required and nullable difference

Open domenikjones opened this issue 4 years ago • 1 comments

Hi there,

We have found a problem concerning nullable fields which lead into more problems, if we are using required, readOnly and nullabel in combination.

To keep the possibility as before, strictRequiredChecks has been added.

  • strictRequiredChecks will allow undefined values
  • strictNullChecks will allow null values

We have implemented some changes:

  • Extend the field props with the values for nullable and readOnly
  • Changed the behavior of a field description based on these values (for undefined and null seperately)

A field is required when:

  • The field property readOnly is false and property is required is true or strictRequiredChecks is false

A field is nullable when:

  • The field property nullable is true or strictNullChecks is false

These changes might break implementations of other developers, since strictNullCheck has been moved to the nullable evaluation instead required aka undefined.

Minor changes and fixes:

  • Removed duplicated service header comments

Please let me know this poses a problem. Happy coding!

domenikjones avatar Sep 13 '21 16:09 domenikjones

You should refer to the code itself to coding style, in prettier semi=false

Manweill avatar Sep 16 '21 07:09 Manweill