UNPKG

7 kBJavaScriptView Raw
1export const listPetsReqSchema = {
2 type: "object",
3 required: [],
4 properties: {
5 query: {
6 type: "object",
7 required: [],
8 properties: {
9 _limit: {
10 type: "integer",
11 format: "int32",
12 default: 10,
13 maximum: 1000,
14 },
15 _offset: { type: "integer", format: "int32", default: 0 },
16 _sort: { type: "string" },
17 _select: { type: "array", items: { type: "string" } },
18 tag: { type: "string" },
19 age_gt: { type: "integer" },
20 birthAt_gt: { type: "string", format: "date" },
21 birthAt_lt: { type: "string", format: "date" },
22 grade_gt: { type: "string", format: "date" },
23 grade_lt: { type: "string", format: "date" },
24 },
25 additionalProperties: false,
26 },
27 },
28 additionalProperties: false,
29};
30export const listPetsResSchema = {
31 type: "object",
32 required: [],
33 properties: {
34 content: {
35 type: "array",
36 items: {
37 allOf: [
38 {
39 type: "object",
40 properties: {
41 name: { type: "string", description: "pet's name" },
42 tag: { type: "string", enum: ["DOG", "CAT"] },
43 age: { type: "integer", format: "int32" },
44 birthAt: { type: "string", format: "date" },
45 grade: { type: "integer", format: "int32" },
46 owner: { type: "string" },
47 },
48 additionalProperties: false,
49 },
50 {
51 type: "object",
52 required: ["id"],
53 properties: {
54 id: { type: "string" },
55 updateAt: { type: "string", format: "date-time" },
56 updateBy: { type: "string" },
57 createAt: { type: "string", format: "date-time" },
58 createBy: { type: "string" },
59 },
60 additionalProperties: false,
61 },
62 ],
63 },
64 },
65 headers: {
66 type: "object",
67 required: ["X-Total-Count"],
68 properties: { "X-Total-Count": { type: "integer" } },
69 additionalProperties: false,
70 },
71 },
72 additionalProperties: false,
73};
74export const createPetReqSchema = {
75 type: "object",
76 required: ["body"],
77 properties: {
78 body: {
79 allOf: [
80 {
81 type: "object",
82 properties: {
83 name: { type: "string", description: "pet's name" },
84 tag: { type: "string", enum: ["DOG", "CAT"] },
85 age: { type: "integer", format: "int32" },
86 birthAt: { type: "string", format: "date" },
87 grade: { type: "integer", format: "int32" },
88 owner: { type: "string" },
89 },
90 additionalProperties: false,
91 },
92 {
93 type: "object",
94 required: ["name"],
95 properties: { name: { type: "string", description: "pet's name" } },
96 additionalProperties: false,
97 },
98 ],
99 },
100 },
101 additionalProperties: false,
102};
103export const createPetResSchema = {
104 type: "object",
105 required: [],
106 properties: {
107 content: {
108 allOf: [
109 {
110 type: "object",
111 properties: {
112 name: { type: "string", description: "pet's name" },
113 tag: { type: "string", enum: ["DOG", "CAT"] },
114 age: { type: "integer", format: "int32" },
115 birthAt: { type: "string", format: "date" },
116 grade: { type: "integer", format: "int32" },
117 owner: { type: "string" },
118 },
119 additionalProperties: false,
120 },
121 {
122 type: "object",
123 required: ["id"],
124 properties: {
125 id: { type: "string" },
126 updateAt: { type: "string", format: "date-time" },
127 updateBy: { type: "string" },
128 createAt: { type: "string", format: "date-time" },
129 createBy: { type: "string" },
130 },
131 additionalProperties: false,
132 },
133 ],
134 },
135 },
136 additionalProperties: false,
137};
138export const showPetByIdReqSchema = {
139 type: "object",
140 required: ["petId"],
141 properties: { petId: { type: "string", pattern: "[a-f\\d]{24}" } },
142 additionalProperties: false,
143};
144export const showPetByIdResSchema = {
145 type: "object",
146 required: [],
147 properties: {
148 content: {
149 allOf: [
150 {
151 type: "object",
152 properties: {
153 name: { type: "string", description: "pet's name" },
154 tag: { type: "string", enum: ["DOG", "CAT"] },
155 age: { type: "integer", format: "int32" },
156 birthAt: { type: "string", format: "date" },
157 grade: { type: "integer", format: "int32" },
158 owner: { type: "string" },
159 },
160 additionalProperties: false,
161 },
162 {
163 type: "object",
164 required: ["id"],
165 properties: {
166 id: { type: "string" },
167 updateAt: { type: "string", format: "date-time" },
168 updateBy: { type: "string" },
169 createAt: { type: "string", format: "date-time" },
170 createBy: { type: "string" },
171 },
172 additionalProperties: false,
173 },
174 ],
175 },
176 },
177 additionalProperties: false,
178};
179export const updatePetReqSchema = {
180 type: "object",
181 required: ["petId", "body"],
182 properties: {
183 petId: { type: "string", pattern: "[a-f\\d]{24}" },
184 body: {
185 type: "object",
186 properties: {
187 name: { type: "string", description: "pet's name" },
188 tag: { type: "string", enum: ["DOG", "CAT"] },
189 age: { type: "integer", format: "int32" },
190 birthAt: { type: "string", format: "date" },
191 grade: { type: "integer", format: "int32" },
192 owner: { type: "string" },
193 },
194 additionalProperties: false,
195 },
196 },
197 additionalProperties: false,
198};
199export const updatePetResSchema = {
200 type: "object",
201 required: [],
202 properties: {
203 content: {
204 allOf: [
205 {
206 type: "object",
207 properties: {
208 name: { type: "string", description: "pet's name" },
209 tag: { type: "string", enum: ["DOG", "CAT"] },
210 age: { type: "integer", format: "int32" },
211 birthAt: { type: "string", format: "date" },
212 grade: { type: "integer", format: "int32" },
213 owner: { type: "string" },
214 },
215 additionalProperties: false,
216 },
217 {
218 type: "object",
219 required: ["id"],
220 properties: {
221 id: { type: "string" },
222 updateAt: { type: "string", format: "date-time" },
223 updateBy: { type: "string" },
224 createAt: { type: "string", format: "date-time" },
225 createBy: { type: "string" },
226 },
227 additionalProperties: false,
228 },
229 ],
230 },
231 },
232 additionalProperties: false,
233};
234export const deletePetReqSchema = {
235 type: "object",
236 required: ["petId"],
237 properties: { petId: { type: "string", pattern: "[a-f\\d]{24}" } },
238 additionalProperties: false,
239};