Giter Site home page Giter Site logo

ozonophore / openapi-codegen Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 1.0 671 KB

A simple library that generates TS-interface models from openapi specification

License: MIT License

JavaScript 11.18% TypeScript 74.57% Handlebars 13.14% HTML 0.66% CSS 0.46%

openapi-codegen's People

Contributors

ozonophore avatar pidtchay avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

pidtchay

openapi-codegen's Issues

Models are incorrectly generated if the path B to the specification in the Ref parameter is indicated using "../".

If the specification specifies the refine in this way $ref: ../openapi_example/viewExampleDto.yml. Then the generation of models occurs in another directory above.
This violates the integrity of the structure of the generated directory and models.

The problem is still relevant. It's not enough to remove the jump to the directory above. The issue has been identified in model paths, model imports, and schema imports.

Enum with value

According to specification, an enum can contain only name, values are situated in a description.
Example:

schema:
type: string
enum: [asc, desc]
description: >
Sort order:
* asc - Ascending, from A to Z
* desc - Descending, from Z to A

Add cancelable concept

Need to add cancelable concept. This will allow you to correctly cancel requests and handle further scripts.

Generate and export path & method for operation

Generated paths can be useful for stabbing in tests
Example

interface IConfig {
    path: string;
    method: 'post' | 'delete' | 'get'
}

export const serviceConfig = (baseUrl: string): IConfig => {
    return {
        getUser: {
            path: `${baseUrl}/users`,
            method: 'get',
        }
        getUsersById: {
            path: `${baseUrl}/users/:id`,
            method: 'get',
        },
    }
};

in test:

const config = getServiceConfig('rest/v1');

const configForGetUser = config['getUser'];
export const handler = rest[configForGetUser.method](configForGetUser.users, (_, res, ctx) => {
    return res(ctx.status(200));
})

Add support Date-type

Describe the solution you'd like
A clear and concise description of what you want to happen. Ideally with a small example of the proposed changes.

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.