question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for extensions

See original GitHub issue

Is your feature request related to a problem? Please describe.

Type extensions are part of the specification, and should therefore be supported. Type extensions, according to the linked spec, can be of the following types:

  • ScalarTypeExtension (extend scalar X)
  • ObjectTypeExtension (extend type X)
  • InterfaceTypeExtension (extend interface X)
  • UnionTypeExtension (extend union X)
  • EnumTypeExtension (extend enum X)
  • InputObjectTypeExtension (extend input X)

Describe the solution you’d like

When defining type extensions in the SDL schema, they should be taken into account and “merged” with the extended type so that the code generation matches the actual schema.

We could (should?) also provide an option (generateExtensionFieldsResolvers?) to consider all fields from Object Type Extensions as fields with resolvers, because it is likely that these fields require a special resolver implementation with a service call. (Should it be true by default? Maybe not.)

If we do this, maybe we should add a new option to do the opposite of fieldsWithResolvers, like fieldsWithoutResolvers, blacklisting some fields so that they are part of the generated POJO instead of being generated as part of the resolver interface. The reason why I think we should do this is because if the user decides to generate resolvers for most fields that are part of extensions, but not all, it would be painful to list all of them in fieldsWithResolvers. Instead, we should allow declaring generateExtensionFieldsResolvers to handle the general case, and add some exceptions via fieldsWithoutResolvers.

Describe alternatives you’ve considered

The alternative (current situation) is to force the user to declare all their types in the same schema, which is not ideal and sometimes impossible (in case of remote schema using federation).

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
kobylynskyicommented, Apr 20, 2020

Thanks for your feature request. Current implementation of the library is not supporting extensions. I will work on this soon.

3reactions
Lukas-Kullmanncommented, Apr 20, 2020

I ran into the same issue today when I wanted to extend an enum type. So when implementing this, it would be super nice if all type extensions would be supported.

  • extend scalar X
  • extend type X
  • extend interface X
  • extend union X
  • extend enum X
  • extend input X

I just wanted to mention this since the issue description suggests that there is only extend type X.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Install and manage extensions - Chrome Web Store Help
Install an extension · Open the Chrome Web Store. · Find and select the extension you want. · Click Add to Chrome. ·...
Read more >
How to Add Extensions to Chrome or Remove Them
1. Open Chrome and then navigate to the Chrome web store. · 2. Search or browse for the extension you want to add...
Read more >
How to add or install Chrome extensions - Brave Browser
Open Google Chrome, and click Chrome in the top toolbar of your computer. Click About Chrome. Click Extensions. This will open a new...
Read more >
Chrome Extensions getting started guides
We hope the new Getting Started guides help you feel confident and supported as you embark on your extension development journey. Updated on ......
Read more >
Chrome Web Store
You can add new features to Chrome by installing extensions. Visit the Chrome Web Store on your desktop computer to discover hundreds of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found