@protocolnebula/ts-openapi-generator
Version:
Build API and models from Swagger/OpenAPI to use in any project type
79 lines (69 loc) • 1.6 kB
text/typescript
import { ModelBase } from '../../ApiBase/model-base.model';
{{
import { {{name}} } from './{{fileName}}';
{{/dependences}}
{{
/**
{{#description}}
* {{description}}
{{/description}}
{{#example}}
* @example {{example}}
{{/example}}
{{#deprecated}}
* @deprecated
{{/deprecated}}
*/
{{/hasComments}}
{{
export interface {{ name }}I {
{{
{{
{{
/**
{{#description}}
* {{description}}
{{/description}}
{{#example}}
* @example {{example}}
{{/example}}
{{#deprecated}}
* @deprecated
{{/deprecated}}
*/
{{/description}}
{{/hasComments}}
{{name}}{{
{{/attributes}}
}
export class {{ name }} extends ModelBase implements {{ name }}I {
protected readonly PARAMS_MAPPER = PARAMS_MAPPER;
{{
private _{{name}}: {{type}}{{
}}{{
}};
get {{name}}(): {{type}}{{
return this._{{name}};
}
set {{name}}(value: {{type}}{{
this._{{name}} = this.parseParam('{{name}}', value);
}
{{/attributes}}
constructor(params?: {{name}}I) {
super();
this.parse(params);
}
}
{{/model}}
const PARAMS_MAPPER = {
{{
{{
{{name}}: {
type: {{
type
}}{{
},
{{/attributes}}
{{/model}}
};