Skip to content

Commit 714741f

Browse files
committed
more discriminator
1 parent ba0992f commit 714741f

File tree

7 files changed

+46
-1
lines changed

7 files changed

+46
-1
lines changed

generators/src/main/java/com/algolia/codegen/utils/OneOf.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public static void markCompounds(Map<String, ModelsMap> models, String oneOf, Ma
100100
oneOfModel.put("x-discriminator-fields", values);
101101
// find the matching composed schema and assign the discriminator
102102
for (var m : model.getComposedSchemas().getOneOf()) {
103-
if (m.openApiType.equals(compoundModel.name)) {
103+
if (m.openApiType.equals(compoundModel.classname)) {
104104
m.vendorExtensions.put("x-discriminator-fields", values);
105105
}
106106
}

specs/common/schemas/HighlightResult.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ highlightResultOption:
2020
- value
2121
- matchLevel
2222
- matchedWords
23+
x-discriminator-fields:
24+
- matchLevel
25+
- matchedWords
2326

2427
highlightedValue:
2528
type: string

specs/common/schemas/SnippetResult.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ snippetResultOption:
1010
required:
1111
- value
1212
- matchLevel
13+
x-discriminator-fields:
14+
- matchLevel
1315

1416
snippetResultOptionMap:
1517
type: object

specs/ingestion/common/schemas/authentication.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ AuthGoogleServiceAccountPartial:
127127
privateKey:
128128
type: string
129129
description: Private key of the Google service account. This field is `null` in the API response.
130+
x-discriminator-fields:
131+
- clientEmail
130132

131133
AuthBasicPartial:
132134
type: object
@@ -139,6 +141,8 @@ AuthBasicPartial:
139141
password:
140142
type: string
141143
description: Password. This field is `null` in the API response.
144+
x-discriminator-fields:
145+
- username
142146

143147
AuthAPIKeyPartial:
144148
type: object
@@ -148,6 +152,8 @@ AuthAPIKeyPartial:
148152
key:
149153
type: string
150154
description: API key. This field is `null` in the API response.
155+
x-discriminator-fields:
156+
- key
151157

152158
AuthOAuthPartial:
153159
type: object
@@ -167,6 +173,8 @@ AuthOAuthPartial:
167173
type: string
168174
default: ''
169175
description: OAuth scope.
176+
x-discriminator-fields:
177+
- url
170178

171179
AuthAlgoliaPartial:
172180
type: object
@@ -211,6 +219,9 @@ AuthGoogleServiceAccount:
211219
required:
212220
- clientEmail
213221
- privateKey
222+
x-discriminator-fields:
223+
- clientEmail
224+
- privateKey
214225

215226
AuthBasic:
216227
type: object
@@ -226,6 +237,9 @@ AuthBasic:
226237
required:
227238
- username
228239
- password
240+
x-discriminator-fields:
241+
- username
242+
- password
229243

230244
AuthAPIKey:
231245
type: object
@@ -237,6 +251,8 @@ AuthAPIKey:
237251
description: API key. This field is `null` in the API response.
238252
required:
239253
- key
254+
x-discriminator-fields:
255+
- key
240256

241257
AuthOAuth:
242258
type: object
@@ -260,6 +276,10 @@ AuthOAuth:
260276
- url
261277
- client_id
262278
- client_secret
279+
x-discriminator-fields:
280+
- url
281+
- client_id
282+
- client_secret
263283

264284
AuthAlgolia:
265285
type: object

specs/ingestion/common/schemas/source.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,11 @@ SourceDocker:
366366
- image
367367
- imageType
368368
- configuration
369+
x-discriminator-fields:
370+
- registry
371+
- image
372+
- imageType
373+
- configuration
369374

370375
SourceUpdateDocker:
371376
type: object
@@ -387,6 +392,8 @@ SourceUpdateDocker:
387392
description: Configuration of the spec.
388393
required:
389394
- configuration
395+
x-discriminator-fields:
396+
- configuration
390397

391398
DockerRegistry:
392399
type: string

specs/ingestion/common/schemas/task.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,8 @@ ScheduleTriggerInput:
302302
required:
303303
- type
304304
- cron
305+
x-discriminator-fields:
306+
- cron
305307

306308
ScheduleTrigger:
307309
type: object
@@ -444,6 +446,9 @@ MappingInput:
444446
required:
445447
- format
446448
- actions
449+
x-discriminator-fields:
450+
- format
451+
- actions
447452

448453
StreamingInput:
449454
type: object
@@ -454,6 +459,8 @@ StreamingInput:
454459
$ref: '#/MappingInput'
455460
required:
456461
- mapping
462+
x-discriminator-fields:
463+
- mapping
457464

458465
DockerStreamsInput:
459466
description: The selected streams of a singer or airbyte connector.
@@ -465,6 +472,8 @@ DockerStreamsInput:
465472
$ref: '#/DockerStreams'
466473
required:
467474
- streams
475+
x-discriminator-fields:
476+
- streams
468477

469478
DockerStreams:
470479
type: object

specs/search/paths/rules/common/schemas.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ promoteObjectID:
151151
required:
152152
- position
153153
- objectID
154+
x-discriminator-fields:
155+
- objectID
154156

155157
promoteObjectIDs:
156158
title: objectIDs
@@ -174,6 +176,8 @@ promoteObjectIDs:
174176
required:
175177
- position
176178
- objectIDs
179+
x-discriminator-fields:
180+
- objectIDs
177181

178182
promotePosition:
179183
type: integer

0 commit comments

Comments
 (0)