Skip to content

Swagger codegen cli. Small docker image suitable for CI

Notifications You must be signed in to change notification settings

jeshan/swagger-codegen-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

swagger-codegen-cli

The official image doesn't allow calling easily in a CI environment like Gitlab CI. This image is to allow that.

Examples

Docker Compose

Run:

docker-compose up

This will look for a file called swagger.yaml in the current directory, compile a java client and output it into a directory called swagger-java-client. But chances are you want to customise this. Use the following options:

  • SRC_PATH=/path/to/your/project
  • SPEC_RELATIVE_PATH=$RELATIVE_TO_SRC_PATH/swagger.yaml
  • SWAGGER_LANG=java

Either modify them in .env or run them as follows:

SRC_PATH=/path/to/your/project SPEC_RELATIVE_PATH=$RELATIVE_TO_SRC_PATH/swagger.yaml SWAGGER_LANG=java docker-compose up

Gitlab CI

swagger:
  image: jeshan/swagger-codegen-cli
  stage: build
  script:
  - 'java -jar /swagger-codegen-cli.jar generate -l java -i server/api/swagger/swagger.yaml -o swagger-java-client'
  artifacts:
    name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
    paths: ['swagger-java-client']

About

Swagger codegen cli. Small docker image suitable for CI

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published