@@ -647,7 +647,7 @@ export function hoistTypeAnnotations (type: model.TypeDefinition, jsDocs: JSDoc[
647
647
// We want to enforce a single jsDoc block.
648
648
assert ( jsDocs , jsDocs . length < 2 , 'Use a single multiline jsDoc block instead of multiple single line blocks' )
649
649
650
- const validTags = [ 'class_serializer' , 'doc_url' , 'behavior' , 'variants' , 'variant' , 'shortcut_property' , 'codegen_names' ]
650
+ const validTags = [ 'class_serializer' , 'doc_url' , 'doc_id' , ' behavior', 'variants' , 'variant' , 'shortcut_property' , 'codegen_names' ]
651
651
const tags = parseJsDocTags ( jsDocs )
652
652
if ( jsDocs . length === 1 ) {
653
653
const description = jsDocs [ 0 ] . getDescription ( )
@@ -668,6 +668,12 @@ export function hoistTypeAnnotations (type: model.TypeDefinition, jsDocs: JSDoc[
668
668
} else if ( tag === 'doc_url' ) {
669
669
assert ( jsDocs , isValidUrl ( value ) , '@doc_url is not a valid url' )
670
670
type . docUrl = value
671
+ } else if ( tag === 'doc_id' ) {
672
+ assert ( jsDocs , value . trim ( ) !== '' , `Type ${ type . name . namespace } .${ type . name . name } 's @doc_id cannot be empty` )
673
+ type . docId = value . trim ( )
674
+ const docUrl = docIds . find ( entry => entry [ 0 ] === value . trim ( ) )
675
+ assert ( jsDocs , docUrl != null , `The @doc_id '${ value . trim ( ) } ' is not present in _doc_ids/table.csv` )
676
+ type . docUrl = docUrl [ 1 ]
671
677
} else if ( tag === 'codegen_names' ) {
672
678
type . codegenNames = value . split ( ',' ) . map ( v => v . trim ( ) )
673
679
assert ( jsDocs ,
0 commit comments