to4ft uses the following default configuration if you do not provide a configuration file.
{
"keepAnnotationsFl": false,
"allowUnsafeKeywordsFl": false,
"caseNm": "go",
"oas2tb": {
"schemaPrefixTx": "",
"schemaSuffixTx": "Schema",
"typePrefixTx": "",
"typeSuffixTx": "",
"derefFl": false,
"importExtensionTx": "js",
"extensionTx": "ts",
"addDateFl": false
},
"oas2ro": {
"derefFl": false,
"prefixTx": "",
"suffixTx": "RouteOptions",
"importExtensionTx": "js",
"extensionTx": "ts",
"noAdditionalProperties": true
}
}-
keepAnnotationsFl-- If true, keep annotation-type keywords in the output. SeeannotationKeysinsrc/lib/consts.tsfor the list of annotation keywords. If you aren't generating API documentation from the server code, annotations add little value. -
allowUnsafeKeywordsFl-- If true, keep keywords AJV may not recognize. SeeajvUnsafeKeysinsrc/lib/consts.tsfor the list of unsafe keywords. If you enable AJV unsafe keywords, output may not be usable with AJV.
NOTE: to4ft always ignores keywords in stdIgnoreKeys (in src/lib/consts.ts) because they're handled by the code.
-
caseNm-- Identifies the casing style to use. Examples for each style are for the nameOpenAPIFieldNm.go-- Camel-like; preserves strings of consecutive capital letters, similar to names used in Go -OpenAPIFieldNmcamel-- Lower-first camel case -openApiFieldNmpascal-- Upper-first camel case -OpenApiFieldNm
-
oas2tb-- configuration specific tooas2tbschemaPrefixTxandschemaSuffixTx-- Text to add before and after (respectively) names for TypeBox schemas.typePrefixTxandTypeSuffixTx-- Text to add before and after (respectively) names for TypeBox types (Static<typeof Schema>).derefFl-- If true, generate dereferenced TypeBox schemas with sub-objects fully exploded in the schema.importExtensionTx-- The extension to use for import file names for referenced schemas -- NO DOT.- If you aren't using TypeScript's
rewriteRelativeImportExtensionsoption, you probably wantjs. - If you are using Node's type stripping you probably want 'ts' and
rewriteRelativeImportExtensionsif you plan to compile TypeScript to JavaScript.
- If you aren't using TypeScript's
extensionTx-- The extension to use for output file names -- NO DOT.- NOTE:
oas2tbis writing TypeBox, which assumes TypeScript, so extension should bets,mts, orcts.
- NOTE:
-
oas2ro-- configuration specific tooas2roderefFl-- If true, generate dereferencedRouteOptionsobjects with fully exploded schemas for any referenced objects.prefixTxandsuffixTx-- Text to add before and after (respectively) names forRouteOptionsobjects.importExtensionTx-- The extension to use for import file names -- NO DOT.- If you aren't using TypeScript's
rewriteRelativeImportExtensionsoption, you probably wantjs. - If you are using Node's type stripping you probably want 'ts' and
rewriteRelativeImportExtensionsif you plan to compile TypeScript to JavaScript.
- If you aren't using TypeScript's
extensionTx-- The extension to use for output file names -- NO DOT.RouteOptionsdo not include type annotations, so can be written asts,mts,cts,js,mjs, orcjs.
noAdditionalProperties-- if true, addsadditionalProperties: falseto querystring parameters.