Skip to content

[Bug] Invalid OpenAPI Schema is generated in specific situations.Β #1695

@uanid

Description

@uanid

πŸ› 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 the required field in OpenAPI schemas. According to the OpenAPI and JSON Schema specifications, an empty required array is invalid.
  • Actual behavior:
    Typia generates a schema that includes an empty required array (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:

  1. OpenAPI Specification – Data Types

    An empty list required: [] is not valid. If all properties are optional, do not specify the required keyword.

  2. JSON Schema Draft-04
    See the definitions.stringarray section.

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.

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions