Closed YourTechBud closed 1 year ago
I just run this in a vscode/devcontainer-docker In docker.compose.yml
openapi_generator:
image: openapitools/openapi-generator-cli
volumes:
- ./openapi:/openapi:ro,consistent
Trigger with this shell script, more options are possible and apparently 40 langs:
I use this in a small "dockerapp.sh" file:
# codeGen for SDK: ./dockerapp.sh --sdk
# alt first line for cli input: docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \
if [ "$1" = "--sdk" ]; then
root=$pwd
docker run --rm -v $root:/local openapitools/openapi-generator-cli generate \
-i /local/openapi/swagger.yml \
-g typescript-fetch \
-o /local/openapi/sdk/ts
fi
I find the output relatively verbose...but useful. The tool only supports swagger 2.0 json schemas, not 3.0 as the space-cloud seems to be documented with.
Thanks for the suggestion @ivstrand.
We did consider the openapi generator for typescript but didn't go ahead with this for the following reasons:
The idea is to not discourage use of open api generators. Users of SpaceCloud are free to continue using them. We just have some in-built set of generates which we feel work great for some use case.
@shubham4443 what if we add support for openapi generator in spacectl? This way we can use our generators for the languages we support and leverage the communities work for the languages we don't.
The problem faced currently?
How can we solve it?