-
Notifications
You must be signed in to change notification settings - Fork 65
Add identifier syntax #296
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
base: persisted-documents
Are you sure you want to change the base?
Changes from 3 commits
e357f4c
daa0bec
81fa529
bba578d
3fbc34c
5d48e0e
014506d
eeab3f3
dda338e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,6 +95,35 @@ implementation specific. | |
Note: A 32 character hexadecimal _custom document identifier_ is likely to be an | ||
MD5 hash of the GraphQL document, as traditionally used by Relay. | ||
|
||
### Document identifier syntax | ||
|
||
DocumentIdentifier :: | ||
|
||
- PrefixedDocumentIdentifier | ||
- CustomDocumentIdentifier | ||
|
||
PrefixedDocumentIdentifier :: | ||
|
||
- Sha256HexDocumentIdentifier | ||
- OtherPrefixedDocumentIdentifier | ||
|
||
Sha256HexDocumentIdentifier : `sha256:` Sha256Checksum | ||
|
||
Sha256Checksum :: 64 LowerCaseHexDigit | ||
martinbonnin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
LowerCaseHexDigit :: one of | ||
|
||
- `0` `1` `2` `3` `4` `5` `6` `7` `8` `9` | ||
- `a` `b` `c` `d` `e` `f` | ||
|
||
OtherPrefixedDocumentIdentifier :: `x-` IdentifierCharacter+ `:` IdentifierCharacter+ | ||
|
||
CustomDocumentIdentifier :: SourceCharacter+ | ||
|
||
IdentifierCharacter :: SourceCharacter but not `:` | ||
|
||
SourceCharacter :: Any Unicode scalar value | ||
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 incredibly broad; I know that's effectively what we have currently but I feel like we should lock it down a bit. 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. While we could allow all Unicode characters, the main spec defines a specific set of characters for use in that document. Something similar could be done here. SourceCharacter On a side note, the spec is defining these characters as UTF-16 codes, not Unicode code points. I’m fine with allowing any Unicode character in this context, or any non control character would be fine too. 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. I had only alphanumericals initially and then backtracked to "any unicode" because "why not". But I think your point about having the identifier in url path is the important one. I'll move to alphanumerical + a bunch of unreserved chars like you did here. Questions:
Edit: updated in 5d48e0e 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. I strongly recommend a wide range of characters. URLs can escape any Unicode character so there need be no limit on what characters can be used for document ids. Also, url paths are by definition case sensitive; but they may be treated with no case sensitivity. For instance, if the document id was a guid it would need dashes. If it was base64 it would need lowercase and uppercase and a couple extra characters. If it was readable names, it would need to support Unicode for foreign languages. And a custom implementation may decide to treat the document id with no case sensitivity. 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.
Excellent point.
Another excellent point.
I think I disagree on this one. I don't really see anyone using readable names as identifiers? Sounds like a footgun to me that if we can, we should discourage. Just like the relay cursors are encouraged to be opaque, I would encourage the document ids to be similarly opaque. Tangential: I have a GraphQL-over-HTTP meeting in my calendar on Thursday. Is that still happening? Want to discuss over there? 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. Good catch @Shane32; 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.
I think we can change the spec text to that without making existing Looks like 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.
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. Spec for URLSearchParams:
So 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. It is, yeah. Actually I remember I deliberately chose a character outside of GitHub renders the URLs okay:
|
||
|
||
## Persisting a Document | ||
|
||
To utilize persisted documents for a request, the client must possess a unique | ||
|
Uh oh!
There was an error while loading. Please reload this page.