@shopware/api-gen 1.0.2 → 1.0.3
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/README.md +5 -3
- package/dist/cli.mjs +25 -8
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -233,10 +233,12 @@ Prepare your config file named **api-gen.config.json**:
|
|
|
233
233
|
|
|
234
234
|
Full changelog for stable version is available [here](https://github.com/shopware/frontends/blob/main/packages/api-gen/CHANGELOG.md)
|
|
235
235
|
|
|
236
|
-
### Latest changes: 1.0.
|
|
236
|
+
### Latest changes: 1.0.3
|
|
237
237
|
|
|
238
238
|
### Patch Changes
|
|
239
239
|
|
|
240
|
-
- [#
|
|
240
|
+
- [#1113](https://github.com/shopware/frontends/pull/1113) [`65212d1`](https://github.com/shopware/frontends/commit/65212d11bb8d0af10f97454a46e7671ff16ebc7a) Thanks [@patzick](https://github.com/patzick)! - Parse Json5 responses when using default overrides
|
|
241
241
|
|
|
242
|
-
- [#
|
|
242
|
+
- [#1112](https://github.com/shopware/frontends/pull/1112) [`2065d00`](https://github.com/shopware/frontends/commit/2065d00998cd84fb6e2f51d7f793eb178e0865e4) Thanks [@patzick](https://github.com/patzick)! - Fixed adding missing components in overrides. Used when component name is overriden and no component definition is provided for it.
|
|
243
|
+
|
|
244
|
+
- [#1103](https://github.com/shopware/frontends/pull/1103) [`c9a4965`](https://github.com/shopware/frontends/commit/c9a49659e77842a4b098d5b9cc6606f4158893fd) Thanks [@trimethylpentan](https://github.com/trimethylpentan)! - Re-enabled generation for `GenericRecord`s for openAPI objects
|
package/dist/cli.mjs
CHANGED
|
@@ -7050,7 +7050,7 @@ and limitations under the License.
|
|
|
7050
7050
|
|
|
7051
7051
|
// src/compiler/corePublic.ts
|
|
7052
7052
|
var versionMajorMinor = "5.5";
|
|
7053
|
-
var version = "5.5.
|
|
7053
|
+
var version = "5.5.3";
|
|
7054
7054
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
7055
7055
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
7056
7056
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -57484,7 +57484,7 @@ ${lanes.join("\n")}
|
|
|
57484
57484
|
}
|
|
57485
57485
|
if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
|
|
57486
57486
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
57487
|
-
const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
57487
|
+
const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l) || isJSDocImportTag(l));
|
|
57488
57488
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !hasResolutionModeOverride(overrideHost)) {
|
|
57489
57489
|
if (findAncestor(location, isImportEqualsDeclaration)) {
|
|
57490
57490
|
error2(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
|
|
@@ -128207,7 +128207,7 @@ ${lanes.join("\n")}
|
|
|
128207
128207
|
}
|
|
128208
128208
|
function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
128209
128209
|
var _a;
|
|
128210
|
-
if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
|
|
128210
|
+
if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent) || isJSDocImportTag(usage.parent)) {
|
|
128211
128211
|
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
|
|
128212
128212
|
if (isTypeOnly) {
|
|
128213
128213
|
const override = getResolutionModeOverride(usage.parent.attributes);
|
|
@@ -213974,6 +213974,15 @@ ${c$1.cyan(
|
|
|
213974
213974
|
});
|
|
213975
213975
|
}
|
|
213976
213976
|
});
|
|
213977
|
+
Object.entries(jsonOverrides?.components || {}).forEach((schema) => {
|
|
213978
|
+
if (!openApiSchema.components?.schemas?.[schema[0]]) {
|
|
213979
|
+
const patches = Array.isArray(schema[1]) ? schema[1] : [schema[1]];
|
|
213980
|
+
patches.forEach((patch) => {
|
|
213981
|
+
patchedSchema.components.schemas[schema[0]] = patch;
|
|
213982
|
+
appliedPatches++;
|
|
213983
|
+
});
|
|
213984
|
+
}
|
|
213985
|
+
});
|
|
213977
213986
|
Object.entries(openApiSchema?.paths || {}).forEach((pathObject) => {
|
|
213978
213987
|
const pathName = pathObject[0];
|
|
213979
213988
|
Object.entries(pathObject[1]).forEach((singlePath) => {
|
|
@@ -214070,7 +214079,8 @@ async function loadJsonOverrides({
|
|
|
214070
214079
|
try {
|
|
214071
214080
|
if (isURL(pathToResolve)) {
|
|
214072
214081
|
const response = await ofetch(pathToResolve, {
|
|
214073
|
-
responseType: "json"
|
|
214082
|
+
responseType: "json",
|
|
214083
|
+
parseResponse: lib.parse
|
|
214074
214084
|
});
|
|
214075
214085
|
return response;
|
|
214076
214086
|
} else {
|
|
@@ -214204,11 +214214,11 @@ async function generate(args) {
|
|
|
214204
214214
|
alphabetize: true,
|
|
214205
214215
|
supportArrayLength: true,
|
|
214206
214216
|
commentHeader: `/**
|
|
214207
|
-
* This file is auto-generated. Do not make direct changes to the file.
|
|
214217
|
+
* This file is auto-generated. Do not make direct changes to the file.
|
|
214208
214218
|
* Instead override it in your shopware.d.ts file.
|
|
214209
|
-
*
|
|
214219
|
+
*
|
|
214210
214220
|
* Shopware API version: ${version}
|
|
214211
|
-
*
|
|
214221
|
+
*
|
|
214212
214222
|
*/
|
|
214213
214223
|
`,
|
|
214214
214224
|
/**
|
|
@@ -214256,6 +214266,13 @@ async function generate(args) {
|
|
|
214256
214266
|
if (schemaObject.format === "binary") {
|
|
214257
214267
|
return "Blob";
|
|
214258
214268
|
}
|
|
214269
|
+
if (
|
|
214270
|
+
// for object types
|
|
214271
|
+
schemaObject.type === "object" && // without properties, items, anyOf, allOf
|
|
214272
|
+
!schemaObject.properties && !schemaObject.items && !schemaObject.anyOf && !schemaObject.allOf && !schemaObject.additionalProperties
|
|
214273
|
+
) {
|
|
214274
|
+
return "GenericRecord";
|
|
214275
|
+
}
|
|
214259
214276
|
}
|
|
214260
214277
|
});
|
|
214261
214278
|
schema += `
|
|
@@ -214353,7 +214370,7 @@ async function generate(args) {
|
|
|
214353
214370
|
}
|
|
214354
214371
|
|
|
214355
214372
|
const name = "@shopware/api-gen";
|
|
214356
|
-
const version = "1.0.
|
|
214373
|
+
const version = "1.0.3";
|
|
214357
214374
|
const description = "Shopware CLI for API client generation.";
|
|
214358
214375
|
const author = "Shopware";
|
|
214359
214376
|
const type = "module";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopware/api-gen",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Shopware CLI for API client generation.",
|
|
5
5
|
"author": "Shopware",
|
|
6
6
|
"type": "module",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"picocolors": "1.0.1",
|
|
36
36
|
"unbuild": "2.0.0",
|
|
37
37
|
"vitest": "1.6.0",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
38
|
+
"eslint-config-shopware": "0.0.9",
|
|
39
|
+
"tsconfig": "0.0.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"ofetch": "1.3.4",
|