Skip to content
This repository was archived by the owner on Feb 6, 2025. It is now read-only.

Add a function that computes the fingerprint of a schema #737

Merged
merged 17 commits into from
Jan 27, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion graphql_compiler/schema/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,12 +454,15 @@ def check_for_nondefault_directive_names(directives):


def compute_schema_fingerprint(schema: GraphQLSchema) -> str:
"""Compute a fingerprint compactly representing all the data in the given schema.
"""Compute a fingerprint compactly representing the data in the given schema.

The fingerprint is not sensitive to things like type or field order. This function is guaranteed
to be robust enough that if two GraphQLSchema have the same fingerprint, then they also
represent the same schema.

The fingerprint may not include information about directives at field definitions.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is way too specific. There are probably half a dozen other kinds of things that are also not covered (e.g. directives on types, on scalars, on extensions) and yet are not mentioned. Let's not actively mislead people by listing only one of the many caveats present here.

I'd keep it more vague and say that this fingerprint is done on a best-effort basis and has some known issues at the moment, and direct people to the discussion in this PR for more details.

See https://github.com/graphql/graphql-js/issues/2389 for more information.

Args:
schema: the schema to use.

Expand Down
Loading