From 775b32c229b396500745b2a7185e19443b9115b3 Mon Sep 17 00:00:00 2001 From: fabiante Date: Fri, 1 Sep 2023 10:55:32 +0200 Subject: [PATCH 1/4] Add API linter to pipeline --- .github/workflows/test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0134b4f..3ef0269 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ on: branches: [ "master" ] jobs: - build: + test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -15,8 +15,10 @@ jobs: uses: actions/setup-go@v4 with: go-version: '1.21' - - name: Lint + - name: Lint Code run: go vet -v ./... + - name: Lint API Spec + run: npx @redocly/cli lint api/openapi.yml - name: Test run: go test -v ./... - name: Build From 9a8f5ad922bcfd5bc4c5f140e4b0d1cead883b25 Mon Sep 17 00:00:00 2001 From: fabiante Date: Fri, 1 Sep 2023 10:57:25 +0200 Subject: [PATCH 2/4] Fix missing security definition in api spec --- api/openapi.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/openapi.yml b/api/openapi.yml index 2332c1d..026b496 100644 --- a/api/openapi.yml +++ b/api/openapi.yml @@ -13,6 +13,8 @@ tags: - name: Admin description: Manage PURLs +security: [] + paths: /r/{domain}/{name}: get: From 2b217ca1128b428307d06f3f3c266fc60b762488 Mon Sep 17 00:00:00 2001 From: fabiante Date: Fri, 1 Sep 2023 11:07:20 +0200 Subject: [PATCH 3/4] Add redocly linter config --- redocly.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 redocly.yml diff --git a/redocly.yml b/redocly.yml new file mode 100644 index 0000000..193dc22 --- /dev/null +++ b/redocly.yml @@ -0,0 +1,8 @@ +extends: + - recommended + +rules: + # Service is designed to sometimes respond only with 3xx and 4xx responses. + operation-2xx-response: off + # It should be enough to state the license name. The git repository is the source of truth here. + info-license-url: off From 7534f831885c76c168acb880c06af2ffce61ba67 Mon Sep 17 00:00:00 2001 From: fabiante Date: Fri, 1 Sep 2023 11:08:42 +0200 Subject: [PATCH 4/4] Add license info to api spec --- api/openapi.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/openapi.yml b/api/openapi.yml index 026b496..9d177cc 100644 --- a/api/openapi.yml +++ b/api/openapi.yml @@ -3,6 +3,8 @@ info: title: PersURL description: Application to manage and resolve [PURL](https://en.wikipedia.org/wiki/Persistent_uniform_resource_locator) links. version: v1 + license: + name: MIT servers: - url: "http://localhost"