Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polymorphism issue #36

Open
olivierodo opened this issue Aug 17, 2017 · 4 comments
Open

Polymorphism issue #36

olivierodo opened this issue Aug 17, 2017 · 4 comments

Comments

@olivierodo
Copy link

olivierodo commented Aug 17, 2017

Hi,
On my swagger file i use the property allOf to do Polymorphism (see : https://swagger.io/specification/#models-with-composition-108) in one of my definition.

Here a sample:

Payment:
  title: Payment
  description: Payment transaction
  allOf:
    - $ref: '#/NewPayment'
    - type: object
      required:
        - paymentId
      properties:
        paymentId:
          type: number
          example: 42
          description: The unique identifier of a payment transaction on the system

I believe that the case is not managed i got an error

[Error: Cannot build primitive type "undefined"]

its working fine when i remove it.

BTW, Amazing project/idea !

@yarax
Copy link
Owner

yarax commented Aug 20, 2017

Right, it's not implemented, but a good feature request. Will consider it in the next version, thanks!

@LGLC
Copy link

LGLC commented Dec 20, 2017

I forked the repo and had a little go at this here: https://github.com/yarax/swagger-to-graphql/pull/41/files

Note that I actually copied in the current published npm version and overwrote the master version, so there are other items in the diff. The main functionality is just the changes in the swagger.js file and the isObjectType function within typeMap.js.

@ehmicky
Copy link

ehmicky commented Apr 17, 2018

I think the discriminator property might be involved in this as well. See #61

@marturi
Copy link

marturi commented Nov 1, 2019

Hi @yarax - what is the status of this feature request? Looks like @LGLC's PR was a good solution before the TS rewrite. Would it be difficult to implement that same logic in TS?

newbeb pushed a commit to newbeb/swagger-to-graphql that referenced this issue Apr 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants