cebe / php-openapi

Read and write OpenAPI yaml/json files and make the content accessible in PHP objects.
MIT License
466 stars 88 forks source link

Support for fixed arrays #72

Closed canvural closed 4 years ago

canvural commented 4 years ago

Hello,

Given a JSON schema like below:

{
  "type": "array",
  "items": [
    {
      "type": "string"
    },
    {
      "type": "integer"
    },
    {
      "type": "boolean"
    }
  ]
}

this library produces a Schema object, which it's items property is also a single Schema object. In this inner Schema there is no way to access to the data. Data is in the private _properties property.

private $_properties =>
  array(3) {
    [0] =>
    array(1) {
      'type' =>
      string(6) "string"
    }
    [1] =>
    array(1) {
      'type' =>
      string(6) "string"
    }
    [2] =>
    array(1) {
      'type' =>
      string(6) "string"
    }
  }

To support this I think $schema->items should return an array of Schema objects.

Also, I'm not sure if this is really a missing feature or a bug.

canvural commented 4 years ago

Oh, it looks like this is not supported in OpenAPI.