feat(openapi): Add modified typescript-fetch template
This template is modified from the original one, to handle multiple status-code handling of response. Don't ask me how they work, I don't quite understand them in depth...
This commit is contained in:
parent
b7c2a3dff9
commit
5dd6067c95
32 changed files with 2852 additions and 0 deletions
28
openapi-template/modelEnum.mustache
Normal file
28
openapi-template/modelEnum.mustache
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{{>modelEnumInterfaces}}
|
||||
|
||||
export function instanceOf{{classname}}(value: any): boolean {
|
||||
for (const key in {{classname}}) {
|
||||
if (Object.prototype.hasOwnProperty.call({{classname}}, key)) {
|
||||
if ({{classname}}[key as keyof typeof {{classname}}] === value) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function {{classname}}FromJSON(json: any): {{classname}} {
|
||||
return {{classname}}FromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boolean): {{classname}} {
|
||||
return json as {{classname}};
|
||||
}
|
||||
|
||||
export function {{classname}}ToJSON(value?: {{classname}} | null): any {
|
||||
return value as any;
|
||||
}
|
||||
|
||||
export function {{classname}}ToJSONTyped(value: any, ignoreDiscriminator: boolean): {{classname}} {
|
||||
return value as {{classname}};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue