Skip to content
Snippets Groups Projects
Commit 0c8b0724 authored by Andreas Huber's avatar Andreas Huber
Browse files

Merge branch 'update-tag_sh' into 'main'

Kleinere Verbesserungen an `tag.sh`, der CI und ein Workaround

See merge request fit-connect/api!130
parents 819376c9 f49a5395
No related branches found
No related tags found
1 merge request!130Kleinere Verbesserungen an `tag.sh`
...@@ -15,42 +15,40 @@ workflow: ...@@ -15,42 +15,40 @@ workflow:
- if: '$CI_COMMIT_TAG' - if: '$CI_COMMIT_TAG'
stages: stages:
- lint
- build - build
- lint
- upload - upload
build:
stage: build
image: $CI_REGISTRY/node:current-alpine
before_script:
- npm install -g @apidevtools/swagger-cli
- mkdir dist
script:
- swagger-cli bundle -t yaml -o dist/submission-api.yaml spec/submission-api.yaml
artifacts:
expose_as: 'Built API spec'
paths:
- dist/
expire_in: 30 days
lint: lint:
stage: lint stage: lint
image: image:
name: $CI_REGISTRY/stoplight/spectral:5 name: $CI_REGISTRY/stoplight/spectral:5
entrypoint: [ "" ] entrypoint: [ "" ]
script: script:
- spectral lint spec/*.yaml -D - spectral lint dist/submission-api.yaml -D
openapi4j-parser: openapi4j-parser:
stage: lint stage: lint
image: $CI_REGISTRY/node:current-buster image: $CI_REGISTRY/node:current-buster
before_script: before_script:
- npm install -g @apidevtools/swagger-cli
- export DEBIAN_FRONTEND=noninteractive - export DEBIAN_FRONTEND=noninteractive
- apt-get update && apt-get install -y openjdk-11-jre - apt-get update && apt-get install -y openjdk-11-jre
script: script:
- swagger-cli bundle -t yaml -o "spec/submission-api-bundled.yaml" "spec/submission-api.yaml" - java -jar openapi4j-parser-cli-1.0.0.jar "dist/submission-api.yaml"
- java -jar openapi4j-parser-cli-1.0.0.jar "spec/submission-api-bundled.yaml"
build:
stage: build
image: $CI_REGISTRY/node:current-alpine
before_script:
- npm install -g @apidevtools/swagger-cli
- mkdir dist
script:
- swagger-cli bundle -t yaml -o dist/submission-api.yaml spec/submission-api.yaml
artifacts:
expose_as: 'Built API spec'
paths:
- dist/
expire_in: 30 days
upload:latest: upload:latest:
stage: upload stage: upload
......
...@@ -32,3 +32,45 @@ rules: ...@@ -32,3 +32,45 @@ rules:
- $.paths.*[get] - $.paths.*[get]
then: then:
function: pagination-response function: pagination-response
patch-without-request-body: # Remove once upstream ruleset is fixed (https://github.com/italia/api-oas-checker/pull/454)
description: |-
The PATCH method requests that a set of changes described in the
`requestBody` be applied to the target resource.
A PATCH specification without a `requestBody`
just applies no changes to the target resource.
Since PATCH has impacts on caches, using it
on a different target resource may result in non-interoperable
behavior.
For example, to modify the resource at `/user/123`,
you can use the following PATCH request:
```
PATCH /user/123
Content-Type: application/json-patch
{"op": "replace", "path": "enable", "value": true}
```
or POST request with the semantic implied by the target url:
```
POST /user/123/enable
```
Instead, the following request
is expected to modify the `/user/123/enable`
subresource, and not the `/user/123` one.
```
PATCH /user/123/enable
````
message: PATCH requires a non empty requestBody.
severity: error
given: $.paths.*.patch
then:
- field: requestBody
function: defined
- field: requestBody.required
function: truthy
...@@ -6,8 +6,11 @@ if [ -z "$TAG" ]; then ...@@ -6,8 +6,11 @@ if [ -z "$TAG" ]; then
echo "Usage: $0 TAG" echo "Usage: $0 TAG"
echo "Example: $0 1.0.1" echo "Example: $0 1.0.1"
echo "Existing tags:" echo "The latest 10 existing tags:"
PAGER= git tag --list | sed 's/^/ /' git tag --list \
| grep '^[0-9]' \
| sort --version-sort \
| tail
exit 1 exit 1
fi fi
......
...@@ -9,7 +9,7 @@ YML_IN="spec/submission-api-bundled.yaml" ...@@ -9,7 +9,7 @@ YML_IN="spec/submission-api-bundled.yaml"
docker run --rm -v "$(pwd):/work" jeanberu/swagger-cli \ docker run --rm -v "$(pwd):/work" jeanberu/swagger-cli \
swagger-cli validate "/work/$YML_IN" swagger-cli validate "/work/$YML_IN"
docker run --rm -v "$(pwd):/work" -w /work stoplight/spectral \ docker run --rm -v "$(pwd):/work" -w /work stoplight/spectral:5 \
lint "/work/$YML_IN" -D lint "/work/$YML_IN" -D
java -jar openapi4j-parser-cli-1.0.0.jar "$YML_IN" java -jar openapi4j-parser-cli-1.0.0.jar "$YML_IN"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment