Skip to content

Commit 331583c

Browse files
floberndpquentin
andauthored
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>
1 parent 1ffaf38 commit 331583c

File tree

3 files changed

+55
-1
lines changed

3 files changed

+55
-1
lines changed

compiler/src/model/build-model.ts

+12-1
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/schema/schema-serverless.json

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/schema/schema.json

+31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)