Closed ramsey closed 5 years ago
yes, references are not implemented yet. Working on that.
No worries. I didn’t think of this in terms of references, but rather accessing the schemas by name.
given this schema
components:
schemas:
Pet:
required:
- id
- name
properties:
id:
type: integer
format: int64
name:
type: string
tag:
type: string
Pets:
type: array
items:
$ref: "#/components/schemas/Pet"
Accessing $openapi->components->schemas['Pet']
should definitively work. This is a bug.
fixed. thanks for reporting!
I released a beta version today, everything should be working as expected now :)
In OAS, I can reference schemas by name:
#/components/schemas/MySchema
. While playing with cebe/php-openapi, I attempted to access a schema through a similar path, like this:Unfortunately, neither approach works because
schemas
is a 0-indexed array and not a hash or object with named properties.Consider modifying
$openapi->components->schemas
so that it is an object with properties named according to the named schemas in the path#/components/schemas
.