Skip to content

Separate pointers to the same schema generate duplicate types #142

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

Closed
xavdid opened this issue Jan 30, 2018 · 2 comments
Closed

Separate pointers to the same schema generate duplicate types #142

xavdid opened this issue Jan 30, 2018 · 2 comments

Comments

@xavdid
Copy link

xavdid commented Jan 30, 2018

Hello! I was working through our (seeming non-standard) case and I found an unexpected result.

We've got a TriggerSchema and a CreateSchema that both have a reference to the BasicDisplaySchema. When we generate the types, we end up with a lot of identical BasicDisplaySchema interfaces (BasicDisplaySchema, BasicDisplaySchema1, etc).

The declaration of the schemas is identical except for the description:

Trigger (source):

      display: {
        description: 'Configures the UI for this trigger.',
        $ref: BasicDisplaySchema.id
      },

Create (source):

      display: {
        description: 'Configures the UI for this create.',
        $ref: BasicDisplaySchema.id
      },

Since these are both references to the same schema, despite their different description, it would make sense for them to generate a single, canonical BasicDisplaySchema. It's totally possible that this is by design, but if it's either something we can fix (or make configurable), that would be awesome! I can post the full schema or any other resources if that's helpful.

Thanks a bunch!

@bcherny
Copy link
Owner

bcherny commented Jan 30, 2018

Hi @xavdid! Thanks for the suggestion. This is already tracked in #132 (and enhanced in #119). If you'd like to take a shot at fixing this, PRs are welcome!

@bcherny bcherny closed this as completed Jan 30, 2018
@xavdid
Copy link
Author

xavdid commented Jan 30, 2018

Ah, perfect! I'll look through those and see if I can't get something rolling. Though, it being against spec certainly puts a damper on it. I've got a lot of control over the source json though, so I can probably adapt it to be compliant.

Thanks a bunch for your patience here!

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

2 participants