Closed nicolasne closed 1 week ago
OpenAPI 3.1 is now based on JSON Schema 4 that uses multiple types instead of nullable. Use a custom normalizer if you need to change that although IIRC the spec-version can be used to keep the old schema
Thank for the answer.
I used the --spec-version
to get the old schema (php bin/console api:openapi:export --spec-version=3.0.0
as I mentioned in my original message). This is why I created the issue in the first place.
API Platform version(s) affected: >= 3.2
Description
Since the 3.2 version, the openapi schema for nullable type is invalid for 3.x openapi schema.
How to reproduce
I use the Symfony api-platform version.
With the following ApiResource:
And I generated the openapi schema with
php bin/console api:openapi:export --spec-version=3.0.0
I got the following schema for
#/components/schemas/MyApiRessource
with api-plaftorm 3.1.22:And for api-platform 3.2.0 (and upper):
It also concerns the
application/ld+json
, wherehydra:mapping
has aproperty
that had this issue.Possible Solution
According to the logs, it seems the bug has been introduce since https://github.com/api-platform/core/releases/tag/v3.2.0 and this specific pull request may introduce it https://github.com/api-platform/core/pull/5489.