Git Product home page Git Product logo

swagger-typescript-client-generator's People

Contributors

dependabot[bot] avatar psrebniak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

swagger-typescript-client-generator's Issues

Allow fetch configuration on every call

Allow to overwrite or extend configuration on every fetch call from constructor configuration

const myconfiguration = {}
const client = new MyApiClient({}, requestFactory)
client.getTest(1, myconfiguration)

Move to lerna and yarn workspaces

Migrate to yarn workspaces and lerna to make exposing additional packages easy
Packages to do:

  • runtime - with commonly used interfaces
  • whatwg-fetch - with default whatwg-fetch implementation

Add support for "allOf" keyword

eg. for excerpt from attachment I'd expect these generated models:
export type BasicMessage = { preheader: string; subject: string; }

export type Message = { preheader: string; subject: string; id: number; }
example.zip

Support OpenAPI 3.0

Hello.

Your tool is really good, moreover it's basically the only tool that allows to generate typescript interface from swagger.json. But I'd like to migrate to OpenAPI 3.0. Unfortunately the tool currently doesn't understand its format and generate everything as any.

Would you mind to support that too? I wrote a small generator myself, so it works that way:

function getSwaggerVersion(schema: any): SwaggerVersion {
    if (schema.swagger) {
        return SwaggerVersion.V2;
    }
    if (schema.openapi) {
        return SwaggerVersion.V3;
    }
    return SwaggerVersion.Unknown;
}

function getDefinitions(schema: any, swaggerVersion: SwaggerVersion): any {
    switch (swaggerVersion) {
        case SwaggerVersion.V2:
            return schema.definitions;
        case SwaggerVersion.V3:
            return schema.components.schemas;
        default:
            throw Error('Unsupported swagger schema');
    }
}

So you probably could implement it this way and dynamically determine which schema it is and generate for both v2 and v3 schemas.

Response type

Hi,

Thanks for providing this generator, it's great!

However, I have one small issue. It assumes global Response type, which comes from browser Fetch API and which doesn't exist in node.js applications.

I think it would be better to allow generic response type. That way we can use any request factory we like, not necessarily implementing the browser Fetch API Response.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.