From cf32580efef720cb8c02c028380169b679d9a4b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Herv=C3=A9?= Date: Mon, 4 Sep 2023 17:21:22 +0200 Subject: [PATCH 01/12] add debug action --- .github/workflows/optic_pr.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/optic_pr.yml diff --git a/.github/workflows/optic_pr.yml b/.github/workflows/optic_pr.yml new file mode 100644 index 0000000..011772e --- /dev/null +++ b/.github/workflows/optic_pr.yml @@ -0,0 +1,23 @@ +name: optic +on: + pull_request: + push: + +jobs: + diff-all: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Log some env vars + run: echo $GITHUB_EVENT_PATH, $GITHUB_REPOSITORY, $GITHUB_SHA + + - name: Log GH token + run: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}; echo $GITHUB_TOKEN + + - name: Log pr number + run: echo $(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") + + - name: Log base ref + run: echo $GITHUB_BASE_REF From 23686ec5ee98a71ccf33d74e98aa4effc11f502e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Herv=C3=A9?= Date: Tue, 5 Sep 2023 11:36:10 +0200 Subject: [PATCH 02/12] run optic run in action --- .github/workflows/optic_pr.yml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/optic_pr.yml b/.github/workflows/optic_pr.yml index 011772e..a2539df 100644 --- a/.github/workflows/optic_pr.yml +++ b/.github/workflows/optic_pr.yml @@ -1,7 +1,6 @@ name: optic on: pull_request: - push: jobs: diff-all: @@ -10,14 +9,8 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Log some env vars - run: echo $GITHUB_EVENT_PATH, $GITHUB_REPOSITORY, $GITHUB_SHA + - name: Install Optic + run: npm install --location global @useoptic/optic@0.49.7-2 - - name: Log GH token - run: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}; echo $GITHUB_TOKEN - - - name: Log pr number - run: echo $(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") - - - name: Log base ref - run: echo $GITHUB_BASE_REF + - name: Run Optic + run: OPTIC_ENV=staging OPTIC_TOKEN="oidMDU4MmI1YzQtNTQwMS00YjIxLWI2Y2ItMDFmNGU0ODlkYWI3.ZBWfGe1k1noEvGGcKTtJG.-_KL_7gZsqLqfetE7iLm4" GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} optic run --base "gitbranch:$GITHUB_BASE_REF" --comment From 3ea4e9c8a76421b1393ed9382457b7cf36e83a92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Herv=C3=A9?= Date: Tue, 5 Sep 2023 11:38:57 +0200 Subject: [PATCH 03/12] spec bc --- todo-api.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/todo-api.yaml b/todo-api.yaml index eaf1362..fbe2f13 100644 --- a/todo-api.yaml +++ b/todo-api.yaml @@ -24,7 +24,6 @@ paths: items: $ref: "#/components/schemas/TodoRead" required: - - todos components: schemas: TodoRead: From ad3e8c38a9bec0afd1b1f6d3be808ddeaec34e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Herv=C3=A9?= Date: Tue, 5 Sep 2023 13:52:05 +0200 Subject: [PATCH 04/12] wip --- .github/workflows/optic_pr.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/optic_pr.yml b/.github/workflows/optic_pr.yml index a2539df..1f2ed73 100644 --- a/.github/workflows/optic_pr.yml +++ b/.github/workflows/optic_pr.yml @@ -1,6 +1,7 @@ name: optic on: pull_request: + push: jobs: diff-all: @@ -10,7 +11,7 @@ jobs: uses: actions/checkout@v3 - name: Install Optic - run: npm install --location global @useoptic/optic@0.49.7-2 + run: npm install --location global @useoptic/optic@0.49.7-3 - name: Run Optic - run: OPTIC_ENV=staging OPTIC_TOKEN="oidMDU4MmI1YzQtNTQwMS00YjIxLWI2Y2ItMDFmNGU0ODlkYWI3.ZBWfGe1k1noEvGGcKTtJG.-_KL_7gZsqLqfetE7iLm4" GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} optic run --base "gitbranch:$GITHUB_BASE_REF" --comment + run: OPTIC_ENV=staging OPTIC_TOKEN="oidMDU4MmI1YzQtNTQwMS00YjIxLWI2Y2ItMDFmNGU0ODlkYWI3.ZBWfGe1k1noEvGGcKTtJG.-_KL_7gZsqLqfetE7iLm4" GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} optic run From 8f673b303a827aa69d13774bef7bf33e3d6bded2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Herv=C3=A9?= Date: Tue, 5 Sep 2023 13:52:40 +0200 Subject: [PATCH 05/12] wip --- todo-api.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/todo-api.yaml b/todo-api.yaml index fbe2f13..483964f 100644 --- a/todo-api.yaml +++ b/todo-api.yaml @@ -11,6 +11,11 @@ paths: schema: type: number required: false + - name: test + in: cookie + schema: + type: number + required: false responses: '200': description: ok From 3e4824a2300faa28b62fc9dc78451bef87b179ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Herv=C3=A9?= Date: Tue, 5 Sep 2023 14:31:18 +0200 Subject: [PATCH 06/12] wip --- .github/workflows/optic_pr.yml | 3 ++- todo-api.yaml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/optic_pr.yml b/.github/workflows/optic_pr.yml index 1f2ed73..83bcff8 100644 --- a/.github/workflows/optic_pr.yml +++ b/.github/workflows/optic_pr.yml @@ -2,6 +2,7 @@ name: optic on: pull_request: push: + - main jobs: diff-all: @@ -11,7 +12,7 @@ jobs: uses: actions/checkout@v3 - name: Install Optic - run: npm install --location global @useoptic/optic@0.49.7-3 + run: npm install --location global @useoptic/optic@0.49.7-4 - name: Run Optic run: OPTIC_ENV=staging OPTIC_TOKEN="oidMDU4MmI1YzQtNTQwMS00YjIxLWI2Y2ItMDFmNGU0ODlkYWI3.ZBWfGe1k1noEvGGcKTtJG.-_KL_7gZsqLqfetE7iLm4" GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} optic run diff --git a/todo-api.yaml b/todo-api.yaml index 483964f..0830764 100644 --- a/todo-api.yaml +++ b/todo-api.yaml @@ -14,7 +14,7 @@ paths: - name: test in: cookie schema: - type: number + type: string required: false responses: '200': @@ -29,6 +29,7 @@ paths: items: $ref: "#/components/schemas/TodoRead" required: + - todos components: schemas: TodoRead: From e709a326ac1e46d8b87e0f219fcaa37ccae2732d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Herv=C3=A9?= Date: Tue, 5 Sep 2023 14:40:16 +0200 Subject: [PATCH 07/12] wip header --- todo-api.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/todo-api.yaml b/todo-api.yaml index 0830764..81854a2 100644 --- a/todo-api.yaml +++ b/todo-api.yaml @@ -12,7 +12,7 @@ paths: type: number required: false - name: test - in: cookie + in: header schema: type: string required: false From 6ae2cdb589716ae5d2facf60849628a66a258121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Herv=C3=A9?= Date: Tue, 5 Sep 2023 14:42:27 +0200 Subject: [PATCH 08/12] fix action --- .github/workflows/optic_pr.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/optic_pr.yml b/.github/workflows/optic_pr.yml index 83bcff8..e95f880 100644 --- a/.github/workflows/optic_pr.yml +++ b/.github/workflows/optic_pr.yml @@ -2,10 +2,11 @@ name: optic on: pull_request: push: - - main + branches: + - 'main' jobs: - diff-all: + run: runs-on: ubuntu-latest steps: - name: Checkout From eb4b25551dafe937a74a8c1a911b693a8b9f9835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Herv=C3=A9?= Date: Tue, 5 Sep 2023 14:47:57 +0200 Subject: [PATCH 09/12] wip --- .github/workflows/optic_pr.yml | 2 +- todo-api.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/optic_pr.yml b/.github/workflows/optic_pr.yml index e95f880..a992439 100644 --- a/.github/workflows/optic_pr.yml +++ b/.github/workflows/optic_pr.yml @@ -16,4 +16,4 @@ jobs: run: npm install --location global @useoptic/optic@0.49.7-4 - name: Run Optic - run: OPTIC_ENV=staging OPTIC_TOKEN="oidMDU4MmI1YzQtNTQwMS00YjIxLWI2Y2ItMDFmNGU0ODlkYWI3.ZBWfGe1k1noEvGGcKTtJG.-_KL_7gZsqLqfetE7iLm4" GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} optic run + run: OPTIC_ENV=staging OPTIC_TOKEN="oidMDU4MmI1YzQtNTQwMS00YjIxLWI2Y2ItMDFmNGU0ODlkYWI3.ZBWfGe1k1noEvGGcKTtJG.-_KL_7gZsqLqfetE7iLm4" optic run diff --git a/todo-api.yaml b/todo-api.yaml index 81854a2..6027488 100644 --- a/todo-api.yaml +++ b/todo-api.yaml @@ -15,7 +15,7 @@ paths: in: header schema: type: string - required: false + required: true responses: '200': description: ok From 9c493a431dcc790c41bd4c89a4548393790ce04e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Herv=C3=A9?= Date: Tue, 5 Sep 2023 16:25:07 +0200 Subject: [PATCH 10/12] wip --- .github/workflows/optic_pr.yml | 2 +- todo-api2.yaml | 51 ++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 todo-api2.yaml diff --git a/.github/workflows/optic_pr.yml b/.github/workflows/optic_pr.yml index a992439..402891f 100644 --- a/.github/workflows/optic_pr.yml +++ b/.github/workflows/optic_pr.yml @@ -13,7 +13,7 @@ jobs: uses: actions/checkout@v3 - name: Install Optic - run: npm install --location global @useoptic/optic@0.49.7-4 + run: npm install --location global @useoptic/optic@0.49.7-5 - name: Run Optic run: OPTIC_ENV=staging OPTIC_TOKEN="oidMDU4MmI1YzQtNTQwMS00YjIxLWI2Y2ItMDFmNGU0ODlkYWI3.ZBWfGe1k1noEvGGcKTtJG.-_KL_7gZsqLqfetE7iLm4" optic run diff --git a/todo-api2.yaml b/todo-api2.yaml new file mode 100644 index 0000000..81854a2 --- /dev/null +++ b/todo-api2.yaml @@ -0,0 +1,51 @@ +openapi: 3.0.1 +info: + title: TodoAPI + version: "1.1" +paths: + /todos: + get: + parameters: + - name: limit + in: query + schema: + type: number + required: false + - name: test + in: header + schema: + type: string + required: false + responses: + '200': + description: ok + content: + application/json: + schema: + type: object + properties: + todos: + type: array + items: + $ref: "#/components/schemas/TodoRead" + required: + - todos +components: + schemas: + TodoRead: + type: object + properties: + name: + type: string + status: + type: string + created_at: + type: string + example: + type: string + format: date-time + example: "2020-01-01T00:00:00.000Z" + required: + - name + - status + - created_at From d6b677485038626c94c2868b918b0416261ab5cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Herv=C3=A9?= Date: Tue, 5 Sep 2023 16:28:35 +0200 Subject: [PATCH 11/12] wip --- .github/workflows/optic_pr.yml | 2 +- todo-api.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/optic_pr.yml b/.github/workflows/optic_pr.yml index 402891f..9bad645 100644 --- a/.github/workflows/optic_pr.yml +++ b/.github/workflows/optic_pr.yml @@ -16,4 +16,4 @@ jobs: run: npm install --location global @useoptic/optic@0.49.7-5 - name: Run Optic - run: OPTIC_ENV=staging OPTIC_TOKEN="oidMDU4MmI1YzQtNTQwMS00YjIxLWI2Y2ItMDFmNGU0ODlkYWI3.ZBWfGe1k1noEvGGcKTtJG.-_KL_7gZsqLqfetE7iLm4" optic run + run: OPTIC_ENV=staging OPTIC_TOKEN="oidMDU4MmI1YzQtNTQwMS00YjIxLWI2Y2ItMDFmNGU0ODlkYWI3.ZBWfGe1k1noEvGGcKTtJG.-_KL_7gZsqLqfetE7iLm4" GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} optic run diff --git a/todo-api.yaml b/todo-api.yaml index 6027488..81854a2 100644 --- a/todo-api.yaml +++ b/todo-api.yaml @@ -15,7 +15,7 @@ paths: in: header schema: type: string - required: true + required: false responses: '200': description: ok From 9adc94c660c5f8e8746d0581d9aa07f5c165868c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Herv=C3=A9?= Date: Tue, 5 Sep 2023 17:21:40 +0200 Subject: [PATCH 12/12] wip --- .github/workflows/optic_pr.yml | 2 +- todo-api2.yaml => todo-api3.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename todo-api2.yaml => todo-api3.yaml (97%) diff --git a/.github/workflows/optic_pr.yml b/.github/workflows/optic_pr.yml index 9bad645..95b5527 100644 --- a/.github/workflows/optic_pr.yml +++ b/.github/workflows/optic_pr.yml @@ -13,7 +13,7 @@ jobs: uses: actions/checkout@v3 - name: Install Optic - run: npm install --location global @useoptic/optic@0.49.7-5 + run: npm install --location global @useoptic/optic@0.49.7-6 - name: Run Optic run: OPTIC_ENV=staging OPTIC_TOKEN="oidMDU4MmI1YzQtNTQwMS00YjIxLWI2Y2ItMDFmNGU0ODlkYWI3.ZBWfGe1k1noEvGGcKTtJG.-_KL_7gZsqLqfetE7iLm4" GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} optic run diff --git a/todo-api2.yaml b/todo-api3.yaml similarity index 97% rename from todo-api2.yaml rename to todo-api3.yaml index 81854a2..d45c755 100644 --- a/todo-api2.yaml +++ b/todo-api3.yaml @@ -14,7 +14,7 @@ paths: - name: test in: header schema: - type: string + type: number required: false responses: '200':