Skip to content

Commit 03dbb76

Browse files
Support allOf property shape (#42)
* chore(models): add APIC-743 model * fix(allof): add support for allOf property shapes as complex types * test: add test for allOf property having SHOW button * 4.2.16 * test: remove waiting for aTimeout * test: change type import method
1 parent b5693ab commit 03dbb76

File tree

8 files changed

+426
-7
lines changed

8 files changed

+426
-7
lines changed

demo/APIC-743/APIC-743.yaml

Lines changed: 367 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,367 @@
1+
openapi: 3.0.0
2+
info:
3+
title: safeco-xapi
4+
description: |-
5+
# safeco-api specification
6+
---
7+
## Initial Draft
8+
version: v0
9+
10+
paths:
11+
/ping:
12+
get:
13+
security:
14+
- oauth_2_0:
15+
- manage:scope
16+
tags:
17+
- Ping
18+
summary: Get api status
19+
responses:
20+
'200':
21+
description: ok
22+
content:
23+
application/json:
24+
schema:
25+
$ref: "#/components/schemas/pingResponse"
26+
27+
/rates:
28+
post:
29+
security:
30+
- oauth_2_0:
31+
- manage:scope
32+
tags:
33+
- Rate
34+
summary: "Get the rates for pet insurance premiums by passing necessary information"
35+
requestBody:
36+
required: true
37+
content:
38+
application/json:
39+
schema:
40+
$ref: '#/components/schemas/getRateRequest'
41+
responses:
42+
'201' :
43+
description: success
44+
content:
45+
application/json:
46+
schema:
47+
$ref: '#/components/schemas/getRateResponse'
48+
49+
'400':
50+
$ref: "#/components/responses/badRequest400"
51+
'401':
52+
$ref: "#/components/responses/unauthorised401"
53+
'404':
54+
$ref: "#/components/responses/notFound404"
55+
'5XX':
56+
$ref: "#/components/responses/serverError5XX"
57+
58+
59+
components:
60+
securitySchemes:
61+
oauth_2_0:
62+
type: oauth2
63+
description: This API supports OAuth 2.0 for authenticating all API requests.
64+
flows:
65+
authorizationCode:
66+
authorizationUrl: https://petscovered.okta.com/oauth2/default/v1/authorize
67+
tokenUrl: https://petscovered.okta.com/oauth2/default/v1/token
68+
scopes:
69+
manage:scope: Manage scope for resource
70+
71+
72+
schemas:
73+
getRateRequest:
74+
type: object
75+
properties:
76+
producer:
77+
description: Details of Producer or Agent related with the request.
78+
allOf:
79+
- $ref: "#/components/schemas/commonNameProperties"
80+
- $ref: "#/components/schemas/commonAddressProperties"
81+
- $ref : '#/components/schemas/producerProperties'
82+
required:
83+
- producerId
84+
- isActive
85+
- lastName
86+
customer:
87+
description: Details of Customer related with the request.
88+
allOf:
89+
- $ref: "#/components/schemas/commonNameProperties"
90+
- $ref: "#/components/schemas/commonAddressProperties"
91+
- $ref : '#/components/schemas/customerProperties'
92+
required:
93+
- lastName
94+
- email
95+
pet:
96+
$ref : '#/components/schemas/pet'
97+
ratingFactors:
98+
type: array
99+
description: Each rating as a separate object with unique setName property. Duplicate setName properties are not processed.
100+
items:
101+
$ref : '#/components/schemas/ratingFactor'
102+
required:
103+
- producer
104+
- customer
105+
- pet
106+
- ratingFactors
107+
108+
109+
getRateResponse:
110+
type: object
111+
properties:
112+
leadId:
113+
type: string
114+
example: "4224901b30414542e46c01394baa190e"
115+
petId:
116+
type: string
117+
example: "405ea8b7b7708033116ba6f2adb89c92"
118+
rates:
119+
$ref : '#/components/schemas/rates'
120+
121+
122+
pingResponse:
123+
type: object
124+
properties:
125+
success:
126+
type: boolean
127+
example: true
128+
code:
129+
type: number
130+
example: 200
131+
status:
132+
type: string
133+
example: Alive
134+
env:
135+
type: string
136+
example: dev
137+
moduleName:
138+
type: string
139+
example: safeco-api
140+
141+
commonNameProperties:
142+
type: object
143+
properties:
144+
firstName:
145+
type: string
146+
example: "Leonel"
147+
middleName:
148+
type: string
149+
example: "Andreas"
150+
lastName:
151+
type: string
152+
example: "Messi"
153+
154+
commonAddressProperties:
155+
type: object
156+
properties:
157+
address:
158+
type: string
159+
example: "221B Baker Street"
160+
addressCont:
161+
type: string
162+
example: "Near Scotland Yard"
163+
city:
164+
type: string
165+
example: "New York"
166+
state:
167+
type: string
168+
example: "IN"
169+
zip:
170+
type: string
171+
example: "85001"
172+
173+
174+
producerProperties:
175+
type: object
176+
properties:
177+
producerId:
178+
type: string
179+
example: "1234567890"
180+
npn:
181+
type: string
182+
example: "1234567890"
183+
type:
184+
type: string
185+
example: " "
186+
mobilePhone:
187+
type: string
188+
example: "987898799"
189+
officePhone:
190+
type: string
191+
example: "02166728988"
192+
email:
193+
type: string
194+
example: "insurance.agent@companionprotect.com"
195+
websiteUrl:
196+
type: string
197+
example: "www.companionprotect.com"
198+
managerId:
199+
type: string
200+
example: "b12F005"
201+
locationId:
202+
type: string
203+
example: "0AB234"
204+
locationName:
205+
type: string
206+
example: "xyz"
207+
isActive:
208+
type: boolean
209+
example: true
210+
riskState:
211+
type: string
212+
example: ""
213+
214+
215+
216+
customerProperties:
217+
type: object
218+
properties:
219+
leadId:
220+
type: string
221+
example: "4224901b30414542e46c01394baa190e"
222+
phone:
223+
type: string
224+
example: "5052331872"
225+
email:
226+
type: string
227+
example: "abc@gmail.com"
228+
required:
229+
- email
230+
231+
232+
pet:
233+
description: Details of the pet related with the request.
234+
type: object
235+
properties:
236+
name:
237+
type: string
238+
example: "max"
239+
species:
240+
type: string
241+
example: "Dog"
242+
breed:
243+
type: string
244+
example: "akita"
245+
gender:
246+
type: string
247+
example: "Male"
248+
ageInYears:
249+
type: integer
250+
example: 4
251+
required:
252+
- name
253+
- species
254+
- breed
255+
256+
257+
ratingFactor:
258+
type: object
259+
properties:
260+
setName:
261+
type: string
262+
example: "option1"
263+
deductible:
264+
type: number
265+
example: 90
266+
reimbursement:
267+
type: number
268+
example: 200
269+
annualLimit:
270+
type: number
271+
example: 10000
272+
required:
273+
- setName
274+
- deductible
275+
- reimbursement
276+
- annualLimit
277+
278+
279+
rates:
280+
type: array
281+
items:
282+
type: object
283+
properties:
284+
setName:
285+
type: string
286+
example: "name"
287+
premiumAmount:
288+
type: number
289+
multipleOf: 0.01
290+
example: 48.6
291+
wellnessPremiumAmount:
292+
type: number
293+
multipleOf: 0.01
294+
example: 48.48
295+
totalMonthlyPremiumAmount:
296+
type: number
297+
multipleOf: 0.01
298+
example: 8.09
299+
totalAnnualPremiumAmount:
300+
type: number
301+
multipleOf: 0.01
302+
example: 97.08
303+
304+
305+
306+
responses:
307+
badRequest400:
308+
description: Bad Request
309+
content:
310+
application/json:
311+
schema:
312+
type: object
313+
examples:
314+
badRequest400:
315+
$ref: "#/components/examples/badRequest400"
316+
unauthorised401:
317+
description: Unauthorised
318+
content:
319+
application/json:
320+
schema:
321+
type: object
322+
examples:
323+
unauthorised401:
324+
$ref: "#/components/examples/unauthorised401"
325+
serverError5XX:
326+
description: Internal Server Error
327+
content:
328+
application/json:
329+
schema:
330+
type: object
331+
examples:
332+
serverError5xx:
333+
$ref: "#/components/examples/serverError5XX"
334+
notFound404:
335+
description: Resource Notfound
336+
content:
337+
application/json:
338+
schema:
339+
type: object
340+
examples:
341+
notFound404:
342+
$ref: "#/components/examples/notFound404"
343+
examples:
344+
badRequest400:
345+
value:
346+
success: false
347+
code: 400
348+
reasonCode: Bad Request
349+
message: Required header Authorization not specified
350+
unauthorised401:
351+
value:
352+
success: false
353+
code: 401
354+
reasonCode: Unauthorised
355+
message: unauthorised request
356+
notFound404:
357+
value:
358+
success: false
359+
code: 404
360+
reasonCode: Resource Not found
361+
message: requested resource not found or does not exist
362+
serverError5XX:
363+
value:
364+
success: false
365+
code: 500
366+
reasonCode: Internal Server Error
367+
message: Internal Server Error

demo/apis.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@
1818
"new-oas3-types/new-oas3-types.yaml": { "type": "OAS 3.0", "mime": "application/yaml" },
1919
"oas-api/read-only-properties.yaml": { "type": "OAS 3.0", "mime": "application/yaml" },
2020
"APIC-649/APIC-649.yaml": { "type": "OAS 3.0", "mime": "application/yaml" },
21-
"APIC-671/APIC-671.yaml": { "type": "OAS 3.0", "mime": "application/yaml" }
21+
"APIC-671/APIC-671.yaml": { "type": "OAS 3.0", "mime": "application/yaml" },
22+
"APIC-743/APIC-743.yaml": { "type": "OAS 3.0", "mime": "application/yaml" }
2223
}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@api-components/api-type-document",
33
"description": "A documentation table for type (resource) properties. Works with AMF data model",
4-
"version": "4.2.15",
4+
"version": "4.2.16",
55
"license": "Apache-2.0",
66
"main": "index.js",
77
"module": "index.js",

0 commit comments

Comments
 (0)