@brizy/sylius-sdk
v1.2.12
Published
## Development
Downloads
69
Keywords
Readme
BrizyCloud Sylius SDK
Development
Pre requests
You need to use the [email protected]:GheorgheP/openapi-typescript-codegen.git version of
openapi-typescript-codegen. This is due to the fact that original package doesn't supportld+json. For this you need to clone openapi-typescript-codegen and link withbrizy-cloud-sylius-js-sdkusingnpm linkAlso make sur to replace everywhere from
application/jsontoapplication/ld+json
Code generator
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 inJSONformat.
E.g.APP_API_ENDPOINT=https://my-sylius.com/api/v2/docs.json npm run generate.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,
})