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
Expected behaviour
The validator must find a schema based on the discriminator
Additional context
I've tried to make a fix myself, but does not know how to resolve the schema by ref from the validator: src/Schema/Keywords/OneOf.php:59
// Validate against all schemas
$schemaValidator = new SchemaValidator($this->validationDataType);
$innerExceptions = [];
$validSchemas = [];
+ $discriminator = $this->parentSchema->discriminator;+ if ($discriminator !== null) {+ $resolved = $discriminator->mapping[$data[$discriminator->propertyName]];+ // how do I get ref by Schema object? or how to get schema by ref?+ // $oneOf = array_filter(+ // $oneOf,+ // static fn(CebeSchema $schema) => $schema->getRef() === $resolved+ // );+ }
foreach ($oneOf as $schema) {
try {
$schemaValidator->validate($data, $schema, $this->dataBreadCrumb);
$validSchemas[] = $schema;
} catch (SchemaMismatch $e) {
$innerExceptions[] = $e;
}
}
The text was updated successfully, but these errors were encountered:
Package version
0.22.0
Describe the bug
Schema discriminator is not supported: https://swagger.io/docs/specification/data-models/inheritance-and-polymorphism/
To Reproduce
Expected behaviour
The validator must find a schema based on the discriminator
Additional context
I've tried to make a fix myself, but does not know how to resolve the schema by ref from the validator:
src/Schema/Keywords/OneOf.php:59
The text was updated successfully, but these errors were encountered: