Open maranqz opened 5 years ago
I have the same problem, here's a minimal example:
x-my-anchors:
public: &public []
/my/endpoint:
security: *public
gives
attribute paths.'/my/endpoint/'(get).security is not of type array
Reason is probably a bug in Jackson YAML, like mentioned here: https://stackoverflow.com/questions/46689801/yaml-jackson-anchor-keys-of-array .
It's not a "bug" per se, it's because the official YAML specification doesn't specify the merge key (<<
) - therefore, Jackson doesn't support it. However, in my opinion, its omission makes the whole concept of anchors nearly useless.
Really wish this was supported...
It's not a "bug" per se, it's because the official YAML specification doesn't specify the merge key (
<<
) - therefore, Jackson doesn't support it. However, in my opinion, its omission makes the whole concept of anchors nearly useless.
Not only <<
-extension not supported, but *
-anchors themselves not supported!
So basically, the most recent OpenAPI generator CLI 5.3.1 on the time of writing (Dec 2021) doesn't support normal YAML with references and anchors.
What I personally consider as an insult of the common sense.
Really wish this was supported...
Yeah, so one has to preprocess the APIs, adding extra step in the builds.
Hi @OnkelTem, I also got this issue when using go-openapi https://github.com/go-openapi Can you share how you preprocess the APIs? Thanks
Description
I have problem with using anchors (using &) and references (using *) in my Openapi file. I have to generate a file without anchors and references , and only then there is a successful generation.
openapi-generator version
3.3.4
OpenAPI declaration file content or url
Command line used for generation
docker run --rm -v %CD%:/local openapitools/openapi-generator-cli generate -i /local/resources/ati.su/swagger.yaml -g php -o /local/app/resources/ati-sdk --invoker-package Ati
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement