mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-09 02:59:27 +03:00
Don't Use ref
in Discriminator mapping
Instead just include the schema ref directly per the documentation.
This commit is contained in:
parent
ac7e29da21
commit
87004fc428
@ -54,7 +54,7 @@ trait ApplyOpenApiDiscriminatorTrait
|
|||||||
$model->getOptions()
|
$model->getOptions()
|
||||||
));
|
));
|
||||||
$schema->oneOf[] = $oneOfSchema;
|
$schema->oneOf[] = $oneOfSchema;
|
||||||
$schema->discriminator->mapping[$propertyValue] = clone $oneOfSchema;
|
$schema->discriminator->mapping[$propertyValue] = $oneOfSchema->ref;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,12 +41,12 @@ class ApplyOpenApiDiscriminatorTraitTest extends TestCase
|
|||||||
$this->assertArrayHasKey('one', $this->schema->discriminator->mapping);
|
$this->assertArrayHasKey('one', $this->schema->discriminator->mapping);
|
||||||
$this->assertSame(
|
$this->assertSame(
|
||||||
$this->modelRegistry->register($this->createModel('FirstType')),
|
$this->modelRegistry->register($this->createModel('FirstType')),
|
||||||
$this->schema->discriminator->mapping['one']->ref
|
$this->schema->discriminator->mapping['one']
|
||||||
);
|
);
|
||||||
$this->assertArrayHasKey('two', $this->schema->discriminator->mapping);
|
$this->assertArrayHasKey('two', $this->schema->discriminator->mapping);
|
||||||
$this->assertSame(
|
$this->assertSame(
|
||||||
$this->modelRegistry->register($this->createModel('SecondType')),
|
$this->modelRegistry->register($this->createModel('SecondType')),
|
||||||
$this->schema->discriminator->mapping['two']->ref
|
$this->schema->discriminator->mapping['two']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user