@shopware/api-gen 1.4.0 → 1.5.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.
package/README.md CHANGED
@@ -20,13 +20,13 @@ npm install -D @shopware/api-gen
20
20
  yarn add -D @shopware/api-gen
21
21
 
22
22
  # pnpm
23
- pnpm install -D @shopware/api-gen
23
+ pnpm add -D @shopware/api-gen
24
24
 
25
25
  # bun
26
26
  bun install -D @shopware/api-gen
27
27
 
28
28
  # deno
29
- deno install --dev @shopware/api-gen
29
+ deno install --dev npm:@shopware/api-gen
30
30
  ```
31
31
 
32
32
  <!-- /automd -->
@@ -252,11 +252,22 @@ Remember to add `.env` file in order to authenticate with Shopware instance.
252
252
  OPENAPI_JSON_URL="https://your-shop-instance.shopware.store"
253
253
  ## This one needed to fetch store API schema
254
254
  OPENAPI_ACCESS_KEY="YOUR_STORE_API_ACCESS_KEY"
255
- ## These two needed to fetch admin API schema
255
+
256
+ ## Admin API authentication (choose one method):
257
+
258
+ ## Option 1: Password grant (username/password)
256
259
  SHOPWARE_ADMIN_USERNAME="my@username.com"
257
260
  SHOPWARE_ADMIN_PASSWORD="my-password"
261
+
262
+ ## Option 2: Client credentials grant (integration)
263
+ ## Create an integration in Shopware Admin > Settings > System > Integrations
264
+ # SHOPWARE_ADMIN_CLIENT_ID="your-integration-client-id"
265
+ # SHOPWARE_ADMIN_CLIENT_SECRET="your-integration-secret"
258
266
  ```
259
267
 
268
+ > [!NOTE]
269
+ > When `SHOPWARE_ADMIN_CLIENT_SECRET` is set, the client credentials grant will be used automatically. Otherwise, the password grant with username/password is used.
270
+
260
271
  ### `validateJson`
261
272
 
262
273
  This command allow to validate the output JSON file of your instance. You can configure which rules should be applied, we provide you with the schema configuration file, so you can easily modify it.
@@ -327,7 +338,7 @@ Each command can also be used programmatically within your own scripts:
327
338
  ```ts
328
339
  import { generate } from "@shopware/api-gen";
329
340
 
330
- await generate({
341
+ await generate({
331
342
  cwd: process.cwd(),
332
343
  filename: "storeApiTypes.ts",
333
344
  apiType: "store",
@@ -380,7 +391,7 @@ await split({
380
391
 
381
392
  ## Links
382
393
 
383
- - [📘 Documentation](https://frontends.shopware.com)
394
+ - [📘 Documentation](https://developer.shopware.com/frontends)
384
395
 
385
396
  - [👥 Community Discord](https://discord.com/channels/1308047705309708348/1405501315160739951) (`#composable-frontend` channel)
386
397
 
@@ -390,35 +401,15 @@ await split({
390
401
 
391
402
  Full changelog for stable version is available [here](https://github.com/shopware/frontends/blob/main/packages/api-gen/CHANGELOG.md)
392
403
 
393
- ### Latest changes: 1.4.0
394
-
395
- ### Minor Changes
404
+ ### Latest changes: 1.5.1
396
405
 
397
- - [#2181](https://github.com/shopware/frontends/pull/2181) [`ed72205`](https://github.com/shopware/frontends/commit/ed72205853e9fc40db513f8a4d08acf2dd7b1fba) Thanks [@patzick](https://github.com/patzick)! - Add API-specific configuration support for `store-api` and `admin-api` in `api-gen.config.json`. This allows configuring `rules` and `patches` separately for each API type. Root-level `rules` and `patches` are now deprecated but still supported for backwards compatibility.
398
-
399
- Example:
400
-
401
- ```json
402
- {
403
- "$schema": "./node_modules/@shopware/api-gen/api-gen.schema.json",
404
- "store-api": {
405
- "patches": ["storeApiSchema.overrides.json"],
406
- "rules": ["COMPONENTS_API_ALIAS"]
407
- },
408
- "admin-api": {
409
- "patches": ["adminApiSchema.overrides.json"]
410
- }
411
- }
412
- ```
406
+ ### Patch Changes
413
407
 
414
- - [#2126](https://github.com/shopware/frontends/pull/2126) [`e595bc1`](https://github.com/shopware/frontends/commit/e595bc1ea6afe01a0065300277a78ef8c1fe5667) Thanks [@mdanilowicz](https://github.com/mdanilowicz)! - Enhanced OpenAPI schema override merging to properly handle conflicts between `$ref` and composition keywords (`oneOf`, `anyOf`, `allOf`, `not`). When merging overrides:
415
- - Composition keywords now automatically remove conflicting `$ref` properties
416
- - `$ref` overrides can replace composition keywords entirely
417
- - Different composition keywords can replace each other (e.g., `allOf` → `oneOf`)
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.
418
409
 
419
- This ensures correct schema merging when using composition keywords in override files, preventing invalid OpenAPI schemas with conflicting `$ref` and composition keyword properties.
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.
420
411
 
421
- ### Patch Changes
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.
422
413
 
423
- - Updated dependencies [[`70dcf95`](https://github.com/shopware/frontends/commit/70dcf95d4370c63964d877a5cab113a53f93ca19), [`c77daa6`](https://github.com/shopware/frontends/commit/c77daa6a11e96c7f3688b16f7da010b54c7f5e8b)]:
424
- - @shopware/api-client@1.4.0
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