If there's a $ref within a multipart/form-datarequestBody, the Encoding will be instantiated with a Reference object instead of a Schema object as expected resulting in a TypeErrorException.
To reproduce, just parse the following OpenAPI schema:
Since this parameter is only ever used to guess the default encoding type of a property if and when it is not explicitly defined, I propose to skip the schema parameter altogether if during instantiation it is still an unresolved reference (otherwise we would have to pre-resolve references during instantiation leading to all other kinds of mishaps and a very substantial rewrite of the whole project).
If there's a
$ref
within amultipart/form-data
requestBody
, theEncoding
will be instantiated with aReference
object instead of aSchema
object as expected resulting in aTypeErrorException
.To reproduce, just parse the following OpenAPI schema:
Since this parameter is only ever used to guess the default encoding type of a property if and when it is not explicitly defined, I propose to skip the schema parameter altogether if during instantiation it is still an unresolved reference (otherwise we would have to pre-resolve references during instantiation leading to all other kinds of mishaps and a very substantial rewrite of the whole project).
https://github.com/cebe/php-openapi/blob/aafedb56ed8b860ce83b51b81bc1c902b77d8ecb/src/spec/MediaType.php#L56-L62