Closed avkhozov closed 3 years ago
I have a test script with schema where object property use oneOf keyword and one of $ref have nullable attribute.
oneOf
$ref
nullable
use JSON::Validator; my $schema = JSON::Validator->new->schema('data://main/spec.json')->schema; my $body = {exists => 1, value => {name => undef}}; my @errors = $schema->validate_response([get => "/test"], { body => \&body }); warn "@errors" if @errors; sub body {$body} __DATA__ @@ spec.json { "openapi": "3.0.0", "info": { "title": "Nullable", "version": "" }, "paths": { "/test": { "get": { "responses": { "200": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "oneOf": [ { "$ref": "#/components/schemas/name1" }, { "$ref": "#/components/schemas/name2" } ] } } } } } } } } } }, "components": { "schemas": { "name1": { "type": "string", "nullable": "true" }, "name2": { "type": "integer" } } } }
There is no errors in output
I got an error /body/name: /oneOf Expected string/integer - got null. at test.pl line 8.
/body/name: /oneOf Expected string/integer - got null. at test.pl line 8.
Steps to reproduce the behavior
I have a test script with schema where object property use
oneOf
keyword and one of$ref
havenullable
attribute.Expected behavior
There is no errors in output
Actual behavior
I got an error
/body/name: /oneOf Expected string/integer - got null. at test.pl line 8.