Closed bendvc closed 4 years ago
NICE!! Would it make sense to add the generation process to README?
The process to regenerate isn't THAT straight forward. So I'd like to avoid that for now. I don't think there is going to be much work on this project in the future. But we we do decide to put more effort into it, then yes that is a good idea. (Note: I don't think salesforce themselves are going to be coming out with too many new versions of ocapi as their are going to be using their new offering)
Description
This PR regenerates the client based on the latest release of Salesforce's OCAPI swagger definition (version 20.4). In an attempt to make this process more palatable for future version bumps, I have made changes to linking rules and compilation tools so we don't have to manually intervene in the future as much.
JIRA: WEB-2759
Changes
swagger.json
file.transform-class-properties
babel plugin to handle class properties (that is how the api's and models are generated, in the past we manually move those properties into the constructors)transform-class-properties
General Approach to Doing Upgrade
swagger-codegen
generate a new client with the following command 👉swagger-codegen generate -c conf.json -i swagger.json -l javascript --model-package models -o new
new/src/models
folder and overwrite the existing ones.new/src/api
folder. Also bring over the newindex.js
file and make sure that you update the named export to be the default export.npm run copyright:fix
npm run lint:fix
You'll have to manually fix some errors mentioned above.npm run docs
How to test this PR?
npm ci
npm run test
// All tests should passAlternatively you can run the Scaffold by first:
npm run lerna -- add commercecloud-ocapi-client@0.1.13-release-candidate.0 --scope=@mobify/commerce-integrations
MOBIFY_CONNECTOR_NAME=sfcc npm run start
TODO
0.1.12
as the package bumping happens when merging into master.