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

Add GraphQL field extension with field resolver function #22

Merged
merged 1 commit into from
Mar 6, 2024

Conversation

wKich
Copy link
Member

@wKich wKich commented Feb 29, 2024

Motivation

In Backstage GraphQL plugin we query Catalog API to get entities that matched to specific filter, then we have to resolve each entity to GraphQL Node, but in our fields' resolvers we call data loader to fetch entity (again) and get field's value. We could improve and get rid of unnecessary getEntitiesByRefs call if we are able resolve fields right away.

Approach

Utilize GraphQL Extensions to store field's resolver, that accepts { id, entity } node's id and source object and returns needed field's value

Copy link
Member

@taras taras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a nice simplification

@wKich wKich merged commit 9456142 into main Mar 6, 2024
2 checks passed
@wKich wKich deleted the dl/field-extension branch March 6, 2024 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants