Skip to content

Commit 134d653

Browse files
fix(javascript): use oneOf
1 parent bdf6218 commit 134d653

File tree

4 files changed

+144
-109
lines changed

4 files changed

+144
-109
lines changed

specs/predict/common/parameters.yml

Lines changed: 0 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -5,110 +5,3 @@ userID:
55
schema:
66
type: string
77
description: User ID for authenticated users or cookie ID for non-authenticated repeated users (visitors).
8-
9-
userProfile:
10-
type: object
11-
required:
12-
- user
13-
properties:
14-
user:
15-
type: string
16-
predictions:
17-
type: object
18-
title: predictions
19-
properties:
20-
funnel_stage:
21-
type: object
22-
description: Prediction for the **funnel_stage** model.
23-
properties:
24-
value:
25-
type: array
26-
items:
27-
title: funnel_stage
28-
type: object
29-
properties:
30-
name:
31-
type: string
32-
probability:
33-
type: number
34-
format: double
35-
minimum: 0
36-
maximum: 1
37-
required:
38-
- name
39-
- probability
40-
lastUpdatedAt:
41-
type: string
42-
error:
43-
type: string
44-
order_value:
45-
type: object
46-
description: Prediction for the **order_value** model.
47-
properties:
48-
value:
49-
type: number
50-
format: double
51-
minimum: 0
52-
lastUpdatedAt:
53-
type: string
54-
error:
55-
type: string
56-
affinities:
57-
type: object
58-
description: Prediction for the **affinities** model.
59-
properties:
60-
value:
61-
type: array
62-
items:
63-
title: affinity
64-
type: object
65-
properties:
66-
name:
67-
type: string
68-
value:
69-
type: string
70-
probability:
71-
type: number
72-
format: double
73-
minimum: 0
74-
maximum: 1
75-
required:
76-
- name
77-
- value
78-
- probability
79-
lastUpdatedAt:
80-
type: string
81-
error:
82-
type: string
83-
properties:
84-
type: object
85-
title: properties
86-
description: Properties for the user profile.
87-
properties:
88-
raw:
89-
type: object
90-
description: Raw user properties (key-value pairs).
91-
computed:
92-
type: object
93-
description: Computed user properties (key-value pairs).
94-
custom:
95-
type: object
96-
description: Custom user properties (key-value pairs).
97-
segments:
98-
type: object
99-
title: segments
100-
required:
101-
- computed
102-
- custom
103-
description: Segments that the user belongs to.
104-
properties:
105-
computed:
106-
type: array
107-
description: List of computed segments IDs.
108-
items:
109-
type: string
110-
custom:
111-
type: array
112-
description: List of custom segments IDs.
113-
items:
114-
type: string

specs/predict/paths/users/fetch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ post:
1919
application/json:
2020
schema:
2121
title: fetchUserProfileResponse
22-
$ref: '../../common/parameters.yml#/userProfile'
22+
$ref: '../../responses/UserProfile.yml#/userProfile'
2323
'404':
2424
$ref: '../../responses/UserNotFound.yml'
2525
'405':

specs/predict/paths/users/fetchAll.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ post:
2424
users:
2525
type: array
2626
items:
27-
$ref: '../../common/parameters.yml#/userProfile'
27+
$ref: '../../responses/UserProfile.yml#/userProfile'
2828
previousPageToken:
2929
$ref: '../../common/schemas/Params.yml#/previousPageToken'
3030
nextPageToken:
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
userProfile:
2+
type: object
3+
required:
4+
- user
5+
properties:
6+
user:
7+
type: string
8+
predictions:
9+
type: object
10+
title: predictions
11+
properties:
12+
funnel_stage:
13+
$ref: '#/funnel_stage'
14+
order_value:
15+
$ref: '#/order_value'
16+
affinities:
17+
$ref: '#/affinities'
18+
properties:
19+
type: object
20+
title: properties
21+
description: Properties for the user profile.
22+
properties:
23+
raw:
24+
type: object
25+
description: Raw user properties (key-value pairs).
26+
computed:
27+
type: object
28+
description: Computed user properties (key-value pairs).
29+
custom:
30+
type: object
31+
description: Custom user properties (key-value pairs).
32+
segments:
33+
type: object
34+
title: segments
35+
required:
36+
- computed
37+
- custom
38+
description: Segments that the user belongs to.
39+
properties:
40+
computed:
41+
type: array
42+
description: List of computed segments IDs.
43+
items:
44+
type: string
45+
custom:
46+
type: array
47+
description: List of custom segments IDs.
48+
items:
49+
type: string
50+
51+
error:
52+
type: object
53+
description: The error when the model is not available.
54+
properties:
55+
error:
56+
type: string
57+
required:
58+
- error
59+
60+
funnel_stage:
61+
oneOf:
62+
- $ref: '#/funnelStageSuccess'
63+
- $ref: '#/error'
64+
65+
funnelStageSuccess:
66+
type: object
67+
description: Prediction for the **funnel_stage** model.
68+
properties:
69+
value:
70+
type: array
71+
items:
72+
title: funnel_stage
73+
type: object
74+
properties:
75+
name:
76+
type: string
77+
probability:
78+
type: number
79+
format: double
80+
minimum: 0
81+
maximum: 1
82+
required:
83+
- name
84+
- probability
85+
lastUpdatedAt:
86+
type: string
87+
required:
88+
- value
89+
- lastUpdatedAt
90+
91+
order_value:
92+
oneOf:
93+
- $ref: '#/orderValueSuccess'
94+
- $ref: '#/error'
95+
96+
orderValueSuccess:
97+
type: object
98+
description: Prediction for the **order_value** model.
99+
properties:
100+
value:
101+
type: number
102+
format: double
103+
minimum: 0
104+
lastUpdatedAt:
105+
type: string
106+
required:
107+
- value
108+
- lastUpdatedAt
109+
110+
affinities:
111+
oneOf:
112+
- $ref: '#/affinitiesSuccess'
113+
- $ref: '#/error'
114+
115+
affinitiesSuccess:
116+
type: object
117+
description: Prediction for the **affinities** model.
118+
properties:
119+
value:
120+
type: array
121+
items:
122+
title: affinity
123+
type: object
124+
properties:
125+
name:
126+
type: string
127+
value:
128+
type: string
129+
probability:
130+
type: number
131+
format: double
132+
minimum: 0
133+
maximum: 1
134+
required:
135+
- name
136+
- value
137+
- probability
138+
lastUpdatedAt:
139+
type: string
140+
required:
141+
- value
142+
- lastUpdatedAt

0 commit comments

Comments
 (0)