@dazhicheng/openapi 1.1.5 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @dazhicheng/openapi
2
2
 
3
+ ## 1.1.6
4
+
5
+ ### Patch Changes
6
+
7
+ - openapi添加参数返回所有类型,列设置弹框添加重置按钮
8
+
3
9
  ## 1.1.5
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dazhicheng/openapi",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "根据 Swagger/OpenAPI 文档自动生成 TypeScript 接口",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -1,44 +1,53 @@
1
- // @ts-ignore
2
- /* eslint-disable */
3
- {{ requestImportStatement }}
4
-
5
- {% for api in list -%}
6
- /** {{ api.desc if api.desc else '此处后端没有提供注释' }} {{api.method | upper}} {{ api.pathInComment | safe }} */
7
- export async function {{ api.functionName }}(
8
- {%- if api.body -%}
9
- params
10
- {%- if genType === "ts" -%}
11
- : {% if api.body.propertiesList %}{
12
- {%- for prop in api.body.propertiesList %}
13
- {% if prop.schema.description -%}
14
- /** {{ prop.schema.description }} */
15
- {% endif -%}
16
- {{ prop.key }}{{ "?" if not prop.schema.required }}: {{ prop.schema.type }},
17
- {%- endfor %}
18
- }
19
- {%- else -%}
20
- {{ api.body.type }}
21
- {%- endif -%}
22
- {%- if api.params and api.params.path and api.params.path.length -%}
23
- & {{namespace}}.{{api.typeName}}
24
- {%- endif -%}
25
- {%- endif -%}
26
- {%- elif api.params and api.hasParams -%}
27
- params
28
- {%- if genType === "ts" -%}
29
- : {{namespace}}.{{api.typeName}}
30
- {%- endif -%}
31
- {%- endif -%}
32
- ) {
33
- {%- if api.params and api.params.path and api.params.path.length %}
34
- const { {% for p in api.params.path %}{{ p.name }}{{ ", " if not loop.last }}{% endfor %} } = params;
35
- {%- endif %}
36
- return request.{{ "del" if api.method | lower == "delete" else api.method | lower }}{{ ("<" + api.response.type + ">") | safe if genType === "ts" }}({
37
- url: {{ "`" if api.path and "${" in api.path else "'" }}{{ api.path }}{{ "`" if api.path and "${" in api.path else "'" }},
38
- {%- if api.body or (api.params and api.hasParams) %}
39
- {{ "data" if api.method | lower == "delete" else "params" }}: params,
40
- {%- endif %}
41
- });
42
- }
43
-
44
- {% endfor -%}
1
+ // @ts-ignore
2
+ /* eslint-disable */
3
+ {{ requestImportStatement }}
4
+
5
+ {% for api in list -%}
6
+ /** {{ api.desc if api.desc else '此处后端没有提供注释' }} {{api.method | upper}} {{ api.pathInComment | safe }} */
7
+ export async function {{ api.functionName }}(
8
+ {%- if api.body -%}
9
+ params
10
+ {%- if genType === "ts" -%}
11
+ : {% if api.body.propertiesList %}{
12
+ {%- for prop in api.body.propertiesList %}
13
+ {% if prop.schema.description -%}
14
+ /** {{ prop.schema.description }} */
15
+ {% endif -%}
16
+ {{ prop.key }}{{ "?" if not prop.schema.required }}: {{ prop.schema.type }},
17
+ {%- endfor %}
18
+ }
19
+ {%- else -%}
20
+ {{ api.body.type }}
21
+ {%- endif -%}
22
+ {%- if api.params and api.params.path and api.params.path.length -%}
23
+ & {{namespace}}.{{api.typeName}}
24
+ {%- endif -%}
25
+ {%- endif -%}
26
+ {%- elif api.params and api.hasParams -%}
27
+ params
28
+ {%- if genType === "ts" -%}
29
+ : {{namespace}}.{{api.typeName}}
30
+ {%- endif -%}
31
+ {%- endif -%}
32
+ {%- if api.body or (api.params and api.hasParams) -%}
33
+ ,
34
+ {%- endif -%}
35
+ {%- if genType === "ts" -%}
36
+ options?: { [key: string]: any }
37
+ {%- else -%}
38
+ options
39
+ {%- endif -%}
40
+ ) {
41
+ {%- if api.params and api.params.path and api.params.path.length %}
42
+ const { {% for p in api.params.path %}{{ p.name }}{{ ", " if not loop.last }}{% endfor %} } = params;
43
+ {%- endif %}
44
+ return request.{{ "del" if api.method | lower == "delete" else api.method | lower }}{{ ("<" + api.response.type + ">") | safe if genType === "ts" }}({
45
+ url: {{ "`" if api.path and "${" in api.path else "'" }}{{ api.path }}{{ "`" if api.path and "${" in api.path else "'" }},
46
+ {%- if api.body or (api.params and api.hasParams) %}
47
+ {{ "data" if api.method | lower == "delete" else "params" }}: params,
48
+ {%- endif %}
49
+ ...(options ?? {}),
50
+ });
51
+ }
52
+
53
+ {% endfor -%}