Closed florentausha closed 4 months ago
Temporarily fixed my issue by appending
sed -i '' "s/^\( *\$ref: \)\(.*\.yaml#\/.*\)$/\1'\2'/g" $filepath
To every OpenAPI format command (MacOS)
hi @florentausha
We use @stoplight/yaml
for handling the YAML files, which manipulates the "".
https://github.com/thim81/openapi-format?tab=readme-ov-file#stoplight-studio
We have adopted the YAML parsing style from Stoplight Studio, by leveraging the @stoplight/yaml package for handling the parsing of OpenAPI YAML files.
By using the Stoplight YAML parsing, the results will be slightly different from when using a normal YAML parsing library, like js-to-yaml. We appreciate the Stoplight Studio tool, since it is an excellent GUI for working with OpenAPI documents for non-OpenAPI experts who will be contributing changes. By adopting the Stoplight Studio YAML parsing, the potential risk of merge conflicts will be lowered, which is the main reason why we opted for using the @stoplight/yaml package.
@thim81 Thanks for your detailed answer, I'll close this issue then 👍
Hi,
When formatting this file, that has references to schemas defined in other files:
The following command
npx openapi-format ./public/docs/example.yaml -o ./public/docs/example.yaml
Returns the following file:
As you can see, quotes around
$ref: './otherfile.yaml#/components/schemas/Id'
get removed. Can I fix this by modifying my file?