Skip to content

Make _add_sharable_to_page_info_type idempotent - #31

Open
tsauerwein wants to merge 1 commit into
graphql-python:mainfrom
tsauerwein:fix-pageinfo-sharable
Open

tsauerwein wants to merge 1 commit into
graphql-python:mainfrom
tsauerwein:fix-pageinfo-sharable

Conversation

@tsauerwein

Copy link
Copy Markdown

When we tried to build our schema with graphene_federation.build_schema, an error would be raised:

graphene_directives.exceptions.DirectiveValidationError: @shareable is got duplicate values {}, at: PageInfo

It turns out that if _add_sharable_to_page_info_type is called a second time, it would fail because the @sharable directive had already been added to the PageInfo type.

This PR suggests to first check if the directive has already been added to PageInfo.

So far, `build_schema` would raise an error if it was called
multiple times with a schema using PageInfo, because it tried
to add the `@sharable` directive multiple times to PageInfo.
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.

1 participant