@ama-sdk/schematics 11.0.0-next.0 → 11.0.0-next.1

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.
Files changed (76) hide show
  1. package/README.md +219 -27
  2. package/migration.json +1 -1
  3. package/package.json +45 -35
  4. package/schematics/api-extension/index.d.ts +1 -1
  5. package/schematics/api-extension/index.d.ts.map +1 -1
  6. package/schematics/api-extension/index.js +9 -1
  7. package/schematics/api-extension/index.js.map +1 -1
  8. package/schematics/code-generator/code-generator.d.ts +3 -3
  9. package/schematics/code-generator/code-generator.d.ts.map +1 -1
  10. package/schematics/code-generator/code-generator.js +0 -12
  11. package/schematics/code-generator/code-generator.js.map +1 -1
  12. package/schematics/code-generator/open-api-cli-generator/open-api-cli.generator.d.ts.map +1 -1
  13. package/schematics/code-generator/open-api-cli-generator/open-api-cli.generator.js +9 -5
  14. package/schematics/code-generator/open-api-cli-generator/open-api-cli.generator.js.map +1 -1
  15. package/schematics/code-generator/open-api-cli-generator/open-api-cli.options.d.ts +18 -0
  16. package/schematics/code-generator/open-api-cli-generator/open-api-cli.options.d.ts.map +1 -1
  17. package/schematics/code-generator/open-api-cli-generator/open-api-cli.options.js +3 -1
  18. package/schematics/code-generator/open-api-cli-generator/open-api-cli.options.js.map +1 -1
  19. package/schematics/code-generator/swagger-java-generator/swagger-java.generator.js.map +1 -1
  20. package/schematics/helpers/read-package.d.ts.map +1 -1
  21. package/schematics/java/client-core/index.d.ts +1 -1
  22. package/schematics/java/client-core/index.d.ts.map +1 -1
  23. package/schematics/java/client-core/index.js +9 -1
  24. package/schematics/java/client-core/index.js.map +1 -1
  25. package/schematics/java/client-core/swagger-codegen-java-client/target/javaClient-swagger-codegen-tests.jar +0 -0
  26. package/schematics/java/client-core/swagger-codegen-java-client/target/javaClient-swagger-codegen.jar +0 -0
  27. package/schematics/ng-add/index.d.ts +1 -2
  28. package/schematics/ng-add/index.d.ts.map +1 -1
  29. package/schematics/ng-add/index.js +8 -2
  30. package/schematics/ng-add/index.js.map +1 -1
  31. package/schematics/ng-update/index.js.map +1 -1
  32. package/schematics/ng-update/typescript/index.d.ts +4 -0
  33. package/schematics/ng-update/typescript/index.d.ts.map +1 -1
  34. package/schematics/ng-update/typescript/index.js +12 -1
  35. package/schematics/ng-update/typescript/index.js.map +1 -1
  36. package/schematics/ng-update/typescript/v10.0/script-removal.d.ts.map +1 -1
  37. package/schematics/ng-update/typescript/v10.0/script-removal.js +1 -2
  38. package/schematics/ng-update/typescript/v10.0/script-removal.js.map +1 -1
  39. package/schematics/ng-update/typescript/v10.1/add-presets-renovate.d.ts +3 -0
  40. package/schematics/ng-update/typescript/v10.1/add-presets-renovate.d.ts.map +1 -0
  41. package/schematics/ng-update/typescript/v10.1/add-presets-renovate.js +26 -0
  42. package/schematics/ng-update/typescript/v10.1/add-presets-renovate.js.map +1 -0
  43. package/schematics/typescript/core/helpers/path-extractor.d.ts +9 -0
  44. package/schematics/typescript/core/helpers/path-extractor.d.ts.map +1 -0
  45. package/schematics/typescript/core/helpers/path-extractor.js +37 -0
  46. package/schematics/typescript/core/helpers/path-extractor.js.map +1 -0
  47. package/schematics/typescript/core/index.d.ts +7 -1
  48. package/schematics/typescript/core/index.d.ts.map +1 -1
  49. package/schematics/typescript/core/index.js +201 -94
  50. package/schematics/typescript/core/index.js.map +1 -1
  51. package/schematics/typescript/core/openapi-codegen-typescript/target/typescriptFetch-openapi-generator-tests.jar +0 -0
  52. package/schematics/typescript/core/openapi-codegen-typescript/target/typescriptFetch-openapi-generator.jar +0 -0
  53. package/schematics/typescript/core/schema.d.ts +18 -3
  54. package/schematics/typescript/core/schema.d.ts.map +1 -1
  55. package/schematics/typescript/core/schema.json +17 -5
  56. package/schematics/typescript/mock/index.d.ts +1 -1
  57. package/schematics/typescript/mock/index.d.ts.map +1 -1
  58. package/schematics/typescript/mock/index.js +9 -1
  59. package/schematics/typescript/mock/index.js.map +1 -1
  60. package/schematics/typescript/shell/index.d.ts +2 -1
  61. package/schematics/typescript/shell/index.d.ts.map +1 -1
  62. package/schematics/typescript/shell/index.js +15 -3
  63. package/schematics/typescript/shell/index.js.map +1 -1
  64. package/schematics/typescript/shell/schema.d.ts +3 -1
  65. package/schematics/typescript/shell/schema.d.ts.map +1 -1
  66. package/schematics/typescript/shell/schema.json +5 -1
  67. package/schematics/typescript/shell/templates/base/.renovaterc.json +6 -57
  68. package/schematics/typescript/shell/templates/base/.vscode/settings.json +6 -2
  69. package/schematics/typescript/shell/templates/base/{openapitools.json → openapitools.json.template} +8 -1
  70. package/schematics/typescript/shell/templates/base/package.json.template +17 -14
  71. package/schematics/typescript/shell/templates/base/readme.md +23 -23
  72. package/schematics/typescript/shell/templates/base/testing/tsconfig.spec.json +0 -1
  73. package/schematics/typescript/shell/templates/base/tsconfig.build.json +1 -19
  74. package/schematics/typescript/shell/templates/base/tsconfig.doc.json +2 -2
  75. package/schematics/typescript/shell/templates/base/.husky/commit-msg +0 -4
  76. package/schematics/typescript/shell/templates/base/.husky/pre-commit +0 -4
package/README.md CHANGED
@@ -1,10 +1,29 @@
1
1
  # SDK Generator
2
2
 
3
- This package provides `schematics` generators to create an SDK based on an API swagger spec.
3
+ [![Stable Version](https://img.shields.io/npm/v/@ama-sdk/schematics?style=for-the-badge)](https://www.npmjs.com/package/@ama-sdk/schematics)
4
+ [![Bundle Size](https://img.shields.io/bundlephobia/min/@ama-sdk/schematics?color=green&style=for-the-badge)](https://www.npmjs.com/package/@ama-sdk/schematics)
4
5
 
5
- ## Setup
6
+ This package provides `schematics` generators to create an SDK based on an OpenAPI specifications.
7
+ There are two SDK generators in the Otter Framework: Typescript and Java. The Java generator is currently in maintenance
8
+ mode and only the Typescript generator is actively supported and will see future evolutions.
6
9
 
7
- ### Create a new repository
10
+ - [Typescript SDK](#typescript-sdk)
11
+ - [Java SDK](#java-client-core-sdk)
12
+
13
+ ## Typescript SDK
14
+
15
+ The Typescript SDK generator is a custom template for the OpenAPITools generator with a full integration of the [@ama-sdk/core](https://www.npmjs.com/package/@ama-sdk/core) client capabilities.
16
+
17
+ It supports both Swagger 2+ and Open API 3 specifications.
18
+
19
+ - [Setup](#setup)
20
+ - [How to use](#how-to-use)
21
+ - [Debug](#debug)
22
+ - [Going further](#going-further)
23
+
24
+ ### Setup
25
+
26
+ #### Create a new repository
8
27
 
9
28
  Generate a new single SDK repository
10
29
 
@@ -18,9 +37,14 @@ or
18
37
  yarn create @ama-sdk typescript <project-name> [--spec-path=./path/to/spec.yaml]
19
38
  ```
20
39
 
21
- > **Note**: Get more information on the [@ama-sdk/create package](https://www.npmjs.com/package/@ama-sdk/create).
40
+ > [!WARNING]
41
+ > Please notice that the command `yarn create` is **not** available for versions *>= 2.0.0*
42
+ > (see [Yarn cli commands](https://yarnpkg.com/cli)).
43
+
44
+ > [!TIP]
45
+ > Get more information on the [@ama-sdk/create package](https://www.npmjs.com/package/@ama-sdk/create).
22
46
 
23
- ### Create a new Otter workspace package
47
+ #### Create a new Otter workspace package
24
48
 
25
49
  The Angular schematics package is required to use these generators:
26
50
 
@@ -38,56 +62,224 @@ npx -p @angular/cli ng add @ama-sdk/schematics
38
62
  npx -p @angular/cli ng add @ama-sdk/core
39
63
  ```
40
64
 
41
- ## How to use?
42
-
43
- ### Typescript SDK
65
+ ### How to use?
44
66
 
45
- The typescript generator provides 2 generators:
67
+ The typescript generator provides 3 generators:
46
68
 
47
69
  - **shell**: To generate the "shell" of an SDK package
48
- - **core**: To (re)generate the SDK based on a specified Swagger spec
70
+ - **core**: To (re)generate the SDK based on a specified OpenApi specification
49
71
  - **create**: To create a new SDK from scratch (i.e. chain **shell** and **core**)
50
72
 
51
- To generate the `shell` you can run:
73
+ You can generate the `shell` in an existing monorepo with the command:
52
74
 
53
75
  ```shell
54
- yarn schematics @ama-sdk/schematics:typescript-shell
76
+ #Monorepo with Otter:
77
+ yarn ng g sdk sdkName
78
+
79
+ # Monorepo without Otter;
80
+ yarn schematics @o3r/workspace:sdk sdkName
55
81
  ```
56
82
 
57
- If you use `Yarn2+`, you can use the following `scripts` in `package.json`:
83
+ or from scratch, with the NPM initializer:
58
84
 
59
- ```json
60
- "resolve": "node -e 'process.stdout.write(require.resolve(process.argv[1]));'",
61
- "generate": "yarn schematics @ama-sdk/schematics:typescript-core --spec-path ./swagger-spec.yaml",
62
- "upgrade:repository": "yarn schematics @ama-sdk/schematics:typescript-shell",
85
+ ```shell
86
+ npm create @ama-sdk typescript <project-name>
63
87
  ```
64
88
 
65
- Use `generate` to (re)generate your SDK based on the content of `./swagger-spec.yaml` (make sure you have this file at the root of your project) and `upgrade:repository` to regenerate the structure of your project.
89
+ The generated package comes with the following script in the package.json:
66
90
 
67
- ### Java Client Core SDK
91
+ ```json5
92
+ {
93
+ // ...
94
+ "generate": "yarn schematics @ama-sdk/schematics:typescript-core --spec-path ./openapi-spec.yaml",
95
+ "upgrade:repository": "yarn schematics @ama-sdk/schematics:typescript-shell"
96
+ }
97
+ ```
68
98
 
69
- Generate a Java Client Core SDK:
99
+ > [!NOTE]
100
+ > Use `generate` to (re)generate your SDK based on the content of `./openapi-spec.yaml` (make sure you have this file at the root of your project) and `upgrade:repository` to regenerate the structure of your project.
70
101
 
71
- Make sure to have a `./swagger-spec.yaml` file at the root of your project and run:
102
+ > [!TIP]
103
+ > The `--spec-path` parameter supports YAML and JSON file formats based on the file system path or remote URL.
104
+
105
+ If you use `Yarn2+` with PnP, you can modify the following `scripts` in `package.json` to generate the SDK based on specifications in a dependency package:
106
+
107
+ ```json5
108
+ {
109
+ // ...
110
+ "resolve": "node -e 'process.stdout.write(require.resolve(process.argv[1]));'",
111
+ "generate": "yarn schematics @ama-sdk/schematics:typescript-core --spec-path $(yarn resolve @my/dep/spec-file.yaml)",
112
+ }
113
+ ```
114
+
115
+ #### Light SDK
116
+
117
+ It is also possible to generate a "light" SDK. This type of SDK does not need to generate revivers, which results in a simplified version of the code and reduces the size of the bundle.
118
+
119
+ Please note that revivers are generated for SDKs that use:
120
+
121
+ - non-stringified dates
122
+ - dictionaries
123
+ - extensible models
124
+
125
+ ##### Dates
126
+
127
+ If your specification file includes dates, there are multiple options for the generation of your SDK involving the global property option `stringifyDate`:
128
+
129
+ - By default, the option `stringifyDate` is false so dates will be generated as either `utils.Date`, `utils.DateTime`, or `Date`.
130
+ For more information related to these types, check out this [documentation](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/schematics/schematics/typescript/shell/templates/base#manage-dates).
131
+ - To leave the handling of the timezone to the application and generate the dates as `string` types, the option `stringifyDate` can be set to true. <br>
132
+ This can be done by adding `--global-property stringifyDate` to the generator command.
133
+ - If an existing SDK contains stringified dates that need to be reverted to their expected formats, you can regenerate the SDK by removing the `stringifyDate` option from the global properties (since it is false by default).
134
+
135
+ Example to stringify dates:
72
136
 
73
137
  ```shell
74
- yarn schematics @ama-sdk/schematics:java-client-core --spec-path ./swagger-spec.yaml --swagger-config-path ./swagger-codegen-config.json
138
+ yarn schematics @ama-sdk/schematics:typescript-core --spec-path ./swagger-spec.yaml --global-property stringifyDate
75
139
  ```
76
140
 
77
- [Default swagger config](schematics/java/client-core/swagger-codegen-java-client/config/swagger-codegen-config.json) will be used if `--swagger-config-path` is not provided.
141
+ ##### Extensible models
142
+
143
+ You may be in a case in which you want to be able to extend your SDK models and therefore ensure that revivers are generated
144
+ (more info on how to extend a model [here](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/schematics/schematics/typescript/shell/templates/base#how-to-extend-a-model)).
145
+ To do this, you can use the global property option `allowModelExtension` by adding `--global-property allowModelExtension` to the generator command.
146
+
147
+ Example:
148
+
149
+ ```shell
150
+ yarn schematics @ama-sdk/schematics:typescript-core --spec-path ./swagger-spec.yaml --global-property allowModelExtension
151
+ ```
152
+
153
+ #### Generator Configuration
154
+
155
+ ##### Parameters
156
+
157
+ It is possible to configure the SDK code generation by passing parameters to the generator command line to override the default configuration values.
158
+ The available parameters are:
159
+
160
+ - `--spec-path`: Path to the swagger specification used to generate the SDK
161
+ - `--spec-config-path`: Path to the spec generation configuration
162
+ - `--global-property`: Comma separated string of options to give to the openapi-generator-cli
163
+ - `--output-path`: Output path for the generated SDK
164
+ - `--generator-custom-path`: Path to a custom generator
165
+
166
+ Also, another parameter is available called OpenAPI Normalizer which transforms the input OpenAPI specification (which may not perfectly conform) to make it workable
167
+ with OpenAPI Generator. There are several rules that are supported which can be found [here](https://openapi-generator.tech/docs/customization/#openapi-normalizer).
168
+
169
+ This parameter can be passed with `--openapi-normalizer` followed by the rules to be enabled in OpenAPI normalizer in the form of `RULE_1=true,RULE_2=original`.
170
+
171
+ Example: `--openapi-normalizer REFACTOR_ALLOF_WITH_PROPERTIES_ONLY=true`
172
+
173
+ #### openapitools.json
174
+
175
+ There is also a possibility to configure the SDK code generation in `openapitools.json`. The structure for this file looks something like this:
176
+
177
+ ```json5
178
+ {
179
+ "$schema": "https://raw.githubusercontent.com/OpenAPITools/openapi-generator-cli/master/apps/generator-cli/src/config.schema.json",
180
+ "generator-cli": {
181
+ "version": "0.0.0",
182
+ "storageDir": ".openapi-generator",
183
+ "generators": { // optional
184
+ "example-sdk": { // any name you like (can be referenced using --generator-key)
185
+ "generatorName": "typescriptFetch",
186
+ "output": ".",
187
+ "inputSpec": "./swagger-spec.yaml" // supports YAML and JSON formats, based on the file system path or remote URL
188
+ }
189
+ }
190
+ }
191
+ }
192
+ ```
193
+
194
+ `example-sdk` corresponds to the key of the generator which can be referenced in the generator command as a parameter, for example:
195
+
196
+ ```shell
197
+ yarn schematics @ama-sdk/schematics:typescript-core --generator-key example-sdk
198
+ ```
199
+
200
+ The properties `generatorName`, `output`, and `inputSpec` are required and additional properties can be added (available properties described in the schema
201
+ [here](https://github.com/OpenAPITools/openapi-generator-cli/blob/master/apps/generator-cli/src/config.schema.json)). For example, we can add the previously
202
+ described global properties `stringifyDate` and `allowModelExtension`:
203
+
204
+ ```json5
205
+ {
206
+ "$schema": "https://raw.githubusercontent.com/OpenAPITools/openapi-generator-cli/master/apps/generator-cli/src/config.schema.json",
207
+ "generator-cli": {
208
+ "version": "0.0.0",
209
+ "storageDir": ".openapi-generator",
210
+ "generators": {
211
+ "example-sdk": {
212
+ "generatorName": "typescriptFetch",
213
+ "output": ".",
214
+ "inputSpec": "./openapi-spec.yaml", // or "./openapi-spec.json" according to the specification format
215
+ "globalProperty": {
216
+ "stringifyDate": true,
217
+ "allowModelExtension": true
218
+ }
219
+ }
220
+ }
221
+ }
222
+ }
223
+ ```
224
+
225
+ We have added the possibility in the generator command to both specify the generator key and override specific properties of said key.
226
+ For example, if we want to use the properties of `example-sdk` from `openapitools.json` but override the global properties we can do so like this:
227
+
228
+ ```shell
229
+ yarn schematics @ama-sdk/schematics:typescript-core --generator-key example-sdk --global-property stringifyDate=false
230
+ ```
231
+
232
+ > [!CAUTION]
233
+ > If the parameter `--generator-key` is provided in combination with other parameters to be overridden, the limitation is that not all
234
+ > properties from `openapitools.json` will be taken into account (contrary to the case when there is only the `--generator-key` parameter).
235
+ > As of now, the only properties that will be taken into account are `output`, `inputSpec`, `config`, `globalProperty` which can be
236
+ > overridden with the parameters `--output-path`, `--spec-path`, `--spec-config-path`, and `--global-property`.
237
+
238
+ > [!NOTE]
239
+ > The parameters `--generator-custom-path` and `--openapi-normalizer` are not impacted and will always be taken into account if provided.
240
+
241
+ > [!NOTE]
242
+ > The values provided by the parameter `--global-property` will actually be merged with the values of `globalProperty` from
243
+ > `openapitools.json` (rather than override them like the other properties).
244
+
245
+ ### Debug
78
246
 
79
- ### Debug the typescript generator
80
247
  The OpenApi generator extracts an enhanced JSON data model from the specification YAML and uses this data model to feed the templates to generate the code.
81
248
  If there is an issue with the files generated with the spec provided, the generator provides debugging features that log this data model.
82
249
 
83
250
  You can use global property options to pass one or both of the following options:
84
- * debugModel - logs the full JSON structure used to generate models
85
- * debugOperations - logs the full JSON structure used to generate operations
251
+
252
+ - debugModels - logs the full JSON structure used to generate models
253
+ - debugOperations - logs the full JSON structure used to generate operations
86
254
 
87
255
  Example:
256
+
88
257
  ```shell
89
- yarn schematics @ama-sdk/schematics:typescript-core --spec-path ./swagger-spec.yaml --global-property debugModels,debugOperations
258
+ yarn schematics @ama-sdk/schematics:typescript-core --spec-path ./openapi-spec.yaml --global-property debugModels,debugOperations
90
259
  ```
260
+
91
261
  You can also use npx instead of yarn in the command.
92
262
 
93
263
  You can correlate this data model with the [templates](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/schematics/schematics/typescript/core/openapi-codegen-typescript/src/main/resources/typescriptFetch) used by the generator.
264
+
265
+ ### Going further
266
+
267
+ For more information on the generated SDK and how the framework supports different feature such as the Composition, you can refer to the dedicated SDK documentation:
268
+
269
+ - [Generated SDK hierarchy and extension](https://github.com/AmadeusITGroup/otter/blob/main/docs/api-sdk/SDK_MODELS_HIERARCHY.md)
270
+ - [Composition and Inheritance support](https://github.com/AmadeusITGroup/otter/blob/main/docs/api-sdk/COMPOSITION_INHERITANCE.md)
271
+
272
+ ## Java Client Core SDK
273
+
274
+ > [!WARNING]
275
+ > This feature is on maintenance mode and will see no future evolution
276
+
277
+ Generate a Java Client Core SDK:
278
+
279
+ Make sure to have a `./swagger-spec.yaml` file at the root of your project and run:
280
+
281
+ ```shell
282
+ yarn schematics @ama-sdk/schematics:java-client-core --spec-path ./swagger-spec.yaml --swagger-config-path ./swagger-codegen-config.json
283
+ ```
284
+
285
+ [Default swagger config](schematics/java/client-core/swagger-codegen-java-client/config/swagger-codegen-config.json) will be used if `--swagger-config-path` is not provided.
package/migration.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "schematics": {
4
4
  "migration-v10_0": {
5
5
  "version": "10.0.0-alpha.0",
6
- "description": "Updates of the Otter Library to v10.0.*",
6
+ "description": "Updates of @ama-sdk/schematics to v10.0.*",
7
7
  "factory": "./schematics/ng-update/index#updateV10_0"
8
8
  }
9
9
  }
package/package.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "name": "@ama-sdk/schematics",
3
- "version": "11.0.0-next.0",
3
+ "version": "11.0.0-next.1",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
4
7
  "description": "Swagger specification SDK Generator by schematics",
5
8
  "typings": "./src/public_api.d.ts",
6
9
  "scripts": {
@@ -34,6 +37,9 @@
34
37
  "@angular-devkit/schematics-cli": {
35
38
  "optional": true
36
39
  },
40
+ "@angular/cli": {
41
+ "optional": true
42
+ },
37
43
  "@angular/compiler": {
38
44
  "optional": true
39
45
  },
@@ -42,68 +48,72 @@
42
48
  }
43
49
  },
44
50
  "peerDependencies": {
45
- "@ama-sdk/core": "^11.0.0-next.0",
46
- "@angular-devkit/core": "~17.0.0",
47
- "@angular-devkit/schematics": "~17.0.0",
51
+ "@ama-sdk/core": "^11.0.0-next.1",
52
+ "@angular-devkit/core": "~17.3.0",
53
+ "@angular-devkit/schematics": "~17.3.0",
48
54
  "@angular-devkit/schematics-cli": "^17.0.1",
49
- "@openapitools/openapi-generator-cli": "~2.7.0",
50
- "@schematics/angular": "~17.0.0"
55
+ "@angular/cli": "^17.0.1",
56
+ "@o3r/schematics": "^11.0.0-next.1",
57
+ "@openapitools/openapi-generator-cli": "~2.13.0",
58
+ "@schematics/angular": "~17.3.0"
51
59
  },
52
60
  "dependencies": {
53
- "@angular-devkit/core": "~17.0.3",
54
- "@angular-devkit/schematics": "~17.0.3",
61
+ "@angular-devkit/core": "~17.3.0",
62
+ "@angular-devkit/schematics": "~17.3.0",
55
63
  "js-yaml": "^4.1.0",
56
64
  "minimatch": "~9.0.3",
57
65
  "rxjs": "^7.8.1",
58
66
  "semver": "^7.5.2",
59
- "sway": "^2.0.6",
60
- "tslib": "^2.5.3"
67
+ "tslib": "^2.6.2"
61
68
  },
62
69
  "devDependencies": {
63
- "@ama-sdk/core": "^11.0.0-next.0",
64
- "@angular-devkit/schematics-cli": "~17.0.3",
65
- "@angular-eslint/eslint-plugin": "~17.1.0",
66
- "@angular/cli": "~17.0.3",
67
- "@nx/eslint-plugin": "~17.1.1",
68
- "@nx/jest": "~17.1.1",
69
- "@o3r/build-helpers": "^11.0.0-next.0",
70
- "@o3r/eslint-plugin": "^11.0.0-next.0",
71
- "@o3r/schematics": "^11.0.0-next.0",
72
- "@openapitools/openapi-generator-cli": "~2.7.0",
73
- "@schematics/angular": "~17.0.3",
70
+ "@ama-sdk/core": "^11.0.0-next.1",
71
+ "@angular-devkit/schematics-cli": "~17.3.0",
72
+ "@angular-eslint/eslint-plugin": "~17.3.0",
73
+ "@angular/cli": "~17.3.0",
74
+ "@nx/eslint-plugin": "~18.3.0",
75
+ "@nx/jest": "~18.3.0",
76
+ "@o3r/build-helpers": "^11.0.0-next.1",
77
+ "@o3r/eslint-plugin": "^11.0.0-next.1",
78
+ "@o3r/schematics": "^11.0.0-next.1",
79
+ "@o3r/test-helpers": "^11.0.0-next.1",
80
+ "@openapitools/openapi-generator-cli": "~2.13.0",
81
+ "@schematics/angular": "~17.3.0",
82
+ "@stylistic/eslint-plugin-ts": "^1.5.4",
74
83
  "@types/jest": "~29.5.2",
75
84
  "@types/js-yaml": "^4.0.5",
76
85
  "@types/minimatch": "^5.1.2",
77
86
  "@types/node": "^20.0.0",
78
87
  "@types/pid-from-port": "^1.1.0",
79
88
  "@types/semver": "^7.3.13",
80
- "@typescript-eslint/eslint-plugin": "6.11.0",
81
- "@typescript-eslint/parser": "^6.11.0",
89
+ "@typescript-eslint/eslint-plugin": "^7.2.0",
90
+ "@typescript-eslint/parser": "^7.2.0",
82
91
  "copyfiles": "^2.4.1",
83
- "cpy": "~11.0.0",
84
92
  "cpy-cli": "^5.0.0",
85
- "eslint": "^8.42.0",
86
- "eslint-import-resolver-node": "^0.3.4",
87
- "eslint-plugin-jest": "~27.6.0",
88
- "eslint-plugin-jsdoc": "~48.0.0",
93
+ "eslint": "^8.57.0",
94
+ "eslint-import-resolver-node": "^0.3.9",
95
+ "eslint-plugin-jest": "~27.9.0",
96
+ "eslint-plugin-jsdoc": "~48.2.1",
89
97
  "eslint-plugin-prefer-arrow": "~1.2.3",
90
- "eslint-plugin-unicorn": "^50.0.0",
98
+ "eslint-plugin-unicorn": "^51.0.1",
91
99
  "globby": "^11.1.0",
92
100
  "isomorphic-fetch": "~3.0.0",
93
101
  "jest": "~29.7.0",
94
102
  "jest-junit": "~16.0.0",
95
103
  "jsonc-eslint-parser": "~2.4.0",
96
104
  "mem-fs": "^4.0.0",
97
- "npm-run-all": "^4.1.5",
98
- "nx": "~17.1.1",
105
+ "npm-run-all2": "^6.0.0",
106
+ "nx": "~18.3.0",
99
107
  "onchange": "^7.0.2",
108
+ "openapi-types": "^12.0.0",
100
109
  "pid-from-port": "^1.1.3",
101
110
  "semver": "^7.5.2",
102
- "ts-jest": "~29.1.1",
103
- "type-fest": "^4.3.1",
104
- "typescript": "~5.2.2"
111
+ "ts-jest": "~29.1.2",
112
+ "ts-node": "~10.9.2",
113
+ "type-fest": "^4.10.2",
114
+ "typescript": "~5.4.2"
105
115
  },
106
- "openApiSupportedVersion": "~6.6.0",
116
+ "openApiSupportedVersion": "~7.4.0",
107
117
  "engines": {
108
118
  "node": ">=18.0.0"
109
119
  },
@@ -4,5 +4,5 @@ import { NgGenerateApiExtensionSchematicsSchema } from './schema';
4
4
  * Generate a Extension of a API core definition
5
5
  * @param options
6
6
  */
7
- export declare function ngGenerateApiExtension(options: NgGenerateApiExtensionSchematicsSchema): Rule;
7
+ export declare const ngGenerateApiExtension: (options: NgGenerateApiExtensionSchematicsSchema) => () => Promise<Rule>;
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/api-extension/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,IAAI,EAGL,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,sCAAsC,EAAE,MAAM,UAAU,CAAC;AAElE;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,sCAAsC,GAAG,IAAI,CAW5F"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/api-extension/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,IAAI,EAGL,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,sCAAsC,EAAE,MAAM,UAAU,CAAC;AAmBlE;;;GAGG;AACH,eAAO,MAAM,sBAAsB,YAAa,sCAAsC,wBAGrF,CAAC"}
@@ -6,7 +6,7 @@ const schematics_1 = require("@angular-devkit/schematics");
6
6
  * Generate a Extension of a API core definition
7
7
  * @param options
8
8
  */
9
- function ngGenerateApiExtension(options) {
9
+ function ngGenerateApiExtensionFn(options) {
10
10
  return (tree) => (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./templates'), [
11
11
  (0, schematics_1.template)({
12
12
  ...options,
@@ -16,5 +16,13 @@ function ngGenerateApiExtension(options) {
16
16
  (0, schematics_1.renameTemplateFiles)()
17
17
  ]), schematics_1.MergeStrategy.Overwrite);
18
18
  }
19
+ /**
20
+ * Generate a Extension of a API core definition
21
+ * @param options
22
+ */
23
+ const ngGenerateApiExtension = (options) => async () => {
24
+ const { createSchematicWithMetricsIfInstalled } = await Promise.resolve().then(() => require('@o3r/schematics'));
25
+ return createSchematicWithMetricsIfInstalled(ngGenerateApiExtensionFn)(options);
26
+ };
19
27
  exports.ngGenerateApiExtension = ngGenerateApiExtension;
20
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/api-extension/index.ts"],"names":[],"mappings":";;;AAAA,2DASoC;AAGpC;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,OAA+C;IAEpF,OAAO,CAAC,IAAU,EAAE,EAAE,CAAC,IAAA,sBAAS,EAAC,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,aAAa,CAAC,EAAE;QACzD,IAAA,qBAAQ,EAAC;YACP,GAAG,OAAO;YACV,KAAK,EAAE,EAAE;SACV,CAAC;QACF,IAAA,iBAAI,EAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QACpB,IAAA,gCAAmB,GAAE;KACtB,CAAC,EAAE,0BAAa,CAAC,SAAS,CAAC,CAAC;AAE/B,CAAC;AAXD,wDAWC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/api-extension/index.ts"],"names":[],"mappings":";;;AAAA,2DASoC;AAGpC;;;GAGG;AACH,SAAS,wBAAwB,CAAC,OAA+C;IAE/E,OAAO,CAAC,IAAU,EAAE,EAAE,CAAC,IAAA,sBAAS,EAAC,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,aAAa,CAAC,EAAE;QACzD,IAAA,qBAAQ,EAAC;YACP,GAAG,OAAO;YACV,KAAK,EAAE,EAAE;SACV,CAAC;QACF,IAAA,iBAAI,EAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QACpB,IAAA,gCAAmB,GAAE;KACtB,CAAC,EAAE,0BAAa,CAAC,SAAS,CAAC,CAAC;AAE/B,CAAC;AAED;;;GAGG;AACI,MAAM,sBAAsB,GAAG,CAAC,OAA+C,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE;IACpG,MAAM,EAAE,qCAAqC,EAAE,GAAG,2CAAa,iBAAiB,EAAC,CAAC;IAClF,OAAO,qCAAqC,CAAC,wBAAwB,CAAC,CAAC,OAAO,CAAC,CAAC;AAClF,CAAC,CAAC;AAHW,QAAA,sBAAsB,0BAGjC"}
@@ -24,11 +24,11 @@ export type CodegenTaskOptions = {
24
24
  * As is, the CodeGenerator does not implement any actual code generation and needs to be extended to be functional
25
25
  * @see {@link OpenApiCliGenerator}
26
26
  */
27
- export declare class CodeGenerator<T extends CodegenTaskOptions> {
27
+ export declare abstract class CodeGenerator<T extends CodegenTaskOptions> {
28
28
  /**
29
29
  * Refers to the name the {@link Task} will be identified in a {@link Rule} ${@link SchematicContext}
30
30
  */
31
- protected generatorName: string;
31
+ protected abstract generatorName: string;
32
32
  /**
33
33
  * Configure the code generation task
34
34
  * Merge the generator's default options with the dynamic one provided by the schematics
@@ -44,7 +44,7 @@ export declare class CodeGenerator<T extends CodegenTaskOptions> {
44
44
  /**
45
45
  * Returns the generator specific default options
46
46
  */
47
- protected getDefaultOptions(): T;
47
+ protected abstract getDefaultOptions(): T;
48
48
  /**
49
49
  * Returns the schematic that will run the code generator
50
50
  * @param _factoryOptions execution options (root directory for instance)
@@ -1 +1 @@
1
- {"version":3,"file":"code-generator.d.ts","sourceRoot":"","sources":["../../../schematics/code-generator/code-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0E,YAAY,EAAQ,MAAM,4BAA4B,CAAC;AAGxI;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,qBAAa,aAAa,CAAC,CAAC,SAAS,kBAAkB;IACrD;;OAEG;IACH,SAAS,CAAC,aAAa,SAAM;IAE7B;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAa5B;;;;OAIG;IACH,OAAO,CAAC,yBAAyB;IAcjC;;OAEG;IACH,SAAS,CAAC,iBAAiB,IAAI,CAAC;IAIhC;;;;OAIG;IACH,SAAS,CAAC,uBAAuB,CAAC,eAAe,GAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,YAAY,CAAC,CAAC,CAAC;IAMpG;;;;;OAKG;IACI,wBAAwB,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,cAAc,GAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAO;CAU9G"}
1
+ {"version":3,"file":"code-generator.d.ts","sourceRoot":"","sources":["../../../schematics/code-generator/code-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0E,YAAY,EAAQ,MAAM,4BAA4B,CAAC;AAGxI;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,8BAAsB,aAAa,CAAC,CAAC,SAAS,kBAAkB;IAC9D;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAEzC;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAa5B;;;;OAIG;IACH,OAAO,CAAC,yBAAyB;IAcjC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,iBAAiB,IAAI,CAAC;IAEzC;;;;OAIG;IACH,SAAS,CAAC,uBAAuB,CAAC,eAAe,GAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,YAAY,CAAC,CAAC,CAAC;IAMpG;;;;;OAKG;IACI,wBAAwB,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,cAAc,GAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAO;CAU9G"}
@@ -10,12 +10,6 @@ const schematics_1 = require("@angular-devkit/schematics");
10
10
  * @see {@link OpenApiCliGenerator}
11
11
  */
12
12
  class CodeGenerator {
13
- constructor() {
14
- /**
15
- * Refers to the name the {@link Task} will be identified in a {@link Rule} ${@link SchematicContext}
16
- */
17
- this.generatorName = '';
18
- }
19
13
  /**
20
14
  * Configure the code generation task
21
15
  * Merge the generator's default options with the dynamic one provided by the schematics
@@ -50,12 +44,6 @@ class CodeGenerator {
50
44
  return tree;
51
45
  };
52
46
  }
53
- /**
54
- * Returns the generator specific default options
55
- */
56
- getDefaultOptions() {
57
- throw new Error('No implementation, please target an implementation');
58
- }
59
47
  /**
60
48
  * Returns the schematic that will run the code generator
61
49
  * @param _factoryOptions execution options (root directory for instance)
@@ -1 +1 @@
1
- {"version":3,"file":"code-generator.js","sourceRoot":"","sources":["../../../schematics/code-generator/code-gener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,MAAM,YAAY,GAAG,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;YAC7D,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,CAAC,CAAC;YAC7D,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;QACF,OAAO,IAAA,kBAAK,EAAC;YACX,IAAI,CAAC,yBAAyB,CAAC,cAAc,CAAC;YAC9C,YAAY;SACb,CAAC,CAAC;IACL,CAAC;CACF;AA7ED,sCA6EC"}
1
+ {"version":3,"file":"code-generator.js","sourceRoot":"","sources":["../../../schematics/code-generator/code-generator.ts"],"names":[],"mappings":";;;AAAA,2DAAwI;AAsBxI;;;;;;GAMG;AACH,MAAsB,aAAa;IAMjC;;;;OAIG;IACK,oBAAoB,CAAC,OAAmB;QAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC;QAChC,MAAM,IAAI,GAAM,EAAC,GAAG,IAAI,CAAC,iBAAiB,EAAE,EAAE,GAAG,OAAO,EAAC,CAAC;QAC1D,OAAO,IAAI,CAAC;YACH,eAAe;gBACpB,OAAO;oBACL,IAAI;oBACJ,OAAO,EAAE,IAAI;iBACd,CAAC;YACJ,CAAC;SACF,CAAC,EAAE,CAAC;IACP,CAAC;IAED;;;;OAIG;IACK,yBAAyB,CAAC,cAA0C;QAC1E,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;YAC/C,2EAA2E;YAC3E,gDAAgD;YAChD,MAAM,IAAI,GAAI,OAAO,CAAC,MAAc,CAAC,KAA8B,CAAC;YACpE,IAAI,CAAC,oBAAoB,CAAI;gBAC3B,IAAI,EAAE,IAAI,CAAC,aAAa;gBACxB,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,uBAAuB,CAAC,cAAc,CAAiB,CAAC;aAC5F,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;IACJ,CAAC;IAOD;;;;OAIG;IACO,uBAAuB,CAAC,kBAA8C,EAAE;QAChF,OAAO,CAAC,QAAY,EAAE,EAAE;YACtB,OAAO,OAAO,CAAC,MAAM,CAAC,oDAAoD,CAAC,CAAC;QAC9E,CAAC,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACI,wBAAwB,CAAC,gBAA4B,EAAE,iBAA6C,EAAE;QAC3G,MAAM,YAAY,GAAG,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;YAC7D,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,CAAC,CAAC;YAC7D,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;QACF,OAAO,IAAA,kBAAK,EAAC;YACX,IAAI,CAAC,yBAAyB,CAAC,cAAc,CAAC;YAC9C,YAAY;SACb,CAAC,CAAC;IACL,CAAC;CACF;AA3ED,sCA2EC"}
@@ -1 +1 @@
1
- {"version":3,"file":"open-api-cli.generator.d.ts","sourceRoot":"","sources":["../../../../schematics/code-generator/open-api-cli-generator/open-api-cli.generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAoC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AAI5F;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,aAAa,CAAC,iBAAiB,CAAC;IAEvE,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,KAAK,GAAG,MAAM,CAAC;IAClD,SAAS,KAAK,oBAAoB,IAAI,KAAK,GAAG,MAAM,CAEnD;IAED,kBAAkB;IAClB,SAAS,CAAC,QAAQ,CAAC,aAAa,6BAA6B;gBAEjD,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,EAAE,CAAA;KAAE;IAK9D;;;;OAIG;IACH,OAAO,CAAC,0BAA0B;IAelC;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAuBpB,kBAAkB;IAClB,SAAS,CAAC,iBAAiB,0BAA2C;IAEtE,kBAAkB;IAClB,SAAS,CAAC,uBAAuB,oBAAoB;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,yBAI5C,iBAAiB,wBAclD;CACH"}
1
+ {"version":3,"file":"open-api-cli.generator.d.ts","sourceRoot":"","sources":["../../../../schematics/code-generator/open-api-cli-generator/open-api-cli.generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAoC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AAI5F;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,aAAa,CAAC,iBAAiB,CAAC;IAEvE,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,KAAK,GAAG,MAAM,CAAC;IAClD,SAAS,KAAK,oBAAoB,IAAI,KAAK,GAAG,MAAM,CAEnD;IAED,kBAAkB;IAClB,SAAS,CAAC,QAAQ,CAAC,aAAa,6BAA6B;gBAEjD,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,EAAE,CAAA;KAAE;IAK9D;;;;OAIG;IACH,OAAO,CAAC,0BAA0B;IAelC;;;;OAIG;IACH,OAAO,CAAC,YAAY;IA2BpB,kBAAkB;IAClB,SAAS,CAAC,iBAAiB,0BAA2C;IAEtE,kBAAkB;IAClB,SAAS,CAAC,uBAAuB,oBAAoB;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,yBAI5C,iBAAiB,wBAclD;CACH"}
@@ -68,11 +68,15 @@ class OpenApiCliGenerator extends code_generator_1.CodeGenerator {
68
68
  'openapi-generator-cli',
69
69
  'generate',
70
70
  generatorOptions.generatorCustomPath ? `--custom-generator=${generatorOptions.generatorCustomPath}` : '',
71
- '-g', generatorOptions.generatorName,
72
- '-i', generatorOptions.specPath,
73
- ...generatorOptions.specConfigPath ? ['-c', generatorOptions.specConfigPath] : [],
74
- '-o', generatorOptions.outputPath,
75
- ...generatorOptions.globalProperty ? ['--global-property', generatorOptions.globalProperty] : []
71
+ ...generatorOptions.openapiNormalizer ? ['--openapi-normalizer', generatorOptions.openapiNormalizer] : [],
72
+ ...generatorOptions.generatorKey ? ['--generator-key', generatorOptions.generatorKey] :
73
+ [
74
+ '-g', generatorOptions.generatorName,
75
+ '-i', generatorOptions.specPath,
76
+ ...generatorOptions.specConfigPath ? ['-c', generatorOptions.specConfigPath] : [],
77
+ '-o', generatorOptions.outputPath,
78
+ ...generatorOptions.globalProperty ? ['--global-property', generatorOptions.globalProperty] : []
79
+ ]
76
80
  ];
77
81
  return new Promise((resolve, reject) => {
78
82
  (0, node_child_process_1.spawn)(this.packageManagerRunner, args, spawnOptions)
@@ -1 +1 @@
1
- {"version":3,"file":"open-api-cli.generator.js","sourceRoot":"","sources":["../../../../schematics/code-generator/open-api-cli-generator/open-api-cli.generator.ts"],"names":[],"mappings":";;;AAAA,sDAAgD;AAChD,2DAAuD;AACvD,iEAA4F;AAC5F,kCAAkC;AAClC,6DAAmE;AAEnE;;GAEG;AACH,MAAa,mBAAoB,SAAQ,8BAAgC;IAGvE,IAAc,oBAAoB;QAChC,OAAO,IAAI,CAAC,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;IACxD,CAAC;IAKD,YAAY,OAAkD;QAC5D,KAAK,EAAE,CAAC;QAJV,kBAAkB;QACC,kBAAa,GAAG,yBAAyB,CAAC;QAuD7D,kBAAkB;QACR,sBAAiB,GAAG,GAAG,EAAE,CAAC,wDAAiC,CAAC;QAEtE,kBAAkB;QACR,4BAAuB,GAAG,CAAC,iBAA6C,EAAE,EAAE,EAAE;YACtF,MAAM,aAAa,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC;gBAClD,CAAC,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,C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CAAC;IAED;;;;OAIG;IACK,YAAY,CAAC,gBAAmC,EAAE,YAA0B;QAClF,MAAM,IAAI,GAAG;YACX,uBAAuB;YACvB,UAAU;YACV,gBAAgB,CAAC,mBAAmB,CAAC,CAAC,CAAC,sBAAsB,gBAAgB,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC,EAAE;YACxG,IAAI,EAAE,gBAAgB,CAAC,aAAa;YACpC,IAAI,EAAE,gBAAgB,CAAC,QAAQ;YAC/B,GAAG,gBAAgB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE;YACjF,IAAI,EAAE,gBAAgB,CAAC,UAAU;YACjC,GAAG,gBAAgB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE;SACjG,CAAC;QACF,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3C,IAAA,0BAAK,EAAC,IAAI,CAAC,oBAAoB,EAAE,IAAI,EAAE,YAAY,CAAC;iBACjD,EAAE,CAAC,OAAO,EAAE,CAAC,IAAY,EAAE,EAAE;gBAC5B,IAAI,IAAI,KAAK,CAAC,EAAE;oBACd,OAAO,EAAE,CAAC;iBACX;qBAAM;oBACL,MAAM,CAAC,IAAI,KAAK,CAAC,oEAAoE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;iBAC1G;YACH,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC;CAyBF;AAtFD,kDAsFC"}
1
+ {"version":3,"file":"open-api-cli.generator.js","sourceRoot":"","sources":["../../../../schematics/code-generator/open-api-cli-generator/open-api-cli.generator.ts"],"names":[],"mappings":";;;AAAA,sDAAgD;AAChD,2DAAuD;AACvD,iEAA4F;AAC5F,kCAAkC;AAClC,6DAAm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IAAI,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE;oBACjF,IAAI,EAAE,gBAAgB,CAAC,UAAU;oBACjC,GAAG,gBAAgB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE;iBACjG;SACJ,CAAC;QACF,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3C,IAAA,0BAAK,EAAC,IAAI,CAAC,oBAAoB,EAAE,IAAI,EAAE,YAAY,CAAC;iBACjD,EAAE,CAAC,OAAO,EAAE,CAAC,IAAY,EAAE,EAAE;gBAC5B,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;oBACf,OAAO,EAAE,CAAC;gBACZ,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,IAAI,KAAK,CAAC,oEAAoE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC3G,CAAC;YACH,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC;CAyBF;AA1FD,kDA0FC"}
@@ -32,9 +32,27 @@ export type OpenApiCliOptions = CodegenTaskOptions & {
32
32
  * ```typescript
33
33
  * 'debugOperations'
34
34
  * ```
35
+ * @example To generate the dates as string types
36
+ * ```typescript
37
+ * 'stringifyDate'
38
+ * ```
39
+ * @example To be able to extend the SDK models and ensure that revivers are generated
40
+ * ```typescript
41
+ * 'allowModelExtension'
42
+ * ```
35
43
  * @default ''
36
44
  */
37
45
  globalProperty: string;
46
+ /**
47
+ * Run generator by key (from openapitools.json)
48
+ * @default ''
49
+ */
50
+ generatorKey: string;
51
+ /**
52
+ * Specifies the rules to be enabled in OpenAPI normalizer
53
+ * @default ''
54
+ */
55
+ openapiNormalizer: string;
38
56
  };
39
57
  /**
40
58
  * Default options to run our custom typescript generator
@@ -1 +1 @@
1
- {"version":3,"file":"open-api-cli.options.d.ts","sourceRoot":"","sources":["../../../../schematics/code-generator/open-api-cli-generator/open-api-cli.options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAGrD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,GAAG;IACnD;;;;;;OAMG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;;;;;;;;;OAWG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iCAAiC,EAAE,iBAQ/C,CAAC"}
1
+ {"version":3,"file":"open-api-cli.options.d.ts","sourceRoot":"","sources":["../../../../schematics/code-generator/open-api-cli-generator/open-api-cli.options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAGrD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,GAAG;IACnD;;;;;;OAMG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iCAAiC,EAAE,iBAU/C,CAAC"}
@@ -12,6 +12,8 @@ exports.defaultTypescriptGeneratorOptions = {
12
12
  specPath: 'swagger-spec.yaml',
13
13
  outputPath: '.',
14
14
  specConfigPath: '',
15
- globalProperty: ''
15
+ globalProperty: '',
16
+ generatorKey: '',
17
+ openapiNormalizer: ''
16
18
  };
17
19
  //# sourceMappingURL=open-api-cli.options.js.map