Converts components and definitions to interfaces with quicktype
npm install ymlapi-interfacesRead a swagger/openapi/asyncapi yml file, extract the models, generate interfaces from them and then write to disk.
> Currently only support typescript interfaces as this is all i need for now, but a PR for others is more than welcome.
- The output directory will be created if it was not already there.
- The output directory will be emptied before parsing the yml file.
- The tool dereferences the input via json-schema-ref-parser.
- Parses the yml to native js object via yamljs.
- Checks the input file is a valid type (swagger/openapi/asyncapi).
- Checks the input file has either definitions or component/schemas.
- The tool will copy out each model 1 at a time and convert to typescript interfaces, PascalCase, to the output directory.
- The tool uses quicktype to generate the interfaces.
ymlapi-interfaces -i relative/path/to/file.yml -o realtive/path/to/output/directory
``