@@ -88,6 +88,10 @@ interface GenerateApiParams {
88
88
* extract request params to data contract (Also combine path params and query params into one object)
89
89
*/
90
90
extractRequestParams ?: boolean ;
91
+ /**
92
+ * extract request body type to data contract
93
+ */
94
+ extractRequestBody ?: boolean ;
91
95
/**
92
96
* prettier configuration
93
97
*/
@@ -131,14 +135,9 @@ export interface Hooks {
131
135
/** customize configuration object before sending it to ETA templates */
132
136
onPrepareConfig ?: < C extends GenerateApiConfiguration > ( currentConfiguration : C ) => C | void ;
133
137
/** customize route name as you need */
134
- onCreateRouteName ?: (
135
- routeNameInfo : RouteNameInfo ,
136
- rawRouteInfo : RawRouteInfo ,
137
- ) => RouteNameInfo | void ;
138
+ onCreateRouteName ?: ( routeNameInfo : RouteNameInfo , rawRouteInfo : RawRouteInfo ) => RouteNameInfo | void ;
138
139
/** customize request params (path params, query params) */
139
- onCreateRequestParams ?: (
140
- rawType : SchemaComponent [ "rawTypeData" ] ,
141
- ) => SchemaComponent [ "rawTypeData" ] | void ;
140
+ onCreateRequestParams ?: ( rawType : SchemaComponent [ "rawTypeData" ] ) => SchemaComponent [ "rawTypeData" ] | void ;
142
141
/** customize name of model type */
143
142
onFormatTypeName ?: ( typeName : string , rawTypeName ?: string ) => string | void ;
144
143
/** customize name of route (operationId), you can do it with using onCreateRouteName too */
@@ -215,14 +214,10 @@ export interface SchemaComponent {
215
214
discriminator ?: {
216
215
propertyName ?: string ;
217
216
} ;
218
- $parsed : ParsedSchema <
219
- SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent
220
- > ;
217
+ $parsed : ParsedSchema < SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent > ;
221
218
} ;
222
219
componentName : string ;
223
- typeData : ParsedSchema <
224
- SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent
225
- > | null ;
220
+ typeData : ParsedSchema < SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent > | null ;
226
221
}
227
222
228
223
export enum RequestContentKind {
@@ -346,25 +341,16 @@ export interface GenerateApiConfiguration {
346
341
formatDescription : ( description : string , inline ?: boolean ) => string ;
347
342
internalCase : ( value : string ) => string ;
348
343
classNameCase : ( value : string ) => string ;
349
- getInlineParseContent : (
350
- rawTypeData : SchemaComponent [ "rawTypeData" ] ,
351
- typeName ?: string ,
352
- ) => string ;
344
+ getInlineParseContent : ( rawTypeData : SchemaComponent [ "rawTypeData" ] , typeName ?: string ) => string ;
353
345
getParseContent : ( rawTypeData : SchemaComponent [ "rawTypeData" ] , typeName ?: string ) => ModelType ;
354
346
getComponentByRef : ( ref : string ) => SchemaComponent ;
355
347
parseSchema : (
356
348
rawSchema : string | SchemaComponent [ "rawTypeData" ] ,
357
349
typeName ?: string ,
358
350
formattersMap ?: Record < MAIN_SCHEMA_TYPES , ( content : ModelType ) => string > ,
359
351
) => ModelType ;
360
- formatters : Record <
361
- MAIN_SCHEMA_TYPES ,
362
- ( content : string | object | string [ ] | object [ ] ) => string
363
- > ;
364
- inlineExtraFormatters : Record <
365
- Exclude < MAIN_SCHEMA_TYPES , SCHEMA_TYPES . PRIMITIVE > ,
366
- ( schema : ModelType ) => string
367
- > ;
352
+ formatters : Record < MAIN_SCHEMA_TYPES , ( content : string | object | string [ ] | object [ ] ) => string > ;
353
+ inlineExtraFormatters : Record < Exclude < MAIN_SCHEMA_TYPES , SCHEMA_TYPES . PRIMITIVE > , ( schema : ModelType ) => string > ;
368
354
formatModelName : ( name : string ) => string ;
369
355
fmtToJSDocLine : ( line : string , params ?: { eol ?: boolean } ) => string ;
370
356
_ : import ( "lodash" ) . LoDashStatic ;
@@ -375,12 +361,7 @@ export interface GenerateApiConfiguration {
375
361
export interface GenerateApiOutput {
376
362
configuration : GenerateApiConfiguration ;
377
363
files : { name : string ; content : string ; declaration : { name : string ; content : string } | null } [ ] ;
378
- createFile : ( params : {
379
- path : string ;
380
- fileName : string ;
381
- content : string ;
382
- withPrefix ?: boolean ;
383
- } ) => void ;
364
+ createFile : ( params : { path : string ; fileName : string ; content : string ; withPrefix ?: boolean } ) => void ;
384
365
renderTemplate : (
385
366
templateContent : string ,
386
367
data : Record < string , unknown > ,
@@ -390,12 +371,6 @@ export interface GenerateApiOutput {
390
371
formatTSContent : ( content : string ) => string ;
391
372
}
392
373
393
- export declare function generateApi (
394
- params : Omit < GenerateApiParams , "url" | "spec" > ,
395
- ) : Promise < GenerateApiOutput > ;
396
- export declare function generateApi (
397
- params : Omit < GenerateApiParams , "input" | "spec" > ,
398
- ) : Promise < GenerateApiOutput > ;
399
- export declare function generateApi (
400
- params : Omit < GenerateApiParams , "input" | "url" > ,
401
- ) : Promise < GenerateApiOutput > ;
374
+ export declare function generateApi ( params : Omit < GenerateApiParams , "url" | "spec" > ) : Promise < GenerateApiOutput > ;
375
+ export declare function generateApi ( params : Omit < GenerateApiParams , "input" | "spec" > ) : Promise < GenerateApiOutput > ;
376
+ export declare function generateApi ( params : Omit < GenerateApiParams , "input" | "url" > ) : Promise < GenerateApiOutput > ;
0 commit comments