[Bug] Invalid OpenAPI Schema is generated in specific situations.
🐛 Bug Report
📝 Summary
An invalid OpenAPI schema is generated in specific situations.
- Typia Version: 10.1.0
-
Expected behavior:
Typia should not generate an empty array for therequiredfield in OpenAPI schemas. According to the OpenAPI and JSON Schema specifications, an emptyrequiredarray is invalid. -
Actual behavior:
Typia generates a schema that includes an emptyrequiredarray (required: []) in certain cases.
Details
According to the OpenAPI specification, an empty array for the required field is not allowed.
This can be verified in the following references:
-
OpenAPI Specification – Data Types
An empty list
required: []is not valid. If all properties are optional, do not specify therequiredkeyword. -
JSON Schema Draft-04
See thedefinitions.stringarraysection.
Both OpenAPI and its underlying JSON Schema Draft-04 specification disallow an empty required array.
However, Typia generates such an invalid schema in specific cases, for example:
https://typia.io/playground/?script=JYWwDg9gTgLgBDAnmYBDANHA3g1BzAZzgF84AzKCEOAIiRVRoG4AoFgUwA9JY5gA7GOyhlUAY3ZwASqgDuANVQAbAK7sAYpRABRfgDdsLOMbhQ5i1Rq0AuaezHQAJgB4CMKALyZU-RAD5WYjYHfjc4AjEAC3YQVDgAXgRkNAA6ACsCCH4UiOjY5xkFZTVNKl09PwAKAEpWFhDMpXYUpQg8StyY1FqWIA
This behavior is likely a bug.
Thank you.