@rxap/open-api 16.0.0-dev.3 → 16.0.0-dev.5

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 (82) hide show
  1. package/CHANGELOG.md +649 -0
  2. package/README.md +8 -33
  3. package/data-source/index.d.ts +5 -0
  4. package/data-source/lib/error.d.ts +4 -0
  5. package/data-source/lib/open-api-data-source.loader.d.ts +12 -0
  6. package/data-source/lib/open-api.data-source.d.ts +40 -0
  7. package/data-source/table/index.d.ts +4 -0
  8. package/data-source/table/lib/error.d.ts +4 -0
  9. package/data-source/table/lib/open-api-table.data-source.d.ts +29 -0
  10. package/data-source/table/lib/to-open-api-table-data-source.pipe.d.ts +17 -0
  11. package/data-source/table/lib/tokens.d.ts +2 -0
  12. package/esm2022/data-source/index.mjs +6 -0
  13. package/esm2022/data-source/lib/error.mjs +8 -0
  14. package/esm2022/data-source/lib/open-api-data-source.loader.mjs +36 -0
  15. package/esm2022/data-source/lib/open-api.data-source.mjs +154 -0
  16. package/esm2022/data-source/rxap-open-api-data-source.mjs +5 -0
  17. package/esm2022/data-source/table/index.mjs +5 -0
  18. package/esm2022/data-source/table/lib/error.mjs +8 -0
  19. package/esm2022/data-source/table/lib/open-api-table.data-source.mjs +131 -0
  20. package/esm2022/data-source/table/lib/to-open-api-table-data-source.pipe.mjs +29 -0
  21. package/esm2022/data-source/table/lib/tokens.mjs +3 -0
  22. package/esm2022/data-source/table/rxap-open-api-data-source-table.mjs +5 -0
  23. package/esm2022/index.mjs +1 -1
  24. package/esm2022/lib/error.mjs +1 -1
  25. package/esm2022/lib/open-api-config.service.mjs +23 -24
  26. package/esm2022/lib/open-api-http-response.error.mjs +7 -7
  27. package/esm2022/lib/open-api.meta-data.mjs +1 -1
  28. package/esm2022/lib/open-api.mjs +1 -1
  29. package/esm2022/lib/schema-validation.mixin.mjs +21 -13
  30. package/esm2022/lib/tokens.mjs +1 -1
  31. package/esm2022/lib/utilities.mjs +1 -1
  32. package/esm2022/remote-method/index.mjs +4 -0
  33. package/esm2022/remote-method/lib/error.mjs +1 -1
  34. package/esm2022/remote-method/lib/open-api-remote-method.loader.mjs +7 -8
  35. package/esm2022/remote-method/lib/open-api.remote-method.mjs +67 -54
  36. package/esm2022/remote-method/rxap-open-api-remote-method.mjs +2 -2
  37. package/esm2022/rxap-open-api.mjs +1 -1
  38. package/fesm2022/rxap-open-api-data-source-table.mjs +172 -0
  39. package/fesm2022/rxap-open-api-data-source-table.mjs.map +1 -0
  40. package/fesm2022/rxap-open-api-data-source.mjs +198 -0
  41. package/fesm2022/rxap-open-api-data-source.mjs.map +1 -0
  42. package/fesm2022/rxap-open-api-remote-method.mjs +65 -51
  43. package/fesm2022/rxap-open-api-remote-method.mjs.map +1 -1
  44. package/fesm2022/rxap-open-api.mjs +42 -33
  45. package/fesm2022/rxap-open-api.mjs.map +1 -1
  46. package/lib/open-api-config.service.d.ts +6 -6
  47. package/lib/open-api-http-response.error.d.ts +1 -1
  48. package/lib/schema-validation.mixin.d.ts +2 -2
  49. package/package.json +59 -52
  50. package/remote-method/index.d.ts +3 -5
  51. package/remote-method/lib/open-api.remote-method.d.ts +5 -6
  52. package/LICENSE +0 -21
  53. package/collection.json +0 -15
  54. package/esm2022/remote-method/public_api.mjs +0 -4
  55. package/migration.json +0 -4
  56. package/remote-method/public_api.d.ts +0 -3
  57. package/src/schematics/ng-add/index.d.ts +0 -2
  58. package/src/schematics/ng-add/index.js +0 -8
  59. package/src/schematics/ng-add/index.js.map +0 -1
  60. package/src/schematics/ng-add/schema.json +0 -7
  61. package/src/schematics/open-api/coerce-open-api-project.d.ts +0 -5
  62. package/src/schematics/open-api/coerce-open-api-project.js +0 -53
  63. package/src/schematics/open-api/coerce-open-api-project.js.map +0 -1
  64. package/src/schematics/open-api/const.d.ts +0 -4
  65. package/src/schematics/open-api/const.js +0 -8
  66. package/src/schematics/open-api/const.js.map +0 -1
  67. package/src/schematics/open-api/create-directive.d.ts +0 -2
  68. package/src/schematics/open-api/create-directive.js +0 -308
  69. package/src/schematics/open-api/create-directive.js.map +0 -1
  70. package/src/schematics/open-api/generate-openapi-provider.d.ts +0 -3
  71. package/src/schematics/open-api/generate-openapi-provider.js +0 -41
  72. package/src/schematics/open-api/generate-openapi-provider.js.map +0 -1
  73. package/src/schematics/open-api/generate-remote-method.d.ts +0 -3
  74. package/src/schematics/open-api/generate-remote-method.js +0 -173
  75. package/src/schematics/open-api/generate-remote-method.js.map +0 -1
  76. package/src/schematics/open-api/index.d.ts +0 -3
  77. package/src/schematics/open-api/index.js +0 -93
  78. package/src/schematics/open-api/index.js.map +0 -1
  79. package/src/schematics/open-api/options.d.ts +0 -14
  80. package/src/schematics/open-api/options.js +0 -3
  81. package/src/schematics/open-api/options.js.map +0 -1
  82. package/src/schematics/open-api/schema.json +0 -116
@@ -1,173 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GenerateRemoteMethod = void 0;
4
- const tslib_1 = require("tslib");
5
- const schematics_open_api_1 = require("@rxap/schematics-open-api");
6
- const path_1 = require("path");
7
- const ts_morph_1 = require("ts-morph");
8
- const core_1 = require("@angular-devkit/core");
9
- const create_directive_1 = require("./create-directive");
10
- const const_1 = require("./const");
11
- const { dasherize, classify } = core_1.strings;
12
- function GenerateRemoteMethod(parameter) {
13
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
14
- const operationId = parameter.operationId;
15
- const name = [operationId, const_1.REMOTE_METHOD_FILE_SUFFIX].join('.');
16
- const fileName = (0, path_1.join)(const_1.REMOTE_METHOD_BASE_PATH, dasherize(name) + '.ts');
17
- const sourceFile = parameter.project.createSourceFile(fileName);
18
- const importStructures = [
19
- {
20
- moduleSpecifier: '@rxap/open-api/remote-method',
21
- namedImports: [
22
- { name: 'RxapOpenApiRemoteMethod' },
23
- { name: 'OpenApiRemoteMethodParameter' }
24
- ]
25
- },
26
- {
27
- moduleSpecifier: '@angular/core',
28
- namedImports: [{ name: 'Injectable' }]
29
- }
30
- ];
31
- switch (parameter.options.transport) {
32
- case 'amplify':
33
- importStructures.push({
34
- moduleSpecifier: '@rxap/amplify-open-api',
35
- namedImports: [{ name: 'AmplifyOpenApiRemoteMethod' }]
36
- });
37
- break;
38
- default:
39
- importStructures.push({
40
- moduleSpecifier: '@rxap/open-api/remote-method',
41
- namedImports: [{ name: 'OpenApiRemoteMethod' }]
42
- });
43
- break;
44
- }
45
- const responseType = (0, schematics_open_api_1.GetResponseType)(parameter);
46
- const parameterType = (0, schematics_open_api_1.GetParameterType)(parameter);
47
- const requestBodyType = (0, schematics_open_api_1.GetRequestBodyType)(parameter);
48
- if (!['void', 'any'].includes(responseType)) {
49
- importStructures.push({
50
- moduleSpecifier: `../responses/${dasherize(responseType.replace(/Response$/, ''))}.response`,
51
- namedImports: [{ name: responseType }]
52
- });
53
- }
54
- if (!['void', 'any'].includes(parameterType)) {
55
- importStructures.push({
56
- moduleSpecifier: `../parameters/${dasherize(parameterType.replace(/Parameter$/, ''))}.parameter`,
57
- namedImports: [{ name: parameterType }]
58
- });
59
- }
60
- if (!['void', 'any'].includes(requestBodyType)) {
61
- importStructures.push({
62
- moduleSpecifier: `../request-bodies/${dasherize(requestBodyType.replace(/RequestBody$/, ''))}.request-body`,
63
- namedImports: [{ name: requestBodyType }]
64
- });
65
- }
66
- const callMethodParameters = [];
67
- const withoutParametersAndRequestBody = parameterType === 'void' && requestBodyType === 'void';
68
- if (!withoutParametersAndRequestBody) {
69
- callMethodParameters.push({
70
- name: 'parameters',
71
- type: `OpenApiRemoteMethodParameter<${parameterType}, ${requestBodyType}>`
72
- });
73
- }
74
- const classStructure = {
75
- name: classify(name.replace(/\./g, '-')),
76
- decorators: [
77
- {
78
- name: 'Injectable',
79
- arguments: ts_morph_1.Writers.object({
80
- providedIn: (writer) => writer.quote('root')
81
- })
82
- },
83
- {
84
- name: 'RxapOpenApiRemoteMethod',
85
- arguments: parameter.options.inline ? (writer) => ts_morph_1.Writers.object({
86
- serverId: parameter.options.serverId ? w => w.quote(parameter.options.serverId) : 'undefined',
87
- operationId: w => w.quote(parameter.operationId),
88
- operation: w => w.quote(JSON.stringify((0, schematics_open_api_1.GenerateParameterToOperationObjectWithMetadata)(parameter)).replace(/[\n\r\\]+/g, ''))
89
- })(writer) : w => w.quote(operationId)
90
- }
91
- ],
92
- methods: [
93
- {
94
- name: 'call',
95
- parameters: callMethodParameters,
96
- scope: ts_morph_1.Scope.Public,
97
- returnType: `Promise<${responseType}>`,
98
- hasOverrideKeyword: true,
99
- statements: [
100
- `return super.call(${withoutParametersAndRequestBody ? '' : 'parameters'});`
101
- ]
102
- }
103
- ],
104
- extends: (writer) => {
105
- switch (parameter.options.transport) {
106
- case 'amplify':
107
- writer.write('AmplifyOpenApiRemoteMethod');
108
- break;
109
- default:
110
- writer.write('OpenApiRemoteMethod');
111
- break;
112
- }
113
- writer.write('<');
114
- writer.write(responseType);
115
- writer.write(', ');
116
- writer.write(parameterType);
117
- writer.write(', ');
118
- writer.write(requestBodyType);
119
- writer.write('>');
120
- },
121
- isExported: true
122
- };
123
- sourceFile.addClass(classStructure);
124
- const withoutParameters = (0, schematics_open_api_1.IsWithoutParameters)(parameter);
125
- if (!parameter.options.skipDirectives) {
126
- if ((0, schematics_open_api_1.IsCollectionResponse)(parameter)) {
127
- importStructures.push({
128
- moduleSpecifier: '@rxap/utilities',
129
- namedImports: [{ name: 'ArrayElement' }]
130
- });
131
- (0, create_directive_1.CreateDirective)({
132
- filePath: fileName,
133
- name: operationId,
134
- prefix: parameter.options.prefix,
135
- parametersType: `OpenApiRemoteMethodParameter<${parameterType}, ${requestBodyType}>`,
136
- returnType: `ArrayElement<${responseType}>`,
137
- template: true,
138
- collection: true,
139
- sourceFile,
140
- withoutParameters
141
- });
142
- }
143
- (0, create_directive_1.CreateDirective)({
144
- filePath: fileName,
145
- name: operationId,
146
- prefix: parameter.options.prefix,
147
- parametersType: `OpenApiRemoteMethodParameter<${parameterType}, ${requestBodyType}>`,
148
- returnType: responseType,
149
- template: true,
150
- collection: false,
151
- sourceFile,
152
- withoutParameters
153
- });
154
- (0, create_directive_1.CreateDirective)({
155
- filePath: fileName,
156
- name: operationId,
157
- prefix: parameter.options.prefix,
158
- parametersType: `OpenApiRemoteMethodParameter<${parameterType}, ${requestBodyType}>`,
159
- returnType: responseType,
160
- template: false,
161
- collection: false,
162
- sourceFile,
163
- withoutParameters
164
- });
165
- }
166
- sourceFile.addImportDeclarations(importStructures);
167
- sourceFile.organizeImports({
168
- ensureNewLineAtEndOfFile: true
169
- });
170
- });
171
- }
172
- exports.GenerateRemoteMethod = GenerateRemoteMethod;
173
- //# sourceMappingURL=generate-remote-method.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-remote-method.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/schematics/open-api/generate-remote-method.ts"],"names":[],"mappings":";;;;AAAA,mEAQmC;AAEnC,+BAA4B;AAC5B,uCAOkB;AAClB,+CAA+C;AAC/C,yDAAqD;AACrD,mCAGiB;AAEjB,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,cAAO,CAAC;AAExC,SAAsB,oBAAoB,CACxC,SAA+C;;QAE/C,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;QAE1C,MAAM,IAAI,GAAO,CAAE,WAAW,EAAE,iCAAyB,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtE,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,+BAAuB,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;QAExE,MAAM,UAAU,GAAG,SAAS,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAEhE,MAAM,gBAAgB,GAAoD;YACxE;gBACE,eAAe,EAAE,8BAA8B;gBAC/C,YAAY,EAAK;oBACf,EAAE,IAAI,EAAE,yBAAyB,EAAE;oBACnC,EAAE,IAAI,EAAE,8BAA8B,EAAE;iBACzC;aACF;YACD;gBACE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C3B,MAAM,EAAU,SAAS,CAAC,OAAO,CAAC,MAAM;gBACxC,cAAc,EAAE,gCAAgC,aAAa,KAAK,eAAe,GAAG;gBACpF,UAAU,EAAM,YAAY;gBAC5B,QAAQ,EAAQ,KAAK;gBACrB,UAAU,EAAM,KAAK;gBACrB,UAAU;gBACV,iBAAiB;aAClB,CAAC,CAAC;SAEJ;QAED,UAAU,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;QAEnD,UAAU,CAAC,eAAe,CAAC;YACzB,wBAAwB,EAAE,IAAI;SAC/B,CAAC,CAAC;IACL,CAAC;CAAA;AA1LD,oDA0LC"}
@@ -1,3 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { OpenApiSchema } from './schema';
3
- export default function (options: OpenApiSchema): Rule;
@@ -1,93 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const schematics_1 = require("@angular-devkit/schematics");
5
- const path_1 = require("path");
6
- const ts_morph_1 = require("ts-morph");
7
- const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
8
- const schematics_open_api_1 = require("@rxap/schematics-open-api");
9
- const schematics_utilities_1 = require("@rxap/schematics-utilities");
10
- const generate_remote_method_1 = require("./generate-remote-method");
11
- const const_1 = require("./const");
12
- const coerce_open_api_project_1 = require("./coerce-open-api-project");
13
- const generate_openapi_provider_1 = require("./generate-openapi-provider");
14
- function GetOperationIdList(openapi) {
15
- const operationIdList = [];
16
- for (const [_, methods] of Object.entries(openapi.paths)) {
17
- if (methods) {
18
- for (const method of Object.keys(methods).filter(schematics_open_api_1.IsHttpMethod)) {
19
- const operation = methods[method];
20
- if ((0, schematics_open_api_1.IsOperationObject)(operation)) {
21
- if ((0, schematics_open_api_1.IgnoreOperation)(['hidden'])(operation)) {
22
- console.log(`Ignore operation '${operation.operationId}'`);
23
- }
24
- else {
25
- if ((0, schematics_open_api_1.HasOperationId)(operation)) {
26
- operationIdList.push(operation.operationId);
27
- }
28
- }
29
- }
30
- }
31
- }
32
- }
33
- return operationIdList;
34
- }
35
- function default_1(options) {
36
- return (host) => tslib_1.__awaiter(this, void 0, void 0, function* () {
37
- var _a, _b;
38
- const openapi = yield (0, schematics_open_api_1.LoadOpenApiConfig)(host, options);
39
- const project = new ts_morph_1.Project({
40
- manipulationSettings: {
41
- indentationText: ts_morph_1.IndentationText.TwoSpaces,
42
- quoteKind: ts_morph_1.QuoteKind.Single,
43
- useTrailingCommas: true
44
- },
45
- useInMemoryFileSystem: true
46
- });
47
- if (!options.project) {
48
- options.project = 'open-api';
49
- }
50
- if (options.directory) {
51
- options.directory = options.directory.split('/').map(item => (0, schematics_utilities_1.dasherize)(item)).join('/');
52
- }
53
- const projectName = `${options.directory ? options.directory.split('/').join('-') + '-' : ''}${options.project}`;
54
- const projectBasePath = (0, schematics_utilities_1.HasProject)(host, projectName) ? (0, schematics_utilities_1.GetProjectSourceRoot)(host, projectName) : `libs/${options.directory ? options.directory + '/' : ''}${options.project}/src`;
55
- const basePath = (0, path_1.join)(projectBasePath, 'lib');
56
- options.prefix = (_b = (_a = options.prefix) !== null && _a !== void 0 ? _a : ((0, schematics_utilities_1.HasProject)(host, projectName) ? (0, schematics_utilities_1.GetProjectPrefix)(host, projectName) : (0, schematics_utilities_1.GetDefaultPrefix)(host))) !== null && _b !== void 0 ? _b : 'rxap';
57
- if (!options.debug) {
58
- // TODO : reset the hack after the schematic execution is finished
59
- console.debug = function () { };
60
- }
61
- const generatorFunctionList = [];
62
- const clearPathList = [];
63
- if (!options.skipRemoteMethod) {
64
- generatorFunctionList.push(generate_remote_method_1.GenerateRemoteMethod);
65
- clearPathList.push(const_1.REMOTE_METHOD_BASE_PATH);
66
- }
67
- return (0, schematics_1.chain)([
68
- (0, schematics_open_api_1.ClearOperation)([
69
- schematics_open_api_1.COMPONENTS_BASE_PATH,
70
- schematics_open_api_1.PARAMETER_BASE_PATH,
71
- schematics_open_api_1.RESPONSE_BASE_PATH,
72
- schematics_open_api_1.REQUEST_BODY_BASE_PATH,
73
- ...clearPathList,
74
- ], basePath),
75
- (0, coerce_open_api_project_1.CoerceOpenApiProject)(options.project, options.prefix, options.directory),
76
- () => tslib_1.__awaiter(this, void 0, void 0, function* () { yield (0, schematics_open_api_1.GenerateOperation)(openapi, project, options, generatorFunctionList); }),
77
- () => options.skipProvider ? (0, schematics_1.noop)() : (0, generate_openapi_provider_1.GenerateOpenapiProvider)(project, GetOperationIdList(openapi), options),
78
- (0, schematics_ts_morph_1.ApplyTsMorphProject)(project, basePath),
79
- (0, schematics_ts_morph_1.FixMissingImports)(),
80
- (tree) => {
81
- const indexFile = (0, path_1.join)(projectBasePath, 'index.ts');
82
- if (options.export) {
83
- (0, schematics_utilities_1.CoerceFile)(tree, indexFile, (0, schematics_open_api_1.GenerateIndexExports)(project));
84
- }
85
- else {
86
- (0, schematics_utilities_1.CoerceFile)(tree, indexFile, 'export {};');
87
- }
88
- },
89
- ]);
90
- });
91
- }
92
- exports.default = default_1;
93
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/schematics/open-api/index.ts"],"names":[],"mappings":";;;AAAA,2DAKoC;AACpC,+BAA4B;AAC5B,uCAIkB;AAClB,mEAGmC;AACnC,mEAcmC;AAEnC,qEAOoC;AACpC,qEAAgE;AAChE,mCAGiB;AACjB,uEAAiE;AACjE,2EAAsE;AAGtE,SAAS,kBAAkB,CAAC,OAA2B;IAErD,MAAM,eAAe,GAAa,EAAE,CAAC;IAErC,KAAK,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QAExD,IAAI,OAAO,EAAE;YAEX,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,kCAAY,CAAC,EAAE;gBAE9D,MAAM,SAAS,G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,CACT;YACD,IAAA,8CAAoB,EAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC;YACxE,GAAS,EAAE,wDAAG,MAAM,IAAA,uCAAiB,EAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,qBAAqB,CAAC,CAAA,CAAC,CAAC,CAAA;YACzF,GAAG,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,IAAA,iBAAI,GAAE,CAAC,CAAC,CAAC,IAAA,mDAAuB,EAAC,OAAO,EAAE,kBAAkB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;YAC5G,IAAA,yCAAmB,EAAC,OAAO,EAAE,QAAQ,CAAC;YACtC,IAAA,uCAAiB,GAAE;YACnB,CAAC,IAAI,EAAE,EAAE;gBACP,MAAM,SAAS,GAAG,IAAA,WAAI,EAAC,eAAe,EAAE,UAAU,CAAC,CAAC;gBACpD,IAAI,OAAO,CAAC,MAAM,EAAE;oBAClB,IAAA,iCAAU,EAAC,IAAI,EAAE,SAAS,EAAE,IAAA,0CAAoB,EAAC,OAAO,CAAC,CAAC,CAAC;iBAC5D;qBAAM;oBACL,IAAA,iCAAU,EAAC,IAAI,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;iBAC3C;YACH,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAA,CAAC;AACJ,CAAC;AAnED,4BAmEC"}
@@ -1,14 +0,0 @@
1
- import { SourceFile } from 'ts-morph';
2
- export interface CreateDirectiveRuleOptions {
3
- filePath: string;
4
- name: string;
5
- prefix: string;
6
- parametersType: string;
7
- returnType: string;
8
- template: boolean;
9
- collection: boolean;
10
- }
11
- export interface CreateDirectiveOptions extends CreateDirectiveRuleOptions {
12
- sourceFile: SourceFile;
13
- withoutParameters: boolean;
14
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=options.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../../../libs/open-api/src/schematics/open-api/options.ts"],"names":[],"mappings":""}
@@ -1,116 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "$id": "open-api",
4
- "type": "object",
5
- "description": "",
6
- "properties": {},
7
- "oneOf": [
8
- {
9
- "properties": {
10
- "path": {
11
- "type": "string",
12
- "description": "The path to the openapi config",
13
- "format": "path"
14
- },
15
- "project": {
16
- "type": "string",
17
- "description": "The target project where the data sources and remote methods should be generated.",
18
- "default": "open-api"
19
- },
20
- "directory": {
21
- "type": "string",
22
- "description": "A directory where the library is placed."
23
- },
24
- "prefix": {
25
- "type": "string"
26
- },
27
- "transport": {
28
- "type": "string",
29
- "enum": [
30
- "amplify"
31
- ]
32
- },
33
- "export": {
34
- "type": "boolean",
35
- "description": "If true the index.ts of the select project will replaced with export statement for each generate file",
36
- "default": false
37
- },
38
- "inline": {
39
- "type": "boolean",
40
- "default": false
41
- },
42
- "skipRemoteMethod": {
43
- "type": "boolean",
44
- "default": false
45
- },
46
- "skipProvider": {
47
- "type": "boolean",
48
- "default": false
49
- },
50
- "skipDirectives": {
51
- "type": "boolean",
52
- "default": false
53
- },
54
- "serverId": {
55
- "type": "string"
56
- }
57
- },
58
- "required": [
59
- "path"
60
- ]
61
- },
62
- {
63
- "properties": {
64
- "url": {
65
- "type": "string",
66
- "description": "The url to the openapi config"
67
- },
68
- "project": {
69
- "type": "string",
70
- "description": "The target project where the data sources and remote methods should be generated.",
71
- "default": "open-api"
72
- },
73
- "directory": {
74
- "type": "string",
75
- "description": "A directory where the library is placed."
76
- },
77
- "prefix": {
78
- "type": "string"
79
- },
80
- "transport": {
81
- "type": "string",
82
- "enum": [
83
- "amplify"
84
- ]
85
- },
86
- "export": {
87
- "type": "boolean",
88
- "description": "If true the index.ts of the select project will replaced with export statement for each generate file",
89
- "default": false
90
- },
91
- "inline": {
92
- "type": "boolean",
93
- "default": false
94
- },
95
- "skipRemoteMethod": {
96
- "type": "boolean",
97
- "default": false
98
- },
99
- "skipProvider": {
100
- "type": "boolean",
101
- "default": false
102
- },
103
- "skipDirectives": {
104
- "type": "boolean",
105
- "default": false
106
- },
107
- "serverId": {
108
- "type": "string"
109
- }
110
- },
111
- "required": [
112
- "url"
113
- ]
114
- }
115
- ]
116
- }