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

GraphQL Schema Not support <> using @dgraph(pred: "<other language>") #5296

Closed
zhaolin-st opened this issue Apr 26, 2020 · 7 comments · Fixed by #5526
Closed

GraphQL Schema Not support <> using @dgraph(pred: "<other language>") #5296

zhaolin-st opened this issue Apr 26, 2020 · 7 comments · Fixed by #5526
Labels
area/graphql Issues related to GraphQL support on Dgraph. kind/question Something requiring a response. status/accepted We accept to investigate/work on it.

Comments

@zhaolin-st
Copy link

type Call {
    from: phone_number @hasInverse(field: calling) @dgraph(pred: "<FROM>")
    to: phone_number @hasInverse(field:called) 
}

Using graphql to update schema with @dgarph would not work while muation
image
Dgraph Schema would generate a "" predicate ,but there should not be "<>" in real schema data
image

image

@MichelDiz
Copy link
Contributor

Angular brackets are exclusive for GraphQL+-, there's no support in GraphQL Specs tho. So don't use <> in your GraphQL schema.

Cheers.

@MichelDiz MichelDiz added area/graphql Issues related to GraphQL support on Dgraph. kind/question Something requiring a response. labels Apr 26, 2020
@zhaolin-st
Copy link
Author

Angular brackets are exclusive for GraphQL+-, there's no support in GraphQL Specs tho. So don't use <> in your GraphQL schema.

Cheers.

@draph(pred: "***") dont't support other language if don't use "<>"

@MichelDiz
Copy link
Contributor

Sorry, but what do you mean by support other language? the edge is UID type. There's no language support for UID, only Strings.

@MichelDiz
Copy link
Contributor

MichelDiz commented Apr 26, 2020

Oh, you mean i18n in predicates. Not sure if GraphQL specs support i18n. I gonna check.

PS. You used the "FROM", you should use a nonlatin example to make it obvious.

@MichelDiz
Copy link
Contributor

I wasn't able to find anything about i18n predicates in https://spec.graphql.org/
I have found some examples with i18n in the data, not the predicate see https://codesandbox.io/s/graphql-i18n-demo-znxvd

@MichaelJCompton is there support for languages in predicates in GraphQL?

@zhaolin-st
Copy link
Author

zhaolin-st commented Apr 27, 2020

https://graphql.dgraph.io/docs/dgraph/
I show "@dgraph" in this page about "GraphQL on Existing Dgraph"

Dgraph also allows type and edge names that aren’t valid in GraphQL, so, often, you’ll need to expose valid GraphQL names. Dgraph admits special characters and even different languages (see here), while the GraphQL Spec requires that type and field (predicate) names are generated from /[_A-Za-z][_0-9A-Za-z]*/.

By default, Dgraph generates a new predicate for each field in a GraphQL type. The name of the generated predicate is composed of the type name followed by a dot . and ending with the field name. Therefore, two different types with fields of the same name will turn out to be different Dgraph predicates and can have different indexes.

Because GraphQL Spec requires that type and field (predicate) names are generated from /[_A-Za-z][_0-9A-Za-z]/.
Can I use @dgraph(pred: "
**") to save predicate and type in Dgraph with other language?

@MichaelJCompton
Copy link
Contributor

Hi,

This should work to allow you to map GraphQL compliant names down to names in other languages.

I'll arrange this to be looked at in our next sprint and we'll patch it for 20.03.2 and master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/graphql Issues related to GraphQL support on Dgraph. kind/question Something requiring a response. status/accepted We accept to investigate/work on it.
Development

Successfully merging a pull request may close this issue.

4 participants