Skip to content

Improvements to the generated READMEs #1

@ms14981

Description

@ms14981

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);
});
  1. 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?
  2. Can we include an example status to put into api.findPetsByStatus?
  3. 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions