Coder Social home page Coder Social logo

Comments (14)

bondars95 avatar bondars95 commented on June 2, 2024 1

@mrlubos sure, I've create test stand for you, just clone repo and follow instructions

https://github.com/bondars95/typescript-codegen-issue

from openapi-typescript-codegen.

bondars1995 avatar bondars1995 commented on June 2, 2024

Hello Guys,
@ferdikoomen could you please have a look?

from openapi-typescript-codegen.

mrlubos avatar mrlubos commented on June 2, 2024

@bondars1995 are you able to create a failing test case?

from openapi-typescript-codegen.

mrlubos avatar mrlubos commented on June 2, 2024

@bondars95 thanks! How do you generate that OpenAPI spec? I am trying to understand what kind of types generate that output

from openapi-typescript-codegen.

bondars95 avatar bondars95 commented on June 2, 2024

@mrlubos as mentioned in package.json
npx openapi-typescript-codegen --input spec.yaml --output ./generated --exportServices=false --exportCore=false

from openapi-typescript-codegen.

bondars95 avatar bondars95 commented on June 2, 2024

@mrlubos and error is coming when compiling generated files with typescript
tsc generated/index.ts

from openapi-typescript-codegen.

bondars95 avatar bondars95 commented on June 2, 2024

@mrlubos did you have any chance to have a look into it?

from openapi-typescript-codegen.

mrlubos avatar mrlubos commented on June 2, 2024

@bondars95 not yet, because it's not clear to me:

  • what's the expected result based on the OpenAPI spec provided
  • how you're able to generate that OpenAPI spec in your backend language (which tooling do you use?)

from openapi-typescript-codegen.

bondars95 avatar bondars95 commented on June 2, 2024

@mrlubos openapi spec created manually
just wondering why it is causing issues with typescript generated types, maybe smth can be changed in typescript generation

from openapi-typescript-codegen.

mrlubos avatar mrlubos commented on June 2, 2024

@bondars95 did it work on any of the previous versions? What result would you expect?

from openapi-typescript-codegen.

bondars95 avatar bondars95 commented on June 2, 2024

@mrlubos I didn't check, but I suppose I will get same error, just wanted to check if it can be fixed somehow from your side.

from openapi-typescript-codegen.

mrlubos avatar mrlubos commented on June 2, 2024

@bondars95 please refer to my earlier messages

from openapi-typescript-codegen.

bondars95 avatar bondars95 commented on June 2, 2024

@mrlubos I've got your point here, we need type descriminator for generating java classes
oneOf is used just for correct displaying on UI in swagger
when using both discriminator and oneOf it breaks typescript generation
Any way I can tell openapi-typescript-codegen to omit generating part related to discriminators? Or to ignore one of them if both discrimator and oneOf is present?
Cause using both discriminate and one of cause circular reference for typescript

from openapi-typescript-codegen.

bondars95 avatar bondars95 commented on June 2, 2024

@mrlubos in my case let's say expected behaviour would be having PaymentMethod generated without having reference to CardPaymentMethod not to cause circular reference

/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type PaymentMethod = ({
    type: string;
});

it obviously can be achieved by removing discrimantor, but this causes other issues

from openapi-typescript-codegen.

Related Issues (20)

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.