@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
@@ -35,11 +35,15 @@
35
35
  "yarn"
36
36
  ],
37
37
  "description": "Package manager to be used in the generated SDK"
38
+ },
39
+ "exactO3rVersion": {
40
+ "type": "boolean",
41
+ "description": "Use a pinned version for otter packages",
42
+ "default": false
38
43
  }
39
44
  },
40
45
  "additionalProperties": true,
41
46
  "required": [
42
- "name",
43
47
  "package"
44
48
  ]
45
49
  }
@@ -2,19 +2,16 @@
2
2
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
3
  "extends": [
4
4
  "config:base",
5
- "group:allNonMajor",
6
- "group:recommended",
7
- "group:monorepos",
8
- "group:test",
9
- "group:linters"
5
+ "github>AmadeusITGroup/otter//tools/renovate/base",
6
+ "github>AmadeusITGroup/otter//tools/renovate/sdk",
7
+ "github>AmadeusITGroup/otter//tools/renovate/sdk-spec-upgrade(my-specification-package)"
10
8
  ],
11
9
  "prConcurrentLimit": 0,
12
10
  "prHourlyLimit": 0,
13
11
  "baseBranches": [
14
- "master"
12
+ "master",
13
+ "main"
15
14
  ],
16
- "endpoint": "https://dev.azure.com/AmadeusDigitalAirline",
17
- "platform": "azure",
18
15
  "enabledManagers": [
19
16
  "npm"
20
17
  ],
@@ -22,7 +19,7 @@
22
19
  "stabilityDays": 0
23
20
  },
24
21
  "labels": [
25
- "upgrade"
22
+ "dependencies"
26
23
  ],
27
24
  "updateInternalDeps": true,
28
25
  "postUpdateOptions": [
@@ -32,54 +29,6 @@
32
29
  "automerge": true,
33
30
  "platformAutomerge": true,
34
31
  "packageRules": [
35
- {
36
- "matchPackagePrefixes": [
37
- "@my-api-scope",
38
- "@ama-sdk/generator"
39
- ],
40
- "postUpgradeTasks": {
41
- "commands": [
42
- "<%=packageManager%> install",
43
- "<%=packageManager%> run generate"
44
- ],
45
- "executionMode": "branch"
46
- }
47
- },
48
- {
49
- "matchPackagePrefixes": [
50
- "@my-api-scope"
51
- ],
52
- "rangeStrategy": "bump",
53
- "groupName": "Swagger Specification upgrade",
54
- "groupSlug": "spec-upgrade"
55
- },
56
- {
57
- "matchPackagePrefixes": [
58
- "@my-api-scope"
59
- ],
60
- "matchBaseBranches": [
61
- "/^release\/.*/"
62
- ],
63
- "rangeStrategy": "in-range-only"
64
- },
65
- {
66
- "matchPackageNames": [
67
- "@ama-sdk/core",
68
- "@ama-sdk/schematics"
69
- ],
70
- "rangeStrategy": "bump",
71
- "groupName": "SDK Core and Generator dependencies",
72
- "groupSlug": "sdk-core-dependencies"
73
- },
74
- {
75
- "excludePackagePrefixes": [
76
- "@my-api-scope"
77
- ],
78
- "matchBaseBranches": [
79
- "/^release\/.*/"
80
- ],
81
- "enabled": false
82
- },
83
32
  {
84
33
  "matchDepTypes": [
85
34
  "peerDependencies"
@@ -14,9 +14,13 @@
14
14
  "**/.yarn/**": true,
15
15
  <% } %>
16
16
  "**/node_modules/**": true,
17
- "src/base/*/*.ts": true
17
+ "src/api/**/*.ts": true,
18
+ "src/models/base/**/*.ts": true,
19
+ "src/spec/api-mock.ts": true,
20
+ "src/spec/operation-adapter.ts": true
18
21
  },
19
22
  "files.readonlyExclude": {
20
- "src/base/*/index.ts": true
23
+ "src/api/*/index.ts": true,
24
+ "src/models/base/*/index.ts": true
21
25
  }
22
26
  }
@@ -3,6 +3,13 @@
3
3
  "spaces": 2,
4
4
  "generator-cli": {
5
5
  "version": "<%= openApiSupportedVersion %>",
6
- "storageDir": ".openapi-generator"
6
+ "storageDir": ".openapi-generator",
7
+ "generators": {
8
+ "<%=projectName%>-<%=projectPackageName%>": {
9
+ "generatorName": "typescriptFetch",
10
+ "output": ".",
11
+ "inputSpec": ""
12
+ }
13
+ }
7
14
  }
8
15
  }
@@ -30,8 +30,8 @@
30
30
  },
31
31
  "scripts": {
32
32
  "clean": "rimraf test/ test-dev/ dist/ dist-dev/ dist-test/ build/",
33
- "lint:ci": "eslint '**/*[jt]s' --quiet --format junit --output-file ./dist-lint/result.xml",
34
- "lint": "eslint '**/*[jt]s' --cache",
33
+ "lint:ci": "eslint \"**/*[jt]s\" --quiet --format junit --output-file ./dist-lint/result.xml",
34
+ "lint": "eslint \"**/*[jt]s\" --cache",
35
35
  "start": "tsc-watch -b tsconfigs/esm2020 --noClear --onFirstSuccess \"<%=packageManager%> run files:pack --watch\"",
36
36
  "build": "<%=packageManager%> run build:cjs && <%=packageManager%> run build:esm2015 && <%=packageManager%> run build:esm2020 && <%=packageManager%> run files:pack",
37
37
  "build:cjs": "swc src -d dist/cjs -C module.type=commonjs -q",
@@ -40,13 +40,12 @@
40
40
  "set:version": "o3r-set-version --placeholder 0.0.0-placeholder",
41
41
  "resolve": "node -e 'process.stdout.write(require.resolve(process.argv[1]));'",
42
42
  "generate": "schematics @ama-sdk/schematics:typescript-core",
43
- "spec:regen": "<%=packageManager%> run generate <% if (packageManager === 'npm') {%>-- <%}%>--spec-path ./swagger-spec.yaml && amasdk-clear-index",
43
+ "spec:regen": "<%=packageManager%> run generate <% if (packageManager === 'npm') {%>-- <%}%>--generator-key <%=projectName%>-<%=projectPackageName%> && amasdk-clear-index",
44
44
  "files:pack": "amasdk-files-pack",
45
45
  "test": "jest --passWithNoTests",
46
46
  "publish:package": "npm publish ./dist",
47
- "postinstall": "husky install",
48
47
  "generate:mock": "schematics @ama-sdk/schematics:mock",
49
- "doc:generate": "cpx ./readme.md ./.readme-backup && typedoc && cpx ./.readme-backup ./readme.md && rimraf ./.readme-backup",
48
+ "doc:generate": "typedoc",
50
49
  "tools:changelog": "standard-version"
51
50
  },
52
51
  "lint-staged": {
@@ -71,43 +70,47 @@
71
70
  "@angular-eslint/eslint-plugin-template": "<%= angularEslintVersion %>",
72
71
  "@angular-eslint/utils": "<%= angularEslintVersion %>",
73
72
  "@angular/compiler": "<%= angularVersion %>",
73
+ "@angular/cli": "<%= angularVersion %>",
74
74
  "@commitlint/cli": "^17.0.0",
75
75
  "@schematics/angular": "<%= angularVersion %>",
76
76
  "@commitlint/config-conventional": "^17.0.0",
77
- "@ama-sdk/schematics": "~<%= sdkCoreVersion %>",
78
- "@ama-sdk/core": "~<%= sdkCoreVersion %>",
79
- "@o3r/eslint-config-otter": "^<%= sdkCoreVersion %>",
80
- "@o3r/eslint-plugin": "^<%= sdkCoreVersion %>",
81
- "@o3r/schematics": "^<%= sdkCoreVersion %>",
82
- "@o3r/workspace": "^<%= sdkCoreVersion %>",
77
+ "@ama-sdk/schematics": "<%= sdkCoreRange %>",
78
+ "@ama-sdk/core": "<%= sdkCoreRange %>",
79
+ "@o3r/eslint-config-otter": "<%= sdkCoreRange %>",
80
+ "@o3r/eslint-plugin": "<%= sdkCoreRange %>",
81
+ "@o3r/schematics": "<%= sdkCoreRange %>",
83
82
  "@openapitools/openapi-generator-cli": "<%= versions['@openapitools/openapi-generator-cli'] %>",
83
+ "@stylistic/eslint-plugin-ts": "<%= versions['@stylistic/eslint-plugin-ts'] %>",
84
84
  "@swc/cli": "^0.1.57",
85
85
  "@swc/core": "^1.3.85",
86
86
  "@types/jest": "<%= versions['@types/jest'] %>",
87
87
  "@types/node": "<%= versions['@types/node'] %>",
88
88
  "@typescript-eslint/eslint-plugin": "<%= versions['@typescript-eslint/eslint-plugin'] %>",
89
89
  "@typescript-eslint/parser": "<%= versions['@typescript-eslint/parser'] %>",
90
- "cpy": "<%= versions['cpy'] %>",
91
90
  "cpy-cli": "<%= versions['cpy-cli'] %>",
92
91
  "eslint": "<%= versions['eslint'] %>",
92
+ "eslint-import-resolver-node": "<%= versions['eslint-import-resolver-node'] %>",
93
93
  "eslint-plugin-jest": "<%= versions['eslint-plugin-jest'] %>",
94
94
  "eslint-plugin-jsdoc": "<%= versions['eslint-plugin-jsdoc'] %>",
95
95
  "eslint-plugin-prefer-arrow": "<%= versions['eslint-plugin-prefer-arrow'] %>",
96
96
  "eslint-plugin-unicorn": "<%= versions['eslint-plugin-unicorn'] %>",
97
97
  "globby": "<%= versions['globby'] %>",
98
- "husky": "~8.0.3",
99
98
  "isomorphic-fetch": "<%= versions['isomorphic-fetch'] %>",
100
99
  "jest": "<%= versions['jest'] %>",
101
100
  "jest-junit": "~16.0.0",
102
101
  "lint-staged": "^13.0.0",
103
102
  "minimist": "^1.2.6",
104
103
  "rimraf": "^5.0.1",
104
+ "rxjs": "<%= versions['rxjs'] %>",
105
105
  "standard-version": "^9.0.0",
106
106
  "ts-jest": "<%= versions['ts-jest'] %>",
107
107
  "typedoc": "~0.25.0",
108
108
  "tsc-watch": "^6.0.0",
109
109
  "typescript": "<%= versions['typescript'] %>"
110
- },
110
+ },<% if (exactO3rVersion) { %>
111
+ "<%= packageManager == 'yarn' ? 'resolutions' : 'overrides' %>": {
112
+ "@o3r/schematics": "<%= sdkCoreRange %>"
113
+ },<% } %>
111
114
  "peerDependencies": {
112
115
  "@ama-sdk/core": "~<%= sdkCoreVersion %>",
113
116
  "isomorphic-fetch": "<%= versions['isomorphic-fetch'] %>"
@@ -1,26 +1,26 @@
1
1
  <% if (projectDescription) { %># <%=projectDescription%><% } %>
2
2
 
3
- ### Based on Swagger spec 0.0.0
3
+ ### Based on OpenAPI spec 0.0.0
4
4
 
5
5
  The SDK contains 2 different parts:
6
6
 
7
- * Auto generated code (based on Swagger Spec)
7
+ * Auto generated code (based on OpenAPI Spec)
8
8
  * Specific code dedicated to this SDK
9
9
 
10
10
  ## Structure
11
11
 
12
12
  ### Auto Generated code
13
13
 
14
- A main part of the SDK is automatically generated from a Swagger Spec.
14
+ A main part of the SDK is automatically generated from an OpenAPI Spec.
15
15
  The following folders contain the generated code:
16
16
 
17
17
  * **src/api**: Containing the API calls files
18
- * **src/models/base**: Models based of swagger definitions
18
+ * **src/models/base**: Models based of OpenAPI definitions
19
19
 
20
20
  The Code can be regenerated by running the following command:
21
21
 
22
22
  ```shell
23
- yarn create @ama-sdk typescript --spec-path [path to your swagger file]
23
+ yarn create @ama-sdk typescript --spec-path [path to your openapi file]
24
24
  ```
25
25
  Note that you can use ```npm exec``` instead of ```yarn``` for every command specified in this documentation.
26
26
 
@@ -40,45 +40,45 @@ You can extend a base model in 3 steps:
40
40
  * Redirect the default model to your override:
41
41
 
42
42
  ```typescript
43
- // src/models/base/<model name>/index.ts
44
- export * from "../../core/<model name>";
43
+ // src/models/base/your-model-name/index.ts
44
+ export * from "../../core/your-model-name";
45
45
  ```
46
46
 
47
- * Indicate to Swagger CodeGen that you have override the base model:
47
+ * Indicate to OpenAPI CodeGen that you have overridden the base model:
48
48
 
49
49
  ```gitignore
50
- # in .swagger-codegen-ignore
51
- src/models/base/<model name>/index.ts
50
+ # in .openapi-codegen-ignore
51
+ src/models/base/your-model-name/index.ts
52
52
  ```
53
53
 
54
54
  * Create your core models
55
55
 
56
56
  ```typescript
57
- // src/models/core/<model name>/index.ts
58
- export * from "./<model name>.ts";
59
- export * from "./<model name>.reviver.ts";
57
+ // src/models/core/your-model-name/index.ts
58
+ export * from "./your-model-name.ts";
59
+ export * from "./your-model-name.reviver.ts";
60
60
  ```
61
61
 
62
62
  ```typescript
63
- // src/models/core/<model name>/<model name>.ts
64
- import { <model name> as Base<model name> } from "../../base/<model name>/<model name>";
63
+ // src/models/core/your-model-name/your-model-name.ts
64
+ import { YourModelName as BaseYourModelName } from "../../base/your-model-name/your-model-name";
65
65
 
66
- export interface <model name> extends BaseB<model name> {
66
+ export interface YourModelName extends BaseYourModelName {
67
67
  // Additional fields
68
68
  }
69
69
  ```
70
70
 
71
71
  ```typescript
72
- // src/models/core/<model name>/<model name>.reviver.ts
73
- import { yourFunction } from "../../../helpers/<model name>";
74
- import { revive<model name> as Base<model name> } from "../../base/<model name>/<model name>.reviver";
75
- import { <model name> } from "./<model name>";
72
+ // src/models/core/your-model-name/your-model-name.reviver.ts
73
+ import { yourFunction } from "../../../helpers/your-model-name";
74
+ import { reviveYourModelName as baseReviveYourModelName } from "../../base/your-model-name/your-model-name.reviver";
75
+ import { YourModelName } from "./your-model-name";
76
76
 
77
77
  import {Reviver, utils} from "@ama-sdk/core";
78
78
 
79
- export function revive<model name><T extends <model name> = <model name>>(data: any, dictionary?: any) {
79
+ export function reviveYourModelName<T extends YourModelName = YourModelName>(data: any, dictionary?: any) {
80
80
  // TODO: use BaseRevive<T> when ready
81
- const revivedData: T | undefined = Base<model name>(data, dictionary) as T | undefined;
81
+ const revivedData: T | undefined = baseReviveYourModelName(data, dictionary) as T | undefined;
82
82
 
83
83
  if (!revivedData) { return ; }
84
84
 
@@ -96,7 +96,7 @@ export function revive<model name><T extends <model name> = <model name>>(data:
96
96
 
97
97
  Some commands are provided to keep your SDK up-to-date.
98
98
 
99
- ### Generate SDK from a Swagger specification
99
+ ### Generate SDK from an OpenAPI specification
100
100
 
101
101
  ```shell
102
102
  yarn spec:regen
@@ -13,7 +13,6 @@
13
13
  "declaration": false,
14
14
  "declarationMap": false,
15
15
  "strict": false,
16
- "skipLibCheck": true,
17
16
  "module": "ES2020",
18
17
  "target": "ES2020"
19
18
  },
@@ -21,24 +21,6 @@
21
21
  "composite": true,
22
22
  "declaration": true,
23
23
  "declarationMap": false,
24
- "rootDir": "./src",
25
- "baseUrl": ".",
26
- "paths": {
27
- "<% if (projectName) { %>@<%=projectName%>/<% } %><%=projectPackageName%>/helpers/*": [
28
- "./src/helpers/*"
29
- ],
30
- "<% if (projectName) { %>@<%=projectName%>/<% } %><%=projectPackageName%>/helpers": [
31
- "./src/helpers/index"
32
- ],
33
- "<% if (projectName) { %>@<%=projectName%>/<% } %><%=projectPackageName%>": [
34
- "./src/index"
35
- ],
36
- "<% if (projectName) { %>@<%=projectName%>/<% } %><%=projectPackageName%>/*": [
37
- "./src/*"
38
- ],
39
- "<% if (projectName) { %>@<%=projectName%>/<% } %><%=projectPackageName%>/spec": [
40
- "./src/spec/index"
41
- ]
42
- }
24
+ "rootDir": "./src"
43
25
  }
44
26
  }
@@ -10,10 +10,10 @@
10
10
  "**/fixtures*.ts",
11
11
  "**/*.mock*.ts",
12
12
  "**/*.spec.ts",
13
- "**/*.perf.ts",
14
- "**/*.reviver.ts"
13
+ "**/*.perf.ts"
15
14
  ],
16
15
  "include": [
16
+ "./src/api/**/*.ts",
17
17
  "./src/models/**/*.ts",
18
18
  "./src/helpers/**/*.ts"
19
19
  ]
@@ -1,4 +0,0 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- <%=packageManager%> exec commitlint --edit $1
@@ -1,4 +0,0 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- <%=packageManager%> exec lint-staged