Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add delete author operation #5

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/optic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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-4

- name: Run Optic
env:
OPTIC_TOKEN: ${{ secrets.OPTIC_TOKEN }}
Expand Down
57 changes: 39 additions & 18 deletions openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ paths:
in: query
description: Order to sort books by, defaults to asc
name: sort_order
required: false
required: true
- schema:
type: string
enum:
- 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:
"200":
'200':
description: Book success response
content:
application/json:
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -105,17 +105,17 @@ paths:
author_id:
type: string
responses:
"204":
'204':
description: Successfully updated book
/author:
post:
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/AuthorRequest"
$ref: '#/components/schemas/AuthorRequest'
responses:
"201":
'201':
description: Successfully created author
content:
application/json:
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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: number
example: FrCmluBlTSwwxLLEbEDCP
created_at:
type: string
format: timestamp
Expand All @@ -217,5 +237,6 @@ components:
required:
- id
- name
- author_id
- created_at
- updated_at
10 changes: 5 additions & 5 deletions optic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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:
Expand Down
Loading