@brizy/sylius-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.2.12 • Public • Published

BrizyCloud Sylius SDK

Development

Pre requests

  • You need to use the git@github.com:GheorgheP/openapi-typescript-codegen.git version of openapi-typescript-codegen. This is due to the fact that original package doesn't support ld+json. For this you need to clone openapi-typescript-codegen and link with brizy-cloud-sylius-js-sdk using npm link

  • Also make sur to replace everywhere from application/json to application/ld+json

Code generator

  1. Code generator should be run using APP_API_ENDPOINT=[SYLIUS API ENDPOINT] npm run generate.
    APP_API_ENDPOINT - Sylius API endpoint to the docs. URL should end with .json, so the documentation with be generated in JSON format.
    E.g. APP_API_ENDPOINT=https://my-sylius.com/api/v2/docs.json npm run generate.

  2. Current code generator has some bugs when comes to generate parameters with union types:
    state: string | Array<string>. It will generate 2 parameters with same name but different types.
    E.g.:

public static async adminGetShipmentCollection({
    state,
    state,
    orderChannelCode,
    orderChannelCode,
    methodCode,
    methodCode,
    page = 1,
    itemsPerPage = 30,
}: {
    state?: string,
    state?: Array<string>,
    orderChannelCode?: string,
    orderChannelCode?: Array<string>,
    methodCode?: string,
    methodCode?: Array<string>,
    /** The collection page number **/
    page?: number,
    /** The number of items per page **/
    itemsPerPage?: number,
})

At the moment we need to fic this manually. The fix is very simple, we need to remove one of the duplicate.

!Important: When it comes to choose from string and Array<string>, you need to pick Array<string>.

Here is the correct fix:

public static async adminGetShipmentCollection({
    state,
    orderChannelCode,
    methodCode,
    page = 1,
    itemsPerPage = 30,
}: {
    state?: Array<string>,
    orderChannelCode?: Array<string>,
    methodCode?: Array<string>,
    /** The collection page number **/
    page?: number,
    /** The number of items per page **/
    itemsPerPage?: number,
})

Readme

Keywords

none

Package Sidebar

Install

npm i @brizy/sylius-sdk

Weekly Downloads

3

Version

1.2.12

License

ISC

Unpacked Size

1.07 MB

Total Files

1332

Last publish

Collaborators

  • nessunskill
  • redd97
  • lift46252
  • oleg-brizy
  • sergiu.bagrin
  • maxval
  • gheorghep