@@ -10,17 +10,17 @@ import { transformAll } from "./transform/index.js";
10
10
import { makeApiPathsEnum } from "./transform/paths.js" ;
11
11
export * from "./types.js" ; // expose all types to consumers
12
12
13
- export const WARNING_MESSAGE = `/**
14
- * This file was auto-generated by openapi-typescript.
15
- * Do not make direct changes to the file.
16
- */
13
+ export const COMMENT_HEADER = `/**
14
+ * This file was auto-generated by openapi-typescript.
15
+ * Do not make direct changes to the file.
16
+ */
17
17
18
18
19
19
` ;
20
20
21
21
/**
22
22
* This function is the entry to the program and allows the user to pass in a remote schema and/or local schema.
23
- * The URL or schema and headers can be passed in either programtically and/or via the CLI.
23
+ * The URL or schema and headers can be passed in either programmatically and/or via the CLI.
24
24
* Remote schemas are fetched from a server that supplies JSON or YAML format via an HTTP GET request. File based schemas
25
25
* are loaded in via file path, most commonly prefixed with the file:// format. Alternatively, the user can pass in
26
26
* OpenAPI2 or OpenAPI3 schema objects that can be parsed directly by the function without reading the file system.
@@ -38,14 +38,15 @@ async function openapiTS(
38
38
const ctx : GlobalContext = {
39
39
additionalProperties : options . additionalProperties || false ,
40
40
auth : options . auth ,
41
+ commentHeader : typeof options . commentHeader === "string" ? options . commentHeader : COMMENT_HEADER ,
41
42
defaultNonNullable : options . defaultNonNullable || false ,
42
43
formatter : options && typeof options . formatter === "function" ? options . formatter : undefined ,
43
44
immutableTypes : options . immutableTypes || false ,
44
- rawSchema : options . rawSchema || false ,
45
45
makePathsEnum : options . makePathsEnum || false ,
46
- version : options . version || 3 ,
47
- supportArrayLength : options . supportArrayLength ,
48
46
pathParamsAsTypes : options . pathParamsAsTypes ,
47
+ rawSchema : options . rawSchema || false ,
48
+ supportArrayLength : options . supportArrayLength ,
49
+ version : options . version || 3 ,
49
50
} ;
50
51
51
52
// note: we may be loading many large schemas into memory at once; take care to reuse references without cloning
@@ -76,7 +77,7 @@ async function openapiTS(
76
77
}
77
78
78
79
// 2. generate raw output
79
- let output = WARNING_MESSAGE ;
80
+ let output = ctx . commentHeader ;
80
81
81
82
// 2a. root schema
82
83
if ( ! options ?. version && ! ctx . rawSchema ) ctx . version = swaggerVersion ( rootSchema as any ) ; // note: root version cascades down to all subschemas
0 commit comments