79269270

Date: 2024-12-10 18:03:14
Score: 0.5
Natty:
Report link

I am currently investigating a similar matter and stumbled upon a possible explanation/solution, saying that "required" and "nullable" are different notions in OpenAPI spec. The property "surname" being declared optional (required:false) does not make it nullable, it just allows it to be omitted entirely. To be able to include it but with a null value, you set it as "nullable: true" (and it can still be set to "required: true" even in that case, meaning that it has to be included even it's null).

Haven't tested that yet, though. Neither do I know if Swagger UI will handle this schema correctly, actually emitting the property as null when applicable.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Maksim Gumerov