You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to generate an asciidoc doc via openapi-generator-cli based on a working openapi v3.1.0 specification in a container (which validates properly at https://editor-next.swagger.io/) and also provide more information via the various includes in the generated index.
According to the generated index, it seems all I have to set is the specDir property and this should allow the generator to include my files. My observations are when I set the specDir it is used to check at "buildtime" if the paths exists and the includes are either set if the spec can be found or otherwise they are commented out:
include::{specDir}intro.adoc[opts=optional]
// markup not found, no include::{specDir}intro.adoc[opts=optional]
This is a bit odd to me, since the opts=optional attribute already handles that in a sane way. Even worse, the path that has to be verifiable at "buildtime" is also used in the include directive.
So the actual problem is the specDir path must be valid at the times of build and include, which is difficult due to the nature of how include paths are resolved:
To bypass this I have to create a symlink, otherwise the checks never succeed for me:
So I might do something completely wrong, but is there a better way of doing it like disabling the check at the buildtime and pass the checks for the includes to asciidoc?
openapi-generator version
I believe the problem is related to the java code and not the CLI, but it is somehow difficult to see the actual version of openapi-generator used, so hopefully this helps:
Description
I want to generate an asciidoc doc via openapi-generator-cli based on a working openapi v3.1.0 specification in a container (which validates properly at https://editor-next.swagger.io/) and also provide more information via the various includes in the generated index.
Just for reference, the containerfile is this: https://github.com/unexist/showcase-openapi-asciidoc/blob/master/infrastructure/Containerfile
According to the generated index, it seems all I have to set is the specDir property and this should allow the generator to include my files. My observations are when I set the specDir it is used to check at "buildtime" if the paths exists and the includes are either set if the spec can be found or otherwise they are commented out:
include::{specDir}intro.adoc[opts=optional]
// markup not found, no include::{specDir}intro.adoc[opts=optional]
This is a bit odd to me, since the
opts=optional
attribute already handles that in a sane way. Even worse, the path that has to be verifiable at "buildtime" is also used in the include directive.So the actual problem is the specDir path must be valid at the times of build and include, which is difficult due to the nature of how include paths are resolved:
To bypass this I have to create a symlink, otherwise the checks never succeed for me:
podman run --rm -v .:{{.MOUNT_PATH}} \ -it docker.io/unexist/{{.IMAGE_NAME}}:{{.IMAGE_VERSION}} \ sh -c "cd {{.MOUNT_PATH}} && **ln -s asciidoc/src/site/asciidoc/spec spec** \ && openapi-generator-cli generate -g asciidoc \ --input-spec=asciidoc/src/site/asciidoc/spec/openapi.json \ --output=asciidoc/src/site/asciidoc \ --additional-properties=specDir=spec/,useIntroduction=true \ && unlink spec"
So I might do something completely wrong, but is there a better way of doing it like disabling the check at the buildtime and pass the checks for the includes to asciidoc?
openapi-generator version
I believe the problem is related to the java code and not the CLI, but it is somehow difficult to see the actual version of openapi-generator used, so hopefully this helps:
$ openapi-generator-cli --version openapi-generator-cli 7.12.0 commit : afc27ef built : -999999999-01-01T00:00:00+18:00 source : https://github.com/openapitools/openapi-generator docs : https://openapi-generator.tech/
OpenAPI declaration file content or url
Spec: https://github.com/unexist/showcase-openapi-asciidoc/blob/master/asciidoc/src/site/asciidoc/spec/openapi.json
Generation Details
$ openapi-generator-cli generate -g asciidoc \ --input-spec=asciidoc/src/site/asciidoc/spec/openapi.json \ --output=asciidoc/src/site/asciidoc \ --additional-properties=specDir=spec/,useIntroduction=true
Steps to reproduce
The steps to reproduce are as following:
$ task openapi
$ task asciidoc
The Taskfile contains everything to check:
https://github.com/unexist/showcase-openapi-asciidoc/blob/master/Taskfile.yml
The text was updated successfully, but these errors were encountered: