Skip to content

Commit 97e7b0c

Browse files
committed
Fix open generics definition in type alias verification
1 parent ae611bc commit 97e7b0c

File tree

2 files changed

+3
-32
lines changed

2 files changed

+3
-32
lines changed

compiler/src/steps/validate-model.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ export default async function validateModel (apiModel: model.Model, restSpec: Ma
541541
}
542542

543543
function validateTypeAlias (typeDef: model.TypeAlias): void {
544-
const openGenerics = new Set(typeDef.generics?.map(t => t.name))
544+
const openGenerics = openGenericSet(typeDef);
545545

546546
if (typeDef.variants != null) {
547547
if (typeDef.generics != null && typeDef.generics.length !== 0) {
@@ -674,7 +674,7 @@ export default async function validateModel (apiModel: model.Model, restSpec: Ma
674674
// -----------------------------------------------------------------------------------------------
675675
// Constituents of type definitions
676676

677-
function openGenericSet (typeDef: model.Request | model.Response | model.Interface): Set<string> {
677+
function openGenericSet (typeDef: model.Request | model.Response | model.Interface | model.TypeAlias): Set<string> {
678678
return new Set((typeDef.generics ?? []).map(name => fqn(name)))
679679
}
680680

output/schema/validation-errors.json

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,15 @@
3939
"async_search.get": {
4040
"request": [],
4141
"response": [
42-
"type_alias definition _types:EpochTime / instance_of - No type definition for '_types.EpochTime:Unit'",
43-
"type_alias definition _types.aggregations:Buckets / union_of / dictionary_of / instance_of - No type definition for '_types.aggregations.Buckets:TBucket'",
44-
"type_alias definition _types.aggregations:Buckets / union_of / array_of / instance_of - No type definition for '_types.aggregations.Buckets:TBucket'",
4542
"type_alias definition _spec_utils:Void / instance_of - No type definition for '_builtins:void'",
46-
"type_alias definition _types:DurationValue / instance_of - No type definition for '_types.DurationValue:Unit'",
4743
"type_alias definition _global.search._types:Suggest - A tagged union should not have generic parameters",
4844
"type_alias definition _global.search._types:Suggest / instance_of / Generics / instance_of - No type definition for '_global.search._types.Suggest:TDocument'",
4945
"type_alias definition _global.search._types:Suggest - Expected 1 generic parameters but got 0"
5046
]
5147
},
5248
"async_search.submit": {
5349
"request": [
54-
"interface definition _types:QueryVectorBuilder - Property text_embedding is a single-variant and must be required",
55-
"type_alias definition _spec_utils:PipeSeparatedFlags / union_of / instance_of - No type definition for '_spec_utils.PipeSeparatedFlags:T'"
50+
"interface definition _types:QueryVectorBuilder - Property text_embedding is a single-variant and must be required"
5651
],
5752
"response": []
5853
},
@@ -62,12 +57,6 @@
6257
],
6358
"response": []
6459
},
65-
"cat.allocation": {
66-
"request": [],
67-
"response": [
68-
"type_alias definition _spec_utils:Stringified / union_of / instance_of - No type definition for '_spec_utils.Stringified:T'"
69-
]
70-
},
7160
"cat.count": {
7261
"request": [
7362
"Request: query parameter 'master_timeout' does not exist in the json spec"
@@ -353,12 +342,6 @@
353342
],
354343
"response": []
355344
},
356-
"connector.update_error": {
357-
"request": [
358-
"type_alias definition _spec_utils:WithNullValue / union_of / instance_of - No type definition for '_spec_utils.WithNullValue:T'"
359-
],
360-
"response": []
361-
},
362345
"connector.update_features": {
363346
"request": [
364347
"Missing request & response"
@@ -445,12 +428,6 @@
445428
],
446429
"response": []
447430
},
448-
"fleet.msearch": {
449-
"request": [],
450-
"response": [
451-
"type_alias definition _global.msearch:ResponseItem / union_of / instance_of / Generics / instance_of - No type definition for '_global.msearch.ResponseItem:TDocument'"
452-
]
453-
},
454431
"fleet.post_secret": {
455432
"request": [
456433
"Missing request & response"
@@ -650,12 +627,6 @@
650627
],
651628
"response": []
652629
},
653-
"mget": {
654-
"request": [],
655-
"response": [
656-
"type_alias definition _global.mget:ResponseItem / union_of / instance_of / Generics / instance_of - No type definition for '_global.mget.ResponseItem:TDocument'"
657-
]
658-
},
659630
"ml.delete_trained_model": {
660631
"request": [
661632
"Request: missing json spec query parameter 'timeout'"

0 commit comments

Comments
 (0)