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
41
openapi-template/model_doc.mustache
Normal file
41
openapi-template/model_doc.mustache
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{{#models}}{{#model}}
|
||||
# {{classname}}
|
||||
|
||||
{{#description}}{{&description}}
|
||||
{{/description}}
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type
|
||||
------------ | -------------
|
||||
{{#vars}}`{{name}}` | {{#isPrimitiveType}}{{dataType}}{{/isPrimitiveType}}{{^isPrimitiveType}}[{{dataType}}]({{complexType}}.md){{/isPrimitiveType}}
|
||||
{{/vars}}
|
||||
|
||||
{{^withoutRuntimeChecks}}
|
||||
## Example
|
||||
|
||||
```typescript
|
||||
import type { {{classname}} } from '{{npmName}}'
|
||||
|
||||
// TODO: Update the object below with actual values
|
||||
const example = {
|
||||
{{#vars}}
|
||||
"{{name}}": {{{example}}},
|
||||
{{/vars}}
|
||||
} satisfies {{classname}}
|
||||
|
||||
console.log(example)
|
||||
|
||||
// Convert the instance to a JSON string
|
||||
const exampleJSON: string = JSON.stringify(example)
|
||||
console.log(exampleJSON)
|
||||
|
||||
// Parse the JSON string back to an object
|
||||
const exampleParsed = JSON.parse(exampleJSON) as {{classname}}
|
||||
console.log(exampleParsed)
|
||||
```
|
||||
{{/withoutRuntimeChecks}}
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
||||
|
||||
{{/model}}{{/models}}
|
||||
Loading…
Add table
Add a link
Reference in a new issue