thephpleague / openapi-psr7-validator

It validates PSR-7 messages (HTTP request/response) against OpenAPI specifications
MIT License
526 stars 94 forks source link

Invalid "items MUST be present if the type is array" with OpenAPI 3.1 #202

Open momala454 opened 1 year ago

momala454 commented 1 year ago

The error "items MUST be present if the type is array" is returned since openApi 3.1, for nullable arrays, as the type is now an array.

if (! isset($this->parentSchema->type) || ($this->parentSchema->type !== 'array')) {
            throw new InvalidSchema(sprintf('items MUST be present if the type is array'));
        }

The value of $this->parentSchema->type can be an array with :

momala454 commented 1 year ago

Hello @scaytrase Are you there ?