Skip to content

Commit 8517951

Browse files
committed
update api swagger for review and validatio items; add accomodation api
1 parent 4a6ef44 commit 8517951

File tree

5 files changed

+619
-23
lines changed

5 files changed

+619
-23
lines changed

swagger/accomodation.yaml

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
openapi: 3.0.2
2+
info:
3+
description: This API provides Hotel/motel/ Accomodation list
4+
version: 0.1.0
5+
title: Accomodation List API
6+
contact:
7+
8+
license:
9+
name: Apache 2.0
10+
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
11+
tags:
12+
- name: contributors
13+
description: Secured write permission calls
14+
- name: developers
15+
description: Operations available to regular developers
16+
paths:
17+
/acomodations:
18+
get:
19+
tags:
20+
- developers
21+
summary: searches accomodations
22+
operationId: searchAccomodations
23+
description: |
24+
By passing in the appropriate options, you can search for
25+
available accomodations in the system
26+
parameters:
27+
- in: query
28+
name: searchString
29+
description: pass an optional search string for looking up accomodations
30+
required: false
31+
schema:
32+
type: string
33+
- in: query
34+
name: skip
35+
description: number of records to skip for pagination
36+
schema:
37+
type: integer
38+
format: int32
39+
minimum: 0
40+
- in: query
41+
name: limit
42+
description: maximum number of records to return
43+
schema:
44+
type: integer
45+
format: int32
46+
minimum: 0
47+
maximum: 50
48+
responses:
49+
'200':
50+
description: search results matching criteria
51+
content:
52+
application/json:
53+
schema:
54+
type: array
55+
items:
56+
$ref: '#/components/schemas/AccomodationItem'
57+
'400':
58+
description: bad input parameter
59+
post:
60+
tags:
61+
- contributors
62+
summary: adds am accomodation item
63+
operationId: addAccomodation
64+
description: Adds an item to the system
65+
responses:
66+
'201':
67+
description: item created
68+
'400':
69+
description: 'invalid input, object invalid'
70+
'409':
71+
description: an existing item already exists
72+
requestBody:
73+
content:
74+
application/json:
75+
schema:
76+
$ref: '#/components/schemas/AccomodationItem'
77+
description: Accomodation item to add
78+
put:
79+
tags:
80+
- contributors
81+
summary: suspend am accomodation item
82+
operationId: suspendAccomodation
83+
description: suspend an item to the system
84+
responses:
85+
'201':
86+
description: item suspended
87+
'400':
88+
description: 'invalid input, object invalid'
89+
'403':
90+
description: 'forbidden'
91+
'404':
92+
description: 'not found'
93+
requestBody:
94+
content:
95+
application/json:
96+
schema:
97+
$ref: 'validations.yaml#/components/schemas/SuspendItem'
98+
servers:
99+
- url: 'https://virtserver.swaggerhub.com/wuhan2020/accomodations/0.1.0'
100+
components:
101+
schemas:
102+
AccomodationItem:
103+
type: object
104+
required:
105+
- id
106+
- name
107+
- address
108+
- volume
109+
- supporttype
110+
- contact
111+
- validation
112+
properties:
113+
id:
114+
type: string
115+
format: uuid
116+
example: d290f1ee-6c54-4b01-90e6-d701748f0851
117+
name:
118+
type: string
119+
example: 第一大酒店
120+
address:
121+
type: string
122+
example: 湖北省武汉市靖江大街12号 第一大酒店
123+
supporttype:
124+
type: string
125+
enum: ['医护人员','运输司机','需隔离观察人员','支援人员','外出滞留人员']
126+
contact:
127+
$ref: 'validations.yaml#/components/schemas/Contact'
128+
validation:
129+
$ref: 'validations.yaml#/components/schemas/ValidationItem'
130+
volume:
131+
type: object
132+
required:
133+
- totalPpl
134+
properties:
135+
totalPpl:
136+
type: integer
137+
format: int32
138+
example: 55
139+
description: 共可接纳55人
140+
rooms:
141+
type: array
142+
items:
143+
type: object
144+
required:
145+
- number
146+
- room
147+
properties:
148+
number:
149+
type: integer
150+
format: int32
151+
example: 5
152+
description: 5间
153+
room:
154+
$ref: '#/components/schemas/AccomodationRoom'
155+
releaseDate:
156+
type: string
157+
format: date-time
158+
example: '2016-08-29T09:12:33.001Z'
159+
availableState:
160+
oneOf:
161+
- type: boolean
162+
default: true
163+
- $ref: 'validations.yaml#/components/schemas/SuspendItem'
164+
AccomodationRoom:
165+
type: object
166+
required:
167+
- ppl
168+
properties:
169+
ppl:
170+
type: integer
171+
format: int32
172+
example: 2
173+
description: 2个人
174+
space:
175+
type: number
176+
format: float
177+
example: 5.2
178+
description: 5.2 平方米
179+
roomtype:
180+
type: string
181+
enum: ['双人间','多人间','标准间','套房','豪华套房','总统套房']

swagger/hospitaldemands.yaml

Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
openapi: 3.0.2
22
info:
33
description: This is Hostpital Demands API
4-
version: 0.1.0
4+
version: 0.2.0
55
title: Hostpital Demands API
66
# put the contact info for your development or API team
77
contact:
@@ -75,47 +75,54 @@ paths:
7575
schema:
7676
$ref: '#/components/schemas/HospitalDemandItem'
7777
description: Hospital Demands item to add
78-
78+
put:
79+
tags:
80+
- contributors
81+
summary: suspend an hospital demands item
82+
operationId: suspendHospitalDemands
83+
description: suspend an item to the system
84+
responses:
85+
'201':
86+
description: item suspended
87+
'400':
88+
description: 'invalid input, object invalid'
89+
'403':
90+
description: 'forbidden'
91+
'404':
92+
description: 'not found'
93+
requestBody:
94+
content:
95+
application/json:
96+
schema:
97+
$ref: 'validations.yaml#/components/schemas/SuspendItem'
98+
description: Hospital Demands item to suspend 取消医院需求item
7999
servers:
80-
- url: 'https://virtserver.swaggerhub.com/wuhan2020/hospitaldemands/0.1.0'
100+
- url: 'https://virtserver.swaggerhub.com/wuhan2020/hospitaldemands/0.2.0'
81101
components:
82102
schemas:
83103
HospitalDemandItem:
84104
type: object
85105
required:
86-
- hospital
87-
- url
106+
- hospital
88107
- demands
89108
- contact
90109
- releaseDate
110+
- validation
91111
properties:
92112
id:
93113
type: string
94114
format: uuid
95115
example: d290f1ee-6c54-4b01-90e6-d701748f0851
96116
hospital:
97117
$ref: 'hospitals.yaml#/components/schemas/HospitalItem'
98-
url:
99-
type: string
100-
format: uri
118+
validation:
119+
$ref: 'validations.yaml#/components/schemas/ValidationItem'
101120
releaseDate:
102121
type: string
103122
format: date-time
104123
example: 2016-08-29T09:12:33.001Z
105124
contact:
106-
type: object
107-
required:
108-
- name
109-
- phone
110-
properties:
111-
name:
112-
type: string
113-
example: Dr Zhang
114-
phone:
115-
type: array
116-
items:
117-
type: string
118-
example: 21-221111111
125+
$ref: 'validations.yaml#/components/schemas/Contact'
119126
demands:
120127
type: array
121128
items:
@@ -125,6 +132,18 @@ components:
125132
properties:
126133
supply:
127134
$ref: 'supplies.yaml#/components/schemas/SupplyItem'
135+
amount:
136+
oneOf:
137+
- type: integer
138+
format: int32
139+
description:
140+
- $ref: 'suppliesunits.yaml#/components/schemas/SupplyItemUnit'
141+
- $ref: 'suppliesunits.yaml#/components/schemas/Unit'
128142
remark:
129143
type: string
130144
example: 需符合或高于下列国家标准,医用一次性防护服技术要求
145+
availableState:
146+
oneOf:
147+
- type: boolean
148+
default: true
149+
- $ref: 'validations.yaml#/components/schemas/SuspendItem'

swagger/supplies.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ paths:
2222
operationId: searchSupplies
2323
description: |
2424
By passing in the appropriate options, you can search for
25-
available inventory in the system
25+
available supplies in the system
2626
parameters:
2727
- in: query
2828
name: searchString
29-
description: pass an optional search string for looking up inventory
29+
description: pass an optional search string for looking up supplies
3030
required: false
3131
schema:
3232
type: string

0 commit comments

Comments
 (0)