Skip to content

Instantly share code, notes, and snippets.

@b1a9id
Created September 13, 2020 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b1a9id/0ac72e5e23a343ed642a53c4e2bdbcd1 to your computer and use it in GitHub Desktop.
Save b1a9id/0ac72e5e23a343ed642a53c4e2bdbcd1 to your computer and use it in GitHub Desktop.
springdoc-openapiサンプルのopenapi.yaml
openapi: 3.0.1
info:
title: OpenAPI definition
version: v0
servers:
- url: http://localhost:8080/api
description: Generated server url
paths:
/sakes/{id}:
get:
tags:
- sake-controller
operationId: get
parameters:
- name: id
in: path
required: true
schema:
type: integer
format: int32
responses:
"400":
description: Bad Request
content:
'*/*':
schema:
$ref: '#/components/schemas/ErrorResponse'
"500":
description: Internal Server Error
content:
'*/*':
schema:
$ref: '#/components/schemas/ErrorResponse'
"200":
description: OK
content:
'*/*':
schema:
$ref: '#/components/schemas/SakeResponse'
/sakes/list:
get:
tags:
- sake-controller
operationId: list
responses:
"400":
description: Bad Request
content:
'*/*':
schema:
$ref: '#/components/schemas/ErrorResponse'
"500":
description: Internal Server Error
content:
'*/*':
schema:
$ref: '#/components/schemas/ErrorResponse'
"200":
description: OK
content:
'*/*':
schema:
type: array
items:
$ref: '#/components/schemas/SakeResponse'
/sakes:
get:
tags:
- sake-controller
operationId: page
parameters:
- name: pageable
in: query
required: true
schema:
$ref: '#/components/schemas/Pageable'
responses:
"400":
description: Bad Request
content:
'*/*':
schema:
$ref: '#/components/schemas/ErrorResponse'
"500":
description: Internal Server Error
content:
'*/*':
schema:
$ref: '#/components/schemas/ErrorResponse'
"200":
description: OK
content:
'*/*':
schema:
$ref: '#/components/schemas/PageSakeResponse'
post:
tags:
- sake-controller
operationId: create
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/SakeCreateRequest'
required: true
responses:
"400":
description: Bad Request
content:
'*/*':
schema:
$ref: '#/components/schemas/ErrorResponse'
"500":
description: Internal Server Error
content:
'*/*':
schema:
$ref: '#/components/schemas/ErrorResponse'
"200":
description: OK
content:
'*/*':
schema:
$ref: '#/components/schemas/SakeResponse'
components:
schemas:
ErrorResponse:
type: object
properties:
message:
type: string
SakeResponse:
type: object
properties:
id:
type: integer
format: int32
name:
type: string
brewingName:
type: string
SakeCreateRequest:
required:
- brewingName
- name
type: object
properties:
name:
maxLength: 20
minLength: 1
type: string
brewingName:
type: string
Pageable:
type: object
properties:
offset:
type: integer
format: int64
sort:
$ref: '#/components/schemas/Sort'
pageNumber:
type: integer
format: int32
pageSize:
type: integer
format: int32
paged:
type: boolean
unpaged:
type: boolean
Sort:
type: object
properties:
sorted:
type: boolean
unsorted:
type: boolean
empty:
type: boolean
PageSakeResponse:
type: object
properties:
totalPages:
type: integer
format: int32
totalElements:
type: integer
format: int64
size:
type: integer
format: int32
content:
type: array
items:
$ref: '#/components/schemas/SakeResponse'
numberOfElements:
type: integer
format: int32
sort:
$ref: '#/components/schemas/Sort'
first:
type: boolean
pageable:
$ref: '#/components/schemas/Pageable'
last:
type: boolean
number:
type: integer
format: int32
empty:
type: boolean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment