Description
Using this cannonical json file
https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v2.0/json/petstore.json
The code generation fails
I suspect because the base service specification is mandatory - it's probably my own fault -
but I need some sample base service so that this code generation succeeds.
./generate.sh
yarn run v1.17.3
$ openapi-typescript-client-api-generator -c petstore.json -sb /client/services -s /client/api/services -m /client/api/models -sm /server/modules/api/models
InStage client api generator
Loading config file...
Config file with version 2.0 found.
Running converter...
Converted.
Augmenting config with server models...
Loaded 0 server models.
Added 0 server models to the configuration.
Config file loaded.
Loading api info...
Done.
Loading models...
Loaded 3 models.
Generating model files...
Generated 3 model files.
Loading request bodies...
Loaded 0 request bodies.
Generating request body files...
Generated 0 request body files.
(node:40147) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'map' of undefined
at servicesLoader (/Users/admin/Documents/8secondz-workspace/8secondz-axios/node_modules/@progresso/openapi-typescript-client-api-generator/loaders/servicesLoader.js:5:30)
at generate (/Users/admin/Documents/8secondz-workspace/8secondz-axios/node_modules/@progresso/openapi-typescript-client-api-generator/index.js:48:22)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:40147) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:40147) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
✨ Done in 0.22s.
N.B. there are some models spat out successfully.
/**
* Swagger Petstore 1.0.0 (OpenAPI: 3.0.0)
*
*
* NOTE: This class is auto generated by openapi-typescript-client-api-generator.
* Do not edit the file manually.
*/
export class Pet {
public id: number;
public name: string;
public tag: string;
/**
* Creates a Pet.
*
* @param {number} id
* @param {string} name
* @param {string} tag
*/
constructor(id: number, name: string, tag: string) {
this.id = id;
this.name = name;
this.tag = tag;
}
}