Skip to content

Commit 539f489

Browse files
committed
Emit codegen_name for response value bodies (#3953)
* Emit `codegen_name` for response value bodies * Run make contrib --------- Co-authored-by: Quentin Pradet <quentin.pradet@elastic.co> (cherry picked from commit 331583c) # Conflicts: # output/schema/schema-serverless.json
1 parent 64489aa commit 539f489

File tree

5 files changed

+62
-9
lines changed

5 files changed

+62
-9
lines changed

compiler/src/model/build-model.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,18 @@ function compileClassOrInterfaceDeclaration (declaration: ClassDeclaration | Int
383383
if (property.valueOf.kind === 'instance_of' && property.valueOf.type.name === 'Void') {
384384
type.body = { kind: 'no_body' }
385385
} else {
386-
type.body = { kind: 'value', value: property.valueOf }
386+
const tags = parseJsDocTags((member as PropertySignature).getJsDocs())
387+
// TODO: Enable this after adding the missing codegen names.
388+
// assert(
389+
// member as Node,
390+
// tags.codegen_name != null,
391+
// 'You should configure a body @codegen_name'
392+
// )
393+
type.body = {
394+
kind: 'value',
395+
value: property.valueOf,
396+
codegenName: tags.codegen_name
397+
}
387398
}
388399
} else {
389400
type.body = { kind: 'properties', properties: property.properties }

output/openapi/elasticsearch-openapi.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/openapi/elasticsearch-serverless-openapi.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/schema/schema-serverless.json

Lines changed: 13 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)