Generate PropTypes from openAPI 3, Swagger 2 in JSON or YAML schemas
From your terminal, provide a source file in openAPI 3 or Swagger 2 in JSON or YAML format and a destination file where you would like your generated prop-types to be saved:
index.js ./examples/openapi.json ./examples/proptypes-openapi.jsor
index.js ./examples/openapi.yaml ./examples/proptypes-openapi.jsor for Swagger 2:
index.js ./examples/swagger.json ./examples/proptypes-swagger.jsAdding optional 3rd parameter - schemaToParse
index.js ./examples/openapi.yaml ./proptypes.js datamodelswill generate PropTypes only from given schema (if exists in source file, else it will generate all found schemas).
Alternatively you can also set an npm script in your package.json:
{
"scripts": {
"generate": "index.js ./examples/openapi.json ./examples/proptypes.js"
}
}Then you can call it from your shell:
npm run generate- Use the proper node version, in this repo via NVM:
nvm use(Stick to LTS versions only) - Install the project:
npm ci
- Pass options through CLI
- Add tests
- Going UMD?
- Move to a template(s) based system instead of a string generation?