You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the OpenApi 3.1 specification type cannot contain a list of types. Instead the oneOf, allOf or anyOf key should be used when describing an union/intersection type on a property.
Instead of doing this #5470 changed the behaviour to generate a list of types (invalid) instead.
Using the OpenApiFactory to generate documentation and passing this to swagger-php causes an TypeError to be thrown by PHP because an array (list of types) is given instead of the expected string type.
API Platform version(s) affected: 3.2
Description
According to the OpenApi 3.1 specification
type
cannot contain a list of types. Instead theoneOf
,allOf
oranyOf
key should be used when describing an union/intersection type on a property.Instead of doing this #5470 changed the behaviour to generate a list of types (invalid) instead.
3.1:
core/src/Hydra/JsonSchema/SchemaFactory.php
Lines 96 to 103 in c617b18
3.2:
core/src/Hydra/JsonSchema/SchemaFactory.php
Lines 94 to 104 in 002c8b2
How to reproduce
Using the
OpenApiFactory
to generate documentation and passing this toswagger-php
causes anTypeError
to be thrown by PHP because an array (list of types) is given instead of the expectedstring
type.TypeError: OpenApi\Analysis::getSchemaForSource(): Argument #1 ($fqdn) must be of type string, array given
https://github.com/zircote/swagger-php/blob/595d8b63a589e6ac0835c83a45304c7397dc37d1/src/Analysis.php#L326
Possible Solution
A simple rollback on the highlighted code to the version 3.1 variant should fix this issue.
Additional Context
Related issue: zircote/swagger-php#1464.
PHPUnit failure: nelmio/NelmioApiDocBundle#2141 (comment)
The text was updated successfully, but these errors were encountered: