This repository was archived by the owner on Feb 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 50
Add a function that computes the fingerprint of a schema #737
Merged
Merged
Changes from 3 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
8a573aa
Intermediate commit
df27019
Merge branch 'master' into add-hash-function
e2be6da
Add a function that computes a schema fingerprint
d15eceb
Nits
8eb8bb1
Fix copyright line
d1084b0
Address comments
d26220c
Add more tests
2d69aaf
Assert that schema does not contain extensions and add more tests
0219f0e
Remove assertion
f77269f
Update graphql_compiler/schema/__init__.py
pmantica10 7bface5
Specify that the fingerprint is a hexadecimal string
pmantica10 2d3a2cf
Nit
pmantica10 ff35b52
Address nits
2835a9f
Merge branch 'add-hash-function' of github.com:kensho-technologies/gr…
628e565
Address comments
47a7655
Address comments
424aa01
Merge branch 'master' of github.com:kensho-technologies/graphql-compi…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
pmantica1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.