Skip to content

Commit

Permalink
Define book search API (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
shunsei committed Oct 1, 2024
1 parent c6e3fec commit d891022
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 4 deletions.
4 changes: 0 additions & 4 deletions api/components/schemas/book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ request:
type: string
publisher:
type: string
edition:
type: integer
isbn:
type: string
pattern: '^\d{13}$'
Expand All @@ -32,8 +30,6 @@ response:
type: string
publisher:
type: string
edition:
type: integer
isbn:
type: string
pattern: '^\d{13}$'
Expand Down
2 changes: 2 additions & 0 deletions api/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ paths:
$ref: "./paths/book.yml#/books"
/books/{bookId}:
$ref: "./paths/book.yml#/book"
/books/search:
$ref: "paths/book.yml#/search"

/users:
$ref: "./paths/user.yml#/users"
Expand Down
53 changes: 53 additions & 0 deletions api/paths/book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,56 @@ book:
$ref: "../components/responses/4xx.yml#/NotFound"
'500':
$ref: "../components/responses/5xx.yml#/InternalServerError"

search:
get:
tags:
- book
operationId: searchBooks
summary: 書籍を検索する
security: []
parameters:
- name: page
in: query
description: ページ番号
required: false
schema:
type: integer
minimum: 1
default: 1
- name: title
in: query
description: タイトル
required: false
schema:
type: string
- name: author
in: query
description: 著者
required: false
schema:
type: string
- name: publisher
in: query
description: 出版社
required: false
schema:
type: string
- name: isbn
in: query
description: ISBN
required: false
schema:
type: string
pattern: '^\\d{13}$'
responses:
'200':
description: 検索に成功した
content:
application/json:
schema:
type: array
items:
$ref: "../components/schemas/book.yml#/response"
'500':
$ref: "../components/responses/5xx.yml#/InternalServerError"

0 comments on commit d891022

Please sign in to comment.