Skip to content

Commit c1d6388

Browse files
Merge pull request wuhan2020#24 from JamesBonddu/master
add donation for swagger
2 parents 4c43b1f + cd23f48 commit c1d6388

File tree

3 files changed

+147
-10
lines changed

3 files changed

+147
-10
lines changed

.gitignore

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2-
# all denpencies
3-
/*
4-
# except for what we want
5-
!**/*.py
6-
!bootstrap
7-
!**/*.txt
8-
!**/*.md
9-
!**/*.yaml
10-
!.gitignore
2+
*.pyc
3+
__pycache__/
4+
.vscode/
5+
.idea/
6+
.venv/
7+
.env
8+
*.swp

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Flask==1.1.1
2-
PyYAML==5.3
2+
PyYAML==5.3
3+
flask-swagger==0.2.14

swagger/donation.yaml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
openapi: 3.0.2
2+
info:
3+
description: This API provides Donation list
4+
version: 0.2.0
5+
title: Donation 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+
/donation:
18+
get:
19+
tags:
20+
- developers
21+
summary: searches donation
22+
operationId: searchDonation
23+
description: |
24+
By passing in the appropriate options, you can search for
25+
available inventory in the system
26+
parameters:
27+
- in: query
28+
name: searchString
29+
description: pass an optional search string for looking up inventory
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/DonationItem'
57+
'400':
58+
description: bad input parameter
59+
post:
60+
tags:
61+
- contributors
62+
summary: adds a donation item
63+
operationId: addDonation
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/DonationItem'
77+
description: Donation item to add
78+
servers:
79+
- url: 'https://virtserver.swaggerhub.com/wuhan2020/donation/0.2.0'
80+
components:
81+
schemas:
82+
DonationItem:
83+
type: object
84+
required:
85+
- id
86+
- source
87+
- donate_way
88+
- offical_link
89+
- contact
90+
- cur_status
91+
- source_link
92+
- audit_status
93+
- update_time
94+
properties:
95+
id:
96+
type: string
97+
format: uuid
98+
example: d290f1ee-6c54-4b01-90e6-d701748f0851
99+
source:
100+
type: string
101+
example: 红十字会
102+
donate_way:
103+
type: string
104+
example: 支付宝
105+
offical_link:
106+
type: string
107+
format: uri
108+
example: https://mp.weixin.qq.com/s/qGAsMA4hsduP99CaabdQDg
109+
contact:
110+
type: array
111+
items:
112+
$ref: '#/components/schemas/ContactItem'
113+
cur_status:
114+
type: string
115+
example: 已捐赠; 筹款中;
116+
source_link:
117+
type: string
118+
format: uri
119+
example: https://mp.weixin.qq.com/s/qGAsMA4hsduP99CaabdQDg
120+
audit_status:
121+
type: string
122+
example: 已审计; 审计中;
123+
update_time:
124+
type: string
125+
format: date-time
126+
example: '2020-01-23T09:12:33.001Z'
127+
ContactItem:
128+
type: object
129+
required:
130+
- name
131+
- phone
132+
properties:
133+
name:
134+
type: string
135+
example: xxx
136+
phone:
137+
type: string
138+
example: 12315

0 commit comments

Comments
 (0)