Closed scaytrase closed 2 years ago
this is expected behavior, you have to call resolveReferences() manually when reading from a string, because in case of reading from string there is no context which can be used to resolve relative paths.
Can we resolve at least inline references without explicity calling resolveReferences()
(i.e if string spec contains no external file references)
You can resolve references in this cases like that:
$schema = Reader::readFromYaml($yaml);
$schema->resolveReferences(new \cebe\openapi\ReferenceContext($schema, ''));
that might break if you refer to any files using relative paths though.
not sure if this really a use case that is worth implementing, you can call resolveReferences() as shown above if needed, won't implement this unless there is any demand for it.
Original issue https://github.com/thephpleague/openapi-psr7-validator/issues/107
If a spec has header parameters with references, and references are not solved when creating the schema,
findHeaderSpecs
will fail with errorUndefined property: cebe\openapi\spec\Reference::$in
Failing test case
```php paths->getPath('/products.create')->getOperations()['post']; foreach ($operation->parameters as $parameter) { if ($parameter->in !== 'header') { continue; } $this->addToAssertionCount(1); } } } ```Fails with