@@ -589,7 +589,7 @@ export function hoistRequestAnnotations (
589
589
590
590
if ( jsDocs . length === 1 ) {
591
591
const description = jsDocs [ 0 ] . getDescription ( )
592
- if ( description . length > 0 ) request . description = description . trim ( )
592
+ if ( description . length > 0 ) request . description = description . trim ( ) . replace ( / \r / g , '' )
593
593
}
594
594
const tags = parseJsDocTags ( jsDocs )
595
595
const apiName = tags . rest_spec_name
@@ -639,7 +639,7 @@ export function hoistRequestAnnotations (
639
639
endpoint . docId = value . trim ( )
640
640
const docUrl = docIds . find ( entry => entry [ 0 ] === value . trim ( ) )
641
641
assert ( jsDocs , docUrl != null , `The @doc_id '${ value . trim ( ) } ' is not present in _doc_ids/table.csv` )
642
- endpoint . docUrl = docUrl [ 1 ]
642
+ endpoint . docUrl = docUrl [ 1 ] . replace ( / \r / g , '' )
643
643
} else if ( tag === 'availability' ) {
644
644
// The @availability jsTag is different than most because it allows
645
645
// multiple values within the same docstring, hence needing to parse
@@ -685,7 +685,7 @@ export function hoistTypeAnnotations (type: model.TypeDefinition, jsDocs: JSDoc[
685
685
const tags = parseJsDocTags ( jsDocs )
686
686
if ( jsDocs . length === 1 ) {
687
687
const description = jsDocs [ 0 ] . getDescription ( )
688
- if ( description . length > 0 ) type . description = description . trim ( )
688
+ if ( description . length > 0 ) type . description = description . trim ( ) . replace ( / \r / g , '' )
689
689
}
690
690
691
691
setTags ( jsDocs , type , tags , validTags , ( tags , tag , value ) => {
@@ -703,13 +703,13 @@ export function hoistTypeAnnotations (type: model.TypeDefinition, jsDocs: JSDoc[
703
703
assert ( jsDocs , typeof tags . variants === 'string' , '@non_exhaustive only applies to enums and @variants' )
704
704
} else if ( tag === 'doc_url' ) {
705
705
assert ( jsDocs , isValidUrl ( value ) , '@doc_url is not a valid url' )
706
- type . docUrl = value
706
+ type . docUrl = value . replace ( / \r / g , '' )
707
707
} else if ( tag === 'doc_id' ) {
708
708
assert ( jsDocs , value . trim ( ) !== '' , `Type ${ type . name . namespace } .${ type . name . name } 's @doc_id cannot be empty` )
709
709
type . docId = value . trim ( )
710
710
const docUrl = docIds . find ( entry => entry [ 0 ] === value . trim ( ) )
711
711
assert ( jsDocs , docUrl != null , `The @doc_id '${ value . trim ( ) } ' is not present in _doc_ids/table.csv` )
712
- type . docUrl = docUrl [ 1 ]
712
+ type . docUrl = docUrl [ 1 ] . replace ( / \r / g , '' )
713
713
} else if ( tag === 'codegen_names' ) {
714
714
type . codegenNames = parseCommaSeparated ( value )
715
715
assert ( jsDocs ,
@@ -736,7 +736,7 @@ function hoistPropertyAnnotations (property: model.Property, jsDocs: JSDoc[]): v
736
736
const tags = parseJsDocTags ( jsDocs )
737
737
if ( jsDocs . length === 1 ) {
738
738
const description = jsDocs [ 0 ] . getDescription ( )
739
- if ( description . length > 0 ) property . description = description . trim ( )
739
+ if ( description . length > 0 ) property . description = description . trim ( ) . replace ( / \r / g , '' )
740
740
}
741
741
742
742
if ( tags . doc_id != null ) {
@@ -755,7 +755,7 @@ function hoistPropertyAnnotations (property: model.Property, jsDocs: JSDoc[]): v
755
755
property . codegenName = value
756
756
} else if ( tag === 'doc_url' ) {
757
757
assert ( jsDocs , isValidUrl ( value ) , '@doc_url is not a valid url' )
758
- property . docUrl = value
758
+ property . docUrl = value . replace ( / \r / g , '' )
759
759
} else if ( tag === 'availability' ) {
760
760
// The @availability jsTag is different than most because it allows
761
761
// multiple values within the same docstring, hence needing to parse
@@ -784,7 +784,7 @@ function hoistPropertyAnnotations (property: model.Property, jsDocs: JSDoc[]): v
784
784
property . docId = value
785
785
const docUrl = docIds . find ( entry => entry [ 0 ] === value )
786
786
if ( docUrl != null ) {
787
- property . docUrl = docUrl [ 1 ]
787
+ property . docUrl = docUrl [ 1 ] . replace ( / \r / g , '' )
788
788
}
789
789
} else if ( tag === 'server_default' ) {
790
790
assert ( jsDocs , property . type . kind === 'instance_of' || property . type . kind === 'union_of' || property . type . kind === 'array_of' , `Default values can only be configured for instance_of or union_of types, you are using ${ property . type . kind } ` )
@@ -859,7 +859,7 @@ function hoistEnumMemberAnnotations (member: model.EnumMember, jsDocs: JSDoc[]):
859
859
const tags = parseJsDocTags ( jsDocs )
860
860
if ( jsDocs . length === 1 ) {
861
861
const description = jsDocs [ 0 ] . getDescription ( )
862
- if ( description . length > 0 ) member . description = description . trim ( )
862
+ if ( description . length > 0 ) member . description = description . trim ( ) . replace ( / \r / g , '' )
863
863
}
864
864
865
865
setTags ( jsDocs , member , tags , validTags , ( tags , tag , value ) => {
@@ -1298,7 +1298,7 @@ export function verifyUniqueness (project: Project): void {
1298
1298
if ( path . startsWith ( '_types' ) ) continue
1299
1299
if ( ! path . includes ( '_types' ) ) continue
1300
1300
1301
- const namespace = path . startsWith ( '_global' ) ? `_global${ sep } ${ path . split ( sep ) [ 1 ] } ` : path . split ( sep ) [ 0 ]
1301
+ const namespace = path . startsWith ( '_global' ) ? `_global${ '/' } ${ path . split ( '/' ) [ 1 ] } ` : path . split ( '/' ) [ 0 ]
1302
1302
const names = types . get ( namespace ) ?? [ ]
1303
1303
1304
1304
for ( const declaration of sourceFile . getClasses ( ) ) {
@@ -1339,7 +1339,7 @@ export function verifyUniqueness (project: Project): void {
1339
1339
const path = dirname ( sourceFile . getFilePath ( ) . replace ( / .* [ / \\ ] s p e c i f i c a t i o n [ / \\ ] ? / , '' ) )
1340
1340
if ( path . includes ( '_types' ) ) continue
1341
1341
1342
- const namespace = path . startsWith ( '_global' ) ? `_global${ sep } ${ path . split ( sep ) [ 1 ] } ` : path . split ( sep ) [ 0 ]
1342
+ const namespace = path . startsWith ( '_global' ) ? `_global${ '/' } ${ path . split ( '/' ) [ 1 ] } ` : path . split ( '/' ) [ 0 ]
1343
1343
const names = types . get ( path ) ?? [ ]
1344
1344
const localTypes = types . get ( namespace ) ?? [ ]
1345
1345
@@ -1407,7 +1407,7 @@ export function deepEqual (a: any, b: any): boolean {
1407
1407
}
1408
1408
}
1409
1409
1410
- const basePath = join ( __dirname , '..' , '..' , '..' , 'specification' ) + '/'
1410
+ const basePath = ( join ( __dirname , '..' , '..' , '..' , 'specification' ) + sep ) . replace ( / \\ / g , '/' )
1411
1411
1412
1412
export function sourceLocation ( node : Node ) : string {
1413
1413
const sourceFile = node . getSourceFile ( )
0 commit comments