cebe / php-openapi

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

ref nullable false #215

Open root-aza opened 2 weeks ago

root-aza commented 2 weeks ago

Minimal repoduce:

{
  "openapi": "3.1.0",
  "info": {
    "title": "Test",
    "description": "Test",
    "version": "1.0"
  },
  "components": {
    "schemas": {
      "Test": {
        "type": "object",
        "properties": {
          "A": {
            "$ref": "#/components/schemas/TestB",
            "nullable": true
          }
        }
      },
      "TestB": {
        "type": "object",
        "properties": {
          "join": {
            "type": "string"
          }
        }
      }
    }
  }
}

Test case


<?php

declare(strict_types=1);

require __DIR__ . '/vendor/autoload.php';

use cebe\openapi\Reader;

$openapi = Reader::readFromJsonFile(realpath('openapi.json'));

assert($openapi->components->schemas['Test']->properties['A']->nullable == true, 'Property A is not null');
cebe commented 1 week ago

Current implementation does not fully support OpenAPI 3.1.