ts-openapi-codegen 0.2.5-beta → 0.2.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 +10 -0
- package/README.md +45 -44
- package/bin/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.2.6] - 2022-09-18
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Example project
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- Fixed incorrect type of client
|
|
17
|
+
|
|
8
18
|
## [0.2.5-beta] - 2022-08-07
|
|
9
19
|
|
|
10
20
|
### Added
|
package/README.md
CHANGED
|
@@ -53,10 +53,10 @@ $ openapi --help
|
|
|
53
53
|
-V, --version Output the version number
|
|
54
54
|
-i, --input <value> OpenAPI specification, can be a path, url or string content (required)
|
|
55
55
|
-o, --output <value> Output directory (required)
|
|
56
|
-
-oc, --outputCore <value> Output directory for core files
|
|
57
|
-
-os, --outputServices <value> Output directory for services
|
|
58
|
-
-om, --outputModels <value> Output directory for models
|
|
59
|
-
-osm, --outputSchemas <value> Output directory for schemas
|
|
56
|
+
-oc, --outputCore <value> Output directory for core files
|
|
57
|
+
-os, --outputServices <value> Output directory for services
|
|
58
|
+
-om, --outputModels <value> Output directory for models
|
|
59
|
+
-osm, --outputSchemas <value> Output directory for schemas
|
|
60
60
|
-c, --client <value> HTTP client to generate [fetch, xhr, node] (default: "fetch")
|
|
61
61
|
--useOptions <value> Use options instead of arguments (default: false)
|
|
62
62
|
--useUnionTypes <value> Use union types instead of enums (default: false)
|
|
@@ -75,7 +75,8 @@ $ openapi --help
|
|
|
75
75
|
$ openapi --input ./spec.json --output ./dist --client xhr
|
|
76
76
|
```
|
|
77
77
|
### Second
|
|
78
|
-
|
|
78
|
+
[In package.json add new script](./example/package.json).
|
|
79
|
+
You should create a file in the root of a project with the name '[openapi.config.json](./example/openapi.config.json)', where you can describe configurations for several files with openapi specification.
|
|
79
80
|
## Example:
|
|
80
81
|
|
|
81
82
|
**openapi.config.json**
|
|
@@ -115,45 +116,45 @@ or with common block
|
|
|
115
116
|
}
|
|
116
117
|
```
|
|
117
118
|
|
|
118
|
-
| Name
|
|
119
|
-
|
|
120
|
-
|output |
|
|
121
|
-
|outputCore |
|
|
122
|
-
|outputServices |
|
|
123
|
-
|outputModels |
|
|
124
|
-
|outputSchemas |
|
|
125
|
-
|
|
|
126
|
-
|useOptions |
|
|
127
|
-
|useUnionTypes |
|
|
128
|
-
|exportCore |
|
|
129
|
-
|exportServices |
|
|
130
|
-
|exportModels |
|
|
131
|
-
|exportSchemas |
|
|
132
|
-
|clean |
|
|
133
|
-
|request |
|
|
134
|
-
|interfacePrefix |
|
|
135
|
-
|enumPrefix |
|
|
136
|
-
|typePrefix |
|
|
137
|
-
|items |
|
|
138
|
-
|
|
|
139
|
-
|
|
|
140
|
-
|
|
|
141
|
-
|
|
|
142
|
-
|
|
|
143
|
-
|
|
|
144
|
-
|
|
|
145
|
-
|
|
|
146
|
-
|
|
|
147
|
-
|
|
|
148
|
-
|
|
|
149
|
-
|
|
|
150
|
-
|
|
|
151
|
-
|
|
|
152
|
-
|
|
|
153
|
-
|
|
|
154
|
-
|
|
|
155
|
-
|
|
|
156
|
-
|
|
|
119
|
+
| Name | Item | type | Default | Description |
|
|
120
|
+
|-----------------|-----------------|-------------|----------|-----------------------------------------------------------|
|
|
121
|
+
| output | | string | |The relative location of the output directory |
|
|
122
|
+
| outputCore | | string | {output} |The relative location of the output directory for core |
|
|
123
|
+
| outputServices | | string | {output} |The relative location of the output directory for services |
|
|
124
|
+
| outputModels | | string | {output} |The relative location of the output directory for models |
|
|
125
|
+
| outputSchemas | | string | {output} |The relative location of the output directory for schemas |
|
|
126
|
+
| client | | string |'fetch' |The selected httpClient (fetch or XHR) |
|
|
127
|
+
| useOptions | | boolean |false |Use options or arguments functions |
|
|
128
|
+
| useUnionTypes | | boolean |false |Use union types instead of enums |
|
|
129
|
+
| exportCore | | boolean |true |Generate core client classes |
|
|
130
|
+
| exportServices | | boolean |true |Generate services |
|
|
131
|
+
| exportModels | | boolean |true |Generate models |
|
|
132
|
+
| exportSchemas | | boolean |false |Generate schemas |
|
|
133
|
+
| clean | | boolean |true |Clean a directory before generation |
|
|
134
|
+
| request | | string | |Path to custom request file |
|
|
135
|
+
| interfacePrefix | | string |'I' |Prefix for interface model |
|
|
136
|
+
| enumPrefix | | string |'E' |Prefix for enum model |
|
|
137
|
+
| typePrefix | | string |'T' |Prefix for type model |
|
|
138
|
+
| items | | array | | |
|
|
139
|
+
| | input | string | |The relative location of the OpenAPI spec |
|
|
140
|
+
| | output | string | | |
|
|
141
|
+
| | outputCore | string | | |
|
|
142
|
+
| | outputServices | string | | |
|
|
143
|
+
| | outputModels | string | | |
|
|
144
|
+
| | outputSchemas | string | | |
|
|
145
|
+
| | client | string |'fetch' |The selected httpClient (fetch or XHR) |
|
|
146
|
+
| | useOptions | boolean |false |Use options or arguments functions |
|
|
147
|
+
| | useUnionTypes | boolean |false |Use union types instead of enums |
|
|
148
|
+
| | exportCore | boolean |true |Generate core client classes |
|
|
149
|
+
| | exportServices | boolean |true |Generate services client classes |
|
|
150
|
+
| | exportModels | boolean |true |Generate models client classes |
|
|
151
|
+
| | exportSchemas | boolean |true |Generate schemas client classes |
|
|
152
|
+
| | clean | boolean |true |Clean a directory before generation |
|
|
153
|
+
| | request | string | |Path to custom request file |
|
|
154
|
+
| | write | boolean |true |Write the files to disk (true or false) |
|
|
155
|
+
| | interfacePrefix | string | |Prefix for interface model(I) |
|
|
156
|
+
| | enumPrefix | string | |Prefix for enum model(E) |
|
|
157
|
+
| | typePrefix | string | |Prefix for type model(T) |
|
|
157
158
|
|
|
158
159
|
## Example
|
|
159
160
|
|
package/bin/index.js
CHANGED
|
@@ -79,7 +79,7 @@ function prepareOptions(options, rootOptions) {
|
|
|
79
79
|
outputServices: option.outputServices ? option.outputServices : rootOptions ? rootOptions.outputServices : '',
|
|
80
80
|
outputModels: option.outputModels ? option.outputModels : rootOptions ? rootOptions.outputModels : '',
|
|
81
81
|
outputSchemas: option.outputSchemas ? option.outputSchemas : rootOptions ? rootOptions.outputSchemas : '',
|
|
82
|
-
httpClient: option.client ? option.client : rootOptions ? rootOptions.
|
|
82
|
+
httpClient: option.client ? option.client : rootOptions ? rootOptions.httpClient : '',
|
|
83
83
|
useOptions: isValidJson(option.useOptions) ? JSON.parse(option.useOptions) : rootOptions ? rootOptions.useOptions : false,
|
|
84
84
|
useUnionTypes: isValidJson(option.useUnionTypes) ? JSON.parse(option.useUnionTypes) : rootOptions ? rootOptions.useUnionTypes : false,
|
|
85
85
|
exportCore: isValidJson(option.exportCore) ? JSON.parse(option.exportCore) : rootOptions ? rootOptions.exportCore : false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-openapi-codegen",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Library that generates Typescript clients based on the OpenAPI specification. It bases on openapi-typescript-codegen",
|
|
5
5
|
"author": "Alexey Zverev",
|
|
6
6
|
"homepage": "https://github.com/ozonophore/openapi-codegen.git",
|