1
- import type { IR } from ' ../../../ir/types' ;
2
- import { stringCase } from ' ../../../utils/stringCase' ;
3
- import { sanitizeNamespaceIdentifier } from ' ../../common/parser/sanitize' ;
4
- import type { State } from ' ../types/state' ;
1
+ import type { IR } from " ../../../ir/types" ;
2
+ import { stringCase } from " ../../../utils/stringCase" ;
3
+ import { sanitizeNamespaceIdentifier } from " ../../common/parser/sanitize" ;
4
+ import type { State } from " ../types/state" ;
5
5
6
6
/**
7
7
* Verifies that operation ID is unique. For now, we only warn when this isn't
@@ -17,7 +17,7 @@ export const ensureUniqueOperationId = ({
17
17
} : {
18
18
context : IR . Context ;
19
19
id : string | undefined ;
20
- method : IR . OperationObject [ ' method' ] ;
20
+ method : IR . OperationObject [ " method" ] ;
21
21
operationIds : Map < string , string > ;
22
22
path : keyof IR . PathsObject ;
23
23
} ) => {
@@ -28,10 +28,10 @@ export const ensureUniqueOperationId = ({
28
28
const operationKey = `${ method . toUpperCase ( ) } ${ path } ` ;
29
29
30
30
if ( operationIds . has ( id ) ) {
31
- if ( context . config . logs . level !== ' silent' ) {
31
+ if ( context . config . logs . level !== " silent" ) {
32
32
// TODO: parser - support throw on duplicate
33
33
console . warn (
34
- `❗️ Duplicate operationId: ${ id } in ${ operationKey } . Please ensure your operation IDs are unique. This behavior is not supported and will likely lead to unexpected results.` ,
34
+ `❗️ Duplicate operationId: ${ id } in ${ operationKey } . Please ensure your operation IDs are unique. This behavior is not supported and will likely lead to unexpected results.`
35
35
) ;
36
36
}
37
37
} else {
@@ -57,27 +57,29 @@ export const operationToId = ({
57
57
id : string | undefined ;
58
58
method : string ;
59
59
path : string ;
60
- state : Pick < State , ' ids' > ;
60
+ state : Pick < State , " ids" > ;
61
61
} ) : string => {
62
62
let result : string ;
63
63
64
64
const { output } = context . config ;
65
- const targetCase = ( output !== void 0 && 'case' in output ? output . case : void 0 ) ?? 'camelCase' ;
65
+ const targetCase =
66
+ ( output !== void 0 && "case" in output ? output . case : void 0 ) ??
67
+ "camelCase" ;
66
68
67
69
if (
68
70
id &&
69
- ( ! context . config . plugins [ ' @hey-api/sdk' ] ||
70
- context . config . plugins [ ' @hey-api/sdk' ] . operationId )
71
+ ( ! context . config . plugins [ " @hey-api/sdk" ] ||
72
+ context . config . plugins [ " @hey-api/sdk" ] . operationId )
71
73
) {
72
74
result = stringCase ( {
73
75
case : targetCase ,
74
76
value : sanitizeNamespaceIdentifier ( id ) ,
75
77
} ) ;
76
78
} else {
77
79
const urlWithoutPlaceholders = path
78
- . replace ( / { ( .* ?) } / g, ' by-$1' )
80
+ . replace ( / { ( .* ?) } / g, " by-$1" )
79
81
// replace slashes with hyphens for camelcase method at the end
80
- . replace ( / [ / : + ] / g, '-' ) ;
82
+ . replace ( / [ / : + ] / g, "-" ) ;
81
83
82
84
result = stringCase ( {
83
85
case : targetCase ,
0 commit comments