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

Wrong nullable behaviour #1672

Open
hotrush opened this issue Nov 12, 2024 · 1 comment
Open

Wrong nullable behaviour #1672

hotrush opened this issue Nov 12, 2024 · 1 comment

Comments

@hotrush
Copy link

hotrush commented Nov 12, 2024

When using openapi: OA\OpenApi::VERSION_3_1_0 properties have wrong types and nullable values.

new OA\Property(
    property: 'field',
    title: 'Field',
    type: 'string',
    nullable: true,
)

Produces

"field": {
    "title": "Field",
    "type": [
        "string",
        "null"
    ]
},

Expected

"field": {
    "title": "Field",
    "type": "string",
    "nullable": true
},
@DerManoMann
Copy link
Collaborator

Your expected example is how version 3.0.0 works.

In version 3.1.0 schemas are defined as

The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is a superset of the [JSON Schema Specification Draft 2020-12](https://spec.openapis.org/oas/v3.1.0.html#bib-json-schema-2020-12).

The JSON schema then decribes how type is an array which may also contain "null".

Why do you think this is wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants