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

Symfony YAML does not parse all YAML #21

Open cebe opened 5 years ago

cebe commented 5 years ago

While trying to add more tests for more specs from these sources:

I found that symfony YAML fails on a lot of these. We either need an alternative YAML parser or improve symfony YAML to not fail.

cebe commented 4 years ago

https://github.com/mustangostang/spyc/blob/master/Spyc.php

simPod commented 3 years ago

I've encountered the same issue. The problem is that it parses only arrays while getSerializableData() return stdClasses.

simPod commented 3 years ago

I'm using typical trick from js world:

Yaml::dump(
    json_decode(json_encode($openApiSpec->create()->getSerializableData()), true),
    flags: Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE
)