Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@shopware/api-gen) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
shopware/frontends - api-gen
Welcome to @shopware/api-gen CLI.
Generate TypeScript schemas from Shopware OpenAPI specification.
After generating schemas, you can use them in fully typed API Client.
Usage
# Using pnpm
pnpx add @shopware/api-gen [command]
# Using npm
npx i @shopware/api-gen [command]Commands
generate
Transform OpenAPI specification from JSON file to Typescript schemas. Use loadSchema command first.
options:
pnpx @shopware/api-gen generate --help
# generate schemas from store API
pnpx @shopware/api-gen generate --filename=storeApiSchema.json
# generate schemas from admin API
pnpx @shopware/api-gen generate --filename=adminApiSchema.jsonloadSchema
Load OpenAPI specification from Shopware instance and save it to JSON file.
options:
pnpx @shopware/api-gen loadSchema --help
# load schema from store API
pnpx @shopware/api-gen loadSchema --apiType=store --filename=storeApiSchema.json
# load schema from admin API
pnpx @shopware/api-gen loadSchema --apiType=admin --filename=adminApiSchema.jsonRemember to add .env file in order to authenticate with Shopware instance.
OPENAPI_JSON_URL="https://your-shop-instance.shopware.store"
OPENAPI_ACCESS_KEY="YOUR_STORE_API_ACCESS_KEY"
SHOPWARE_ADMIN_USERNAME="my@username.com"
SHOPWARE_ADMIN_PASSWORD="my-password"Changelog
Full changelog for stable version is available here
Latest changes: 0.0.0-canary-20240319163650
Minor Changes
#534
6170dcaThanks @patzick! -loadSchemacommand added by splittinggeneratecommand#534
6170dcaThanks @patzick! - Sortingpathsin the same order by api patchs#534
6170dcaThanks @patzick! - Commandgeneratehas been splitted and doing only transformation from json to d.ts file#564
93a6048Thanks @patzick! - AddedapiTypeoption inloadSchemacommand. WithSHOPWARE_ADMIN_USERNAMEandSHOPWARE_ADMIN_PASSWORDenv variables we can now authorize Admin API schema.example:
# load schema from store API pnpx @shopware/api-gen loadSchema --apiType=store --filename=storeApiSchema.json # load schema from admin API pnpx @shopware/api-gen loadSchema --apiType=admin --filename=adminApiSchema.json
#534
6170dcaThanks @patzick! - Schemaoperationsis now a generic type to help with overriding types