@shopware/api-gen 1.5.1 → 1.5.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 CHANGED
@@ -33,7 +33,7 @@ deno install --dev npm:@shopware/api-gen
33
33
 
34
34
  ## Features
35
35
 
36
- Generator will create a new directory `api-types` with TypeScript schemas inside. Depending on the `apiType` parameter it will create `storeApiTypes.ts` or `adminApiTypes.ts` file.
36
+ Generator will create a new directory `api-types` with TypeScript schemas inside. Depending on the `apiType` parameter it will create `storeApiTypes.d.ts` or `adminApiTypes.d.ts` file.
37
37
 
38
38
  ### Overriding
39
39
 
@@ -99,6 +99,14 @@ export type operations = {
99
99
  > [!IMPORTANT]
100
100
  > Overriding components or operations in the TS files requires you to have a full object definitions!
101
101
 
102
+ Override-only projects (extra plugin endpoints, no local OpenAPI JSON) should
103
+ import components from `@shopware/api-client/store-api-types` and merge the
104
+ overlay in `shopware.d.ts` with `WithApiOverrides` from `@shopware/api-client`.
105
+ That keeps StackBlitz working without committing a generated `storeApiTypes.d.ts`.
106
+ See the [api-client TypeScript overrides](https://www.npmjs.com/package/@shopware/api-client) docs.
107
+ When you do run `generate`, it still applies the same overlay onto whatever base
108
+ schema it resolved (local JSON, or the types shipped with the api-client).
109
+
102
110
  ### Partial overrides
103
111
 
104
112
  There is a possiblity to add patches (partial overrides) to the schema. Partial overrides are applied directly to the JSON schema, so the syntax needs to be correct. It can then be used by the backend CI tool to validate and apply these patches directly to the schema to fix inconsistencies.
@@ -156,7 +164,7 @@ You could also use multiple patches and add your own overrides on top:
156
164
  }
157
165
  ```
158
166
 
159
- and then inside the `storeApiTypes.overrides.json` file you can add your patches:
167
+ and then inside the `./api-types/myOwnPatches.overrides.json` file you can add your patches:
160
168
 
161
169
  ```json
162
170
  {
@@ -281,7 +289,7 @@ pnpx @shopware/api-gen validateJson --help
281
289
  pnpx @shopware/api-gen validateJson --apiType=store
282
290
  ```
283
291
 
284
- this searches for `api-types/storeApiTypes.json` file and validates it. Use [loadSchema](#loadSchema) command first to fetch your JSON file.
292
+ this searches for `api-types/storeApiSchema.json` file and validates it. Use [loadSchema](#loadSchema) command first to fetch your JSON file.
285
293
 
286
294
  Prepare your config file named **api-gen.config.json**:
287
295
 
@@ -340,7 +348,7 @@ import { generate } from "@shopware/api-gen";
340
348
 
341
349
  await generate({
342
350
  cwd: process.cwd(),
343
- filename: "storeApiTypes.ts",
351
+ filename: "storeApiSchema.json",
344
352
  apiType: "store",
345
353
  debug: true,
346
354
  logPatches: true,
@@ -354,7 +362,7 @@ import { loadSchema } from "@shopware/api-gen";
354
362
 
355
363
  await loadSchema({
356
364
  cwd: process.cwd(),
357
- filename: "storeApiTypes.json",
365
+ filename: "storeApiSchema.json",
358
366
  apiType: "store",
359
367
  });
360
368
  ```
@@ -366,7 +374,7 @@ import { validateJson } from "@shopware/api-gen";
366
374
 
367
375
  await validateJson({
368
376
  cwd: process.cwd(),
369
- filename: "storeApiTypes.json",
377
+ filename: "storeApiSchema.json",
370
378
  apiType: "store",
371
379
  logPatches: true,
372
380
  debug: true,
@@ -401,15 +409,9 @@ await split({
401
409
 
402
410
  Full changelog for stable version is available [here](https://github.com/shopware/frontends/blob/main/packages/api-gen/CHANGELOG.md)
403
411
 
404
- ### Latest changes: 1.5.1
412
+ ### Latest changes: 1.5.3
405
413
 
406
414
  ### Patch Changes
407
415
 
408
- - [#2575](https://github.com/shopware/frontends/pull/2575) [`1e8a64c`](https://github.com/shopware/frontends/commit/1e8a64c71197484e2c8d2a2f148f3f29ab63bccd) Thanks [@patzick](https://github.com/patzick)! - Support OpenAPI `const` schema values during type generation.
409
-
410
- - [#2515](https://github.com/shopware/frontends/pull/2515) [`978b02c`](https://github.com/shopware/frontends/commit/978b02c969ca4b16f5fc1d7a953ec4cce3d98173) Thanks [@patzick](https://github.com/patzick)! - Generate `customFields` properties with a dedicated `CustomFields` type instead of the broader `GenericRecord` type.
411
-
412
- - [#2516](https://github.com/shopware/frontends/pull/2516) [`13a3766`](https://github.com/shopware/frontends/commit/13a37660fbbf63054b9e7d02f39d161bb7f2b065) Thanks [@patzick](https://github.com/patzick)! - Use `oxfmt` instead of Prettier for generated API files.
413
-
414
- - Updated dependencies [[`b767721`](https://github.com/shopware/frontends/commit/b767721847bf3391f9067eca7a045089fb22fce0), [`978b02c`](https://github.com/shopware/frontends/commit/978b02c969ca4b16f5fc1d7a953ec4cce3d98173), [`33facb1`](https://github.com/shopware/frontends/commit/33facb178792c8cb26b47ab984ac48c08ab4b72b), [`9137475`](https://github.com/shopware/frontends/commit/91374753cedb2034385f642e6af11314f2971caa), [`474d3fe`](https://github.com/shopware/frontends/commit/474d3fed346816135b0c7c797990b215a8b691c0)]:
415
- - @shopware/api-client@1.5.1
416
+ - Updated dependencies [[`44ece9d`](https://github.com/shopware/frontends/commit/44ece9dac2e4d0248c2270f7eff496c258632f5b), [`4b43e64`](https://github.com/shopware/frontends/commit/4b43e64a8d78be6eca1f8d9c24140e046193af41)]:
417
+ - @shopware/api-client@1.7.0