From 3d39cc63796d371f8153aa1751a1dd345f68f19f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Herv=C3=A9?= Date: Fri, 13 Oct 2023 12:39:27 +0200 Subject: [PATCH 1/6] add delelete author operation --- openapi.yml | 53 +++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/openapi.yml b/openapi.yml index 0a85a28..47eab88 100644 --- a/openapi.yml +++ b/openapi.yml @@ -37,7 +37,7 @@ paths: name: sort_key required: false responses: - "200": + '200': description: Book success response content: application/json: @@ -47,11 +47,11 @@ paths: data: type: array items: - $ref: "#/components/schemas/BookResponse" + $ref: '#/components/schemas/BookResponse' next: type: - string - - "null" + - 'null' description: after_id for next page has_more_data: type: boolean @@ -65,9 +65,9 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/BookRequest" + $ref: '#/components/schemas/BookRequest' responses: - "201": + '201': description: Successfully created book content: application/json: @@ -82,18 +82,18 @@ paths: get: summary: Get a book parameters: - - $ref: "#/components/parameters/BookId" + - $ref: '#/components/parameters/BookId' responses: - "200": + '200': description: Book success response content: application/json: schema: - $ref: "#/components/schemas/BookResponse" + $ref: '#/components/schemas/BookResponse' patch: summary: Update a book parameters: - - $ref: "#/components/parameters/BookId" + - $ref: '#/components/parameters/BookId' requestBody: content: application/json: @@ -105,7 +105,7 @@ paths: author_id: type: string responses: - "204": + '204': description: Successfully updated book /author: post: @@ -113,9 +113,9 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/AuthorRequest" + $ref: '#/components/schemas/AuthorRequest' responses: - "201": + '201': description: Successfully created author content: application/json: @@ -126,10 +126,20 @@ paths: type: string required: - id - /authors/{author_id}: + /author/{author_id}: + get: + parameters: + - $ref: '#/components/parameters/AuthorId' + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/AuthorResponse' patch: parameters: - - $ref: "#/components/parameters/AuthorId" + - $ref: '#/components/parameters/AuthorId' requestBody: content: application/json: @@ -139,8 +149,14 @@ paths: name: type: string responses: - "204": + '204': description: Successfully updated author + delete: + parameters: + - $ref: '#/components/parameters/AuthorId' + responses: + '204': + description: Successfully deleted author components: parameters: @@ -202,10 +218,14 @@ components: type: object properties: id: - type: number + type: string + example: BEfCDC5FHWelCADHR9Rcm name: type: string example: Pride and Prejudice + author_id: + type: string + example: FrCmluBlTSwwxLLEbEDCP created_at: type: string format: timestamp @@ -217,5 +237,6 @@ components: required: - id - name + - author_id - created_at - updated_at From 42191b1e45a9c5d3f5765057854d426d56998d23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Herv=C3=A9?= Date: Wed, 18 Oct 2023 12:04:36 +0200 Subject: [PATCH 2/6] use prerelease --- .github/workflows/optic.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/optic.yml b/.github/workflows/optic.yml index a8b2aa8..b9f615c 100644 --- a/.github/workflows/optic.yml +++ b/.github/workflows/optic.yml @@ -3,18 +3,18 @@ on: pull_request: push: branches: - - "main" - + - 'main' + jobs: run: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - + - name: Install Optic - run: npm install --location global @useoptic/optic - + run: npm install --location global @useoptic/optic@0.50.11-2 + - name: Run Optic env: OPTIC_TOKEN: ${{ secrets.OPTIC_TOKEN }} From c0e7bde2446a162cb35eba4c26447ef4e0cb005e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Herv=C3=A9?= Date: Wed, 18 Oct 2023 12:07:36 +0200 Subject: [PATCH 3/6] change --- openapi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openapi.yml b/openapi.yml index 47eab88..cc9f824 100644 --- a/openapi.yml +++ b/openapi.yml @@ -26,7 +26,7 @@ paths: in: query description: Order to sort books by, defaults to asc name: sort_order - required: false + required: true - schema: type: string enum: From 5834bc1455b02d74fc8126859c4f5fa74348ae92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Herv=C3=A9?= Date: Wed, 18 Oct 2023 12:13:30 +0200 Subject: [PATCH 4/6] changes --- openapi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openapi.yml b/openapi.yml index cc9f824..42f9fed 100644 --- a/openapi.yml +++ b/openapi.yml @@ -33,7 +33,7 @@ paths: - created_at - name in: query - description: Book key to sort by, defaults to name + description: Book key to sort by, defaults to name. name: sort_key required: false responses: From d14e82182973016a71076384152962676c646924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Herv=C3=A9?= Date: Wed, 18 Oct 2023 15:25:12 +0200 Subject: [PATCH 5/6] update prerelease version --- .github/workflows/optic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/optic.yml b/.github/workflows/optic.yml index b9f615c..ba0537c 100644 --- a/.github/workflows/optic.yml +++ b/.github/workflows/optic.yml @@ -13,7 +13,7 @@ jobs: uses: actions/checkout@v3 - name: Install Optic - run: npm install --location global @useoptic/optic@0.50.11-2 + run: npm install --location global @useoptic/optic@0.50.11-4 - name: Run Optic env: From d28110b89225bb1d8b6d597994dc333db357e0a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Herv=C3=A9?= Date: Wed, 18 Oct 2023 16:12:26 +0200 Subject: [PATCH 6/6] make a change --- openapi.yml | 2 +- optic.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openapi.yml b/openapi.yml index 42f9fed..24e2824 100644 --- a/openapi.yml +++ b/openapi.yml @@ -224,7 +224,7 @@ components: type: string example: Pride and Prejudice author_id: - type: string + type: number example: FrCmluBlTSwwxLLEbEDCP created_at: type: string diff --git a/optic.yml b/optic.yml index f95ed61..4aa140c 100644 --- a/optic.yml +++ b/optic.yml @@ -3,12 +3,12 @@ ruleset: - naming: required_on: always properties: camelCase - pathComponents: snake_case + pathComponents: snake_case queryParameters: snake_case capture: openapi.yml: - # 🔧 Runnable example with simple get requests. - # Run with "optic capture openapi.yml --update interactive" + # 🔧 Runnable example with simple get requests. + # Run with "optic capture openapi.yml --update interactive" # You can run your actual tests through the Optic proxy with the `command` option (next example) server: url: https://api.useoptic.com/ @@ -19,13 +19,13 @@ capture: - path: /books/WjE9O1d8ELCb8POiOw4pn method: GET - path: /authors/tNpOpQZbxytxTxDT15GQy - method: GET + method: GET # When you are ready, set up an actual integration that run your test suite # Read reference docs here: https://www.useoptic.com/docs/capturing-traffic#configuration-reference # server: # # 🔧 Update this to the command to run your server. # # Optional: If omitted, Optic assumes the server is running or started elsewhere. - # command: npm dev + # command: npm dev # # 🔧 Update this url to where your server can be reached. # url: http://localhost:8080 # requests: