Loading jobs/openapi/CHANGELOG.md +3 −0 Original line number Diff line number Diff line # Changelog All notable changes to this job will be documented in this file. ## [0.5.0] - 2023-11-14 * Enable multiple config file ## [0.4.1] - 2023-02-28 * Fix broken documentation links Loading jobs/openapi/README.md +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ This job let you the possibility to change SwaggerUI version (see [versions](htt | Name | Description | Default | | ---- | ----------- | ------- | | `API_DEF_LOCATION` <img width=250/> | Path to your OpenAPI file in your repository <img width=400/> | `openapi.json` | | `REF_DEF_LOCATION` | Path to additional OpenAPI files in your repository. They have to be separated by `;` | ` ` | | `SWAGGER_OUTPUT` | Output directory path | `website_build/` | | `SWAGGERUI_VERSION` | Version of SwaggerUI (see [versions](https://github.com/swagger-api/swagger-ui#compatibility){:target="_blank"}) | `v3.37.0` | | `IMAGE_TAG` | The default tag for the docker image | `3.16.2` | Loading jobs/openapi/openapi.yml +12 −2 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ openapi: stage: build variables: API_DEF_LOCATION: "openapi.json" REF_DEF_LOCATION: "" SWAGGER_OUTPUT: "website_build/" SWAGGERUI_VERSION: "v3.37.0" IMAGE_TAG: "3.16.2" Loading @@ -15,12 +16,21 @@ openapi: - mkdir ${CI_PROJECT_DIR}/${SWAGGER_OUTPUT} - mv swaggerui/dist/* ${CI_PROJECT_DIR}/${SWAGGER_OUTPUT} - cp $API_DEF_LOCATION ${CI_PROJECT_DIR}/${SWAGGER_OUTPUT} - | if [[ ${REF_DEF_LOCATION} != "" ]]; then oldIFS=$IFS export IFS=";" for ref in $REF_DEF_LOCATION; do IFS=$oldIFS mkdir -p ${CI_PROJECT_DIR}/${SWAGGER_OUTPUT}$(dirname $ref) cp $ref ${CI_PROJECT_DIR}/${SWAGGER_OUTPUT}$ref export IFS=";" done fi - sed -i "s|https://petstore.swagger.io/v2/swagger.json|$(basename $API_DEF_LOCATION)|g" ${CI_PROJECT_DIR}/${SWAGGER_OUTPUT}/index.html artifacts: when: always expose_as: "OpenAPI Build" paths: - "${SWAGGER_OUTPUT}" # Below path is a workaround to provide artifact exposition in MR if # default value is used. See https://r2devops.io/jobs/build/openapi/#artifacts - "website_build/" Loading
jobs/openapi/CHANGELOG.md +3 −0 Original line number Diff line number Diff line # Changelog All notable changes to this job will be documented in this file. ## [0.5.0] - 2023-11-14 * Enable multiple config file ## [0.4.1] - 2023-02-28 * Fix broken documentation links Loading
jobs/openapi/README.md +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ This job let you the possibility to change SwaggerUI version (see [versions](htt | Name | Description | Default | | ---- | ----------- | ------- | | `API_DEF_LOCATION` <img width=250/> | Path to your OpenAPI file in your repository <img width=400/> | `openapi.json` | | `REF_DEF_LOCATION` | Path to additional OpenAPI files in your repository. They have to be separated by `;` | ` ` | | `SWAGGER_OUTPUT` | Output directory path | `website_build/` | | `SWAGGERUI_VERSION` | Version of SwaggerUI (see [versions](https://github.com/swagger-api/swagger-ui#compatibility){:target="_blank"}) | `v3.37.0` | | `IMAGE_TAG` | The default tag for the docker image | `3.16.2` | Loading
jobs/openapi/openapi.yml +12 −2 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ openapi: stage: build variables: API_DEF_LOCATION: "openapi.json" REF_DEF_LOCATION: "" SWAGGER_OUTPUT: "website_build/" SWAGGERUI_VERSION: "v3.37.0" IMAGE_TAG: "3.16.2" Loading @@ -15,12 +16,21 @@ openapi: - mkdir ${CI_PROJECT_DIR}/${SWAGGER_OUTPUT} - mv swaggerui/dist/* ${CI_PROJECT_DIR}/${SWAGGER_OUTPUT} - cp $API_DEF_LOCATION ${CI_PROJECT_DIR}/${SWAGGER_OUTPUT} - | if [[ ${REF_DEF_LOCATION} != "" ]]; then oldIFS=$IFS export IFS=";" for ref in $REF_DEF_LOCATION; do IFS=$oldIFS mkdir -p ${CI_PROJECT_DIR}/${SWAGGER_OUTPUT}$(dirname $ref) cp $ref ${CI_PROJECT_DIR}/${SWAGGER_OUTPUT}$ref export IFS=";" done fi - sed -i "s|https://petstore.swagger.io/v2/swagger.json|$(basename $API_DEF_LOCATION)|g" ${CI_PROJECT_DIR}/${SWAGGER_OUTPUT}/index.html artifacts: when: always expose_as: "OpenAPI Build" paths: - "${SWAGGER_OUTPUT}" # Below path is a workaround to provide artifact exposition in MR if # default value is used. See https://r2devops.io/jobs/build/openapi/#artifacts - "website_build/"