Taking the openapi-forge-typescript generator as an example, it creates a README.md with this:
import ApiPet from "./api";
import Configuration from "./configuration";
import { transport } from "./nodeFetch";
// import any model types you need
import { Order } from "./api/model";
const config = new Configuration(transport);
// set the base path for your endpoint
config.basePath = "https://example.com";
// set any environment specific configuration here
const api = new ApiPet(config);
api.findPetsByStatus(...).then((data) => {
// log the result
console.log(data);
});
- It sets the basePath to "https://example.com". One of our CLI arguments is https://petstore3.swagger.io/api/v3/openapi.json and the base path is https://petstore3.swagger.io. Is it possible to include this in the README.md template to save the user having to manually switch it out?
- Can we include an example status to put into api.findPetsByStatus?
- Can we generate an example command to run? e.g. generate an index.ts as well as a README.md and tell the user that they can run it with ts-node?
It's possible that all of this is overkill, and given that the user will need to edit the code anyway, perhaps this isn't worth it?
Taking the openapi-forge-typescript generator as an example, it creates a README.md with this:
It's possible that all of this is overkill, and given that the user will need to edit the code anyway, perhaps this isn't worth it?