Skip to content

Commit e114365

Browse files
committed
Add codegenExclude tag to mark endpoints for exclusion from client code generation
1 parent 12d3761 commit e114365

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

compiler/src/model/metamodel.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ export class Endpoint {
469469
index?: string[]
470470
cluster?: string[]
471471
}
472+
codegenExclude?: boolean
472473
}
473474

474475
export class UrlTemplate {

compiler/src/model/utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ export function hoistRequestAnnotations (
634634
request: model.Request, jsDocs: JSDoc[], mappings: Record<string, model.Endpoint>, response: model.TypeName | null
635635
): void {
636636
const knownRequestAnnotations = [
637-
'rest_spec_name', 'behavior', 'class_serializer', 'index_privileges', 'cluster_privileges', 'doc_id', 'availability', 'doc_tag', 'ext_doc_id'
637+
'rest_spec_name', 'behavior', 'class_serializer', 'index_privileges', 'cluster_privileges', 'doc_id', 'availability', 'doc_tag', 'ext_doc_id', 'codegen_exclude'
638638
]
639639
// in most of the cases the jsDocs comes in a single block,
640640
// but it can happen that the user defines multiple single line jsDoc.
@@ -720,6 +720,9 @@ export function hoistRequestAnnotations (
720720
} else if (tag === 'doc_tag') {
721721
assert(jsDocs, value.trim() !== '', `Request ${request.name.name}'s @doc_tag cannot be empty`)
722722
endpoint.docTag = value.trim()
723+
} else if (tag === 'codegen_exclude') {
724+
// Mark this endpoint to be excluded from client code generation
725+
endpoint.codegenExclude = true
723726
} else {
724727
assert(jsDocs, false, `Unhandled tag: '${tag}' with value: '${value}' on request ${request.name.name}`)
725728
}

0 commit comments

Comments
 (0)