diff --git a/compiler-rs/compiler-wasm-lib/pkg/compiler_wasm_lib_bg.wasm b/compiler-rs/compiler-wasm-lib/pkg/compiler_wasm_lib_bg.wasm index b18a2248d4..ca5c0407d7 100644 Binary files a/compiler-rs/compiler-wasm-lib/pkg/compiler_wasm_lib_bg.wasm and b/compiler-rs/compiler-wasm-lib/pkg/compiler_wasm_lib_bg.wasm differ diff --git a/compiler/src/model/metamodel.ts b/compiler/src/model/metamodel.ts index 5e7d01e23c..16c3c93e24 100644 --- a/compiler/src/model/metamodel.ts +++ b/compiler/src/model/metamodel.ts @@ -209,7 +209,7 @@ export class Container extends VariantBase { export class Untagged extends VariantBase { kind: 'untagged' - untypedVariant: Inherits + untypedVariant: TypeName } /** @@ -223,7 +223,7 @@ export class Inherits { export class Behavior { type: TypeName generics?: ValueOf[] - meta?: { [p: string]: string } + meta?: Record } /** diff --git a/compiler/src/model/utils.ts b/compiler/src/model/utils.ts index e798a34e53..cb914941ee 100644 --- a/compiler/src/model/utils.ts +++ b/compiler/src/model/utils.ts @@ -1129,10 +1129,8 @@ export function parseVariantsTag (jsDoc: JSDoc[]): model.Variants | undefined { kind: 'untagged', nonExhaustive: nonExhaustive, untypedVariant: { - type: { - namespace: fqn.slice(0, fqn.length - 1).join('.'), - name: fqn[fqn.length - 1] - } + namespace: fqn.slice(0, fqn.length - 1).join('.'), + name: fqn[fqn.length - 1] } } } diff --git a/compiler/src/steps/validate-model.ts b/compiler/src/steps/validate-model.ts index 95ba7db7ea..4352482f6e 100644 --- a/compiler/src/steps/validate-model.ts +++ b/compiler/src/steps/validate-model.ts @@ -617,9 +617,9 @@ export default async function validateModel (apiModel: model.Model, restSpec: Ma throw new Error(`Please contact the devtools team before adding new untagged variant ${fqn(parentName)}`) } - const untypedVariant = getTypeDef(variants.untypedVariant.type) + const untypedVariant = getTypeDef(variants.untypedVariant) if (untypedVariant == null) { - modelError(`Type ${fqn(variants.untypedVariant.type)} not found`) + modelError(`Type ${fqn(variants.untypedVariant)} not found`) } const items = flattenUnionMembers(valueOf) diff --git a/output/schema/schema.json b/output/schema/schema.json index 5973cefdcf..54b5328f2e 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -75615,10 +75615,8 @@ "variants": { "kind": "untagged", "untypedVariant": { - "type": { - "name": "UntypedDecayFunction", - "namespace": "_types.query_dsl" - } + "name": "UntypedDecayFunction", + "namespace": "_types.query_dsl" } } }, @@ -75841,10 +75839,8 @@ "variants": { "kind": "untagged", "untypedVariant": { - "type": { - "name": "UntypedDistanceFeatureQuery", - "namespace": "_types.query_dsl" - } + "name": "UntypedDistanceFeatureQuery", + "namespace": "_types.query_dsl" } } }, @@ -81191,10 +81187,8 @@ "variants": { "kind": "untagged", "untypedVariant": { - "type": { - "name": "UntypedRangeQuery", - "namespace": "_types.query_dsl" - } + "name": "UntypedRangeQuery", + "namespace": "_types.query_dsl" } } }, diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 4d78da010e..7d83e87fb8 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -5492,7 +5492,7 @@ export interface QueryDslConstantScoreQuery extends QueryDslQueryBase { filter: QueryDslQueryContainer } -export interface QueryDslDateDecayFunctionKeys extends QueryDslDecayFunctionBase { +export interface QueryDslDateDecayFunctionKeys extends QueryDslDecayFunctionBase> { } export type QueryDslDateDecayFunction = QueryDslDateDecayFunctionKeys & { [property: string]: QueryDslDecayPlacement | QueryDslMultiValueMode } @@ -5501,9 +5501,11 @@ export interface QueryDslDateDistanceFeatureQuery extends QueryDslDistanceFeatur } export interface QueryDslDateRangeQuery extends QueryDslRangeQueryBase { + format?: DateFormat + time_zone?: TimeZone } -export type QueryDslDecayFunction = QueryDslDateDecayFunction | QueryDslNumericDecayFunction | QueryDslGeoDecayFunction +export type QueryDslDecayFunction = QueryDslUntypedDecayFunction | QueryDslDateDecayFunction | QueryDslNumericDecayFunction | QueryDslGeoDecayFunction export interface QueryDslDecayFunctionBase { multi_value_mode?: QueryDslMultiValueMode @@ -5521,7 +5523,7 @@ export interface QueryDslDisMaxQuery extends QueryDslQueryBase { tie_breaker?: double } -export type QueryDslDistanceFeatureQuery = QueryDslGeoDistanceFeatureQuery | QueryDslDateDistanceFeatureQuery +export type QueryDslDistanceFeatureQuery = QueryDslUntypedDistanceFeatureQuery | QueryDslGeoDistanceFeatureQuery | QueryDslDateDistanceFeatureQuery export interface QueryDslDistanceFeatureQueryBase extends QueryDslQueryBase { origin: TOrigin @@ -5596,7 +5598,7 @@ export interface QueryDslGeoBoundingBoxQueryKeys extends QueryDslQueryBase { export type QueryDslGeoBoundingBoxQuery = QueryDslGeoBoundingBoxQueryKeys & { [property: string]: GeoBounds | QueryDslGeoExecution | QueryDslGeoValidationMethod | boolean | float | string } -export interface QueryDslGeoDecayFunctionKeys extends QueryDslDecayFunctionBase { +export interface QueryDslGeoDecayFunctionKeys extends QueryDslDecayFunctionBase> { } export type QueryDslGeoDecayFunction = QueryDslGeoDecayFunctionKeys & { [property: string]: QueryDslDecayPlacement | QueryDslMultiValueMode } @@ -5850,7 +5852,7 @@ export interface QueryDslNestedQuery extends QueryDslQueryBase { export interface QueryDslNumberRangeQuery extends QueryDslRangeQueryBase { } -export interface QueryDslNumericDecayFunctionKeys extends QueryDslDecayFunctionBase { +export interface QueryDslNumericDecayFunctionKeys extends QueryDslDecayFunctionBase> { } export type QueryDslNumericDecayFunction = QueryDslNumericDecayFunctionKeys & { [property: string]: QueryDslDecayPlacement | QueryDslMultiValueMode } @@ -5993,7 +5995,7 @@ export interface QueryDslRandomScoreFunction { seed?: long | string } -export type QueryDslRangeQuery = QueryDslDateRangeQuery | QueryDslNumberRangeQuery | QueryDslTermRangeQuery +export type QueryDslRangeQuery = QueryDslUntypedRangeQuery | QueryDslDateRangeQuery | QueryDslNumberRangeQuery | QueryDslTermRangeQuery export interface QueryDslRangeQueryBase extends QueryDslQueryBase { relation?: QueryDslRangeRelation @@ -6003,8 +6005,6 @@ export interface QueryDslRangeQueryBase extends QueryDslQueryBase { lte?: T from?: T | null to?: T | null - format?: DateFormat - time_zone?: TimeZone } export type QueryDslRangeRelation = 'within' | 'contains' | 'intersects' @@ -6219,6 +6219,19 @@ export interface QueryDslTypeQuery extends QueryDslQueryBase { value: string } +export interface QueryDslUntypedDecayFunctionKeys extends QueryDslDecayFunctionBase { +} +export type QueryDslUntypedDecayFunction = QueryDslUntypedDecayFunctionKeys + & { [property: string]: any } + +export interface QueryDslUntypedDistanceFeatureQuery extends QueryDslDistanceFeatureQueryBase { +} + +export interface QueryDslUntypedRangeQuery extends QueryDslRangeQueryBase { + format?: DateFormat + time_zone?: TimeZone +} + export interface QueryDslWeightedTokensQuery extends QueryDslQueryBase { tokens: Record pruning_config?: QueryDslTokenPruningConfig diff --git a/typescript-generator/src/metamodel.ts b/typescript-generator/src/metamodel.ts index 5e7d01e23c..16c3c93e24 100644 --- a/typescript-generator/src/metamodel.ts +++ b/typescript-generator/src/metamodel.ts @@ -209,7 +209,7 @@ export class Container extends VariantBase { export class Untagged extends VariantBase { kind: 'untagged' - untypedVariant: Inherits + untypedVariant: TypeName } /** @@ -223,7 +223,7 @@ export class Inherits { export class Behavior { type: TypeName generics?: ValueOf[] - meta?: { [p: string]: string } + meta?: Record } /**