diff --git a/compiler-rs/clients_schema/src/transform/expand_generics.rs b/compiler-rs/clients_schema/src/transform/expand_generics.rs index d6346cd319..50c1db12b1 100644 --- a/compiler-rs/clients_schema/src/transform/expand_generics.rs +++ b/compiler-rs/clients_schema/src/transform/expand_generics.rs @@ -211,8 +211,10 @@ pub fn expand(model: IndexedModel, config: ExpandConfig) -> anyhow::Result()) + break + case 'value': + validateValueOf(ex.body.value, openGenerics) + break + case 'no_body': + // Nothing to validate + break + } + } + } + context.pop() } diff --git a/compiler/src/transform/expand-generics.ts b/compiler/src/transform/expand-generics.ts index 348cc9b365..f128eb264c 100644 --- a/compiler/src/transform/expand-generics.ts +++ b/compiler/src/transform/expand-generics.ts @@ -27,7 +27,7 @@ import { Request, Response, Body, - InstanceOf, Inherits, Property + InstanceOf, Inherits, Property, ResponseException } from '../model/metamodel' import { readFile, writeFile } from 'fs/promises' import stringify from 'safe-stable-stringify' @@ -293,6 +293,17 @@ export function expandGenerics (inputModel: Model, config?: ExpansionConfig): Mo return addIfNotSeen(resp.name, () => { const result = { ...resp } result.body = expandBody(resp.body, genericParamMapping(resp.generics, params)) + if (resp.exceptions != null) { + result.exceptions = [] + for (const exception of resp.exceptions) { + const except: ResponseException = { + description: exception.description, + statusCodes: exception.statusCodes, + body: expandBody(exception.body, genericParamMapping(resp.generics, params)) + } + result.exceptions.push(except) + } + } result.generics = undefined return result }) diff --git a/specification/indices/get_alias/IndicesGetAliasResponse.ts b/specification/indices/get_alias/IndicesGetAliasResponse.ts index ddc1676942..0c3831e196 100644 --- a/specification/indices/get_alias/IndicesGetAliasResponse.ts +++ b/specification/indices/get_alias/IndicesGetAliasResponse.ts @@ -19,8 +19,10 @@ import { ErrorResponseBase } from '@_types/Base' import { IndexName } from '@_types/common' -import { AliasDefinition } from '@indices/_types/AliasDefinition' -import { AdditionalProperties } from '@spec_utils/behaviors' +import { + IndexAliases, + NotFoundAliases +} from '@indices/get_alias/_types/response' import { Dictionary } from '@spec_utils/Dictionary' export class Response { @@ -33,12 +35,3 @@ export class Response { } ] } - -export class IndexAliases { - aliases: Dictionary -} - -class NotFoundAliases implements AdditionalProperties { - error: string - status: number -} diff --git a/specification/indices/get_alias/_types/response.ts b/specification/indices/get_alias/_types/response.ts new file mode 100644 index 0000000000..20bd1d4989 --- /dev/null +++ b/specification/indices/get_alias/_types/response.ts @@ -0,0 +1,33 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { AliasDefinition } from '@indices/_types/AliasDefinition' +import { AdditionalProperties } from '@spec_utils/behaviors' +import { Dictionary } from '@spec_utils/Dictionary' + +export class IndexAliases { + aliases: Dictionary +} + +export class NotFoundAliases + implements AdditionalProperties +{ + error: string + status: number +}