I'm experimenting with openapi-generator and its typescript-fetch generator implementation. Overall the generator is good, but in my honest opinion it does a bit too much.
I can configure the openapi-generator to generate only models, which would be my final goal. However, typescript-fetch generator insists generating serialization and deserialization helper functions which import some exists and map from ../runtime. But while only models are getting generated, the ../runtime is of course missing. In my case I totally don't need these (de)serializer helpers and I would like to omit them completely. I don't see any option currently to do so.
ExampleModel.ts
// This line does not compile in model-only mode
import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface ExampleModel
*/
export interface ExampleModel {
/**
*
* @type {number}
* @memberof ExampleModel
*/
someNumber?: number;
}
// These functions are useless for me and do only trouble
export function ExampleModelFromJSON(json: any): AuthenticateUserCommand {
return ExampleModelFromJSONTyped(json, false);
}
export function ExampleModelFromJSONTyped(json: any, ignoreDiscriminator: boolean): ExampleModel {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'someNumber': !exists(json, 'someNumber') ? undefined : json['someNumber'],
};
}
export function ExampleModelToJSON(value?: ExampleModel | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'someNumber': value.someNumber
};
}
Is there a way to generate a really minimalistic model (typescript interfaces)? Could I customize the mustache templates somehow in the scope of our project? Any help would be appreciated.