-
-
You must be signed in to change notification settings - Fork 582
Argument "id" has invalid value 1. Expected type "ID", found 1. #16
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
Comments
I should probably clarify this in the docs. |
For others like me that don't know GraphQL well, this is what I think you mean:
Which gives:
Is there a way currently to query by the foo.id column? |
Yep, that's it. To get the raw query {
fooNodes {
nodes {
id
rowId
name
}
}
} How do you feel about this decision? Do you have an idea for a better solution? What do you think about the following: query {
fooNodes {
nodes {
id(global: false)
name
}
}
} |
I'm trying to figure out how to find foo where id = 1. I've tried a few things but no luck so far. I don't think I'm qualified to make recommendations about the global thing. Hopefully I will be soon :) |
I'll add a |
Ouch, that's a huge gotcha :) Good I had the idea of reporting a bug or seeing if someone already had. I was quite sure it was something special. |
Yeah, it would be great to be able to do:
I hope to submit a PR later today if I can figure it out. We'll see. |
@rattrayalex nice! I think the best implementation would be to add a new field, |
Interesting - why that approach? (I'm not advanced with GraphQL at this point) |
It's easier to specify in the type system. It's easy to have a single required argument, but you can't have in the type system one argument or another. So a signature like this:
Could accept any of the following: {
foo(id: "…")
foo(rowId: 2)
foo(id: "…", rowId: 2)
foo()
} But two functions with signatures:
Is a better description of what we want in the type system. Also, if you are interested in implementing this feature it should be a good first issue as I this was the initial implementation of |
Great, thanks! Hope to give it a shot soon. On Fri, Apr 29, 2016, 09:25 Caleb Meredith notifications@github.com wrote:
|
Looking at https://facebook.github.io/relay/docs/graphql-object-identification.html#content, I don't see a hard requirement that top-level fields provide a global id. That is, If For example: users(name: "Bob" companyId: 2) {
id
rowId
name
company {
rowId
name
employees {
name
}
}
} might return: {
"users": [
{
"id": "asdjfasdlkjfas=",
"rowId": 1,
"name": "Bob",
"company": {
"rowId": 2,
"name": "A Company of Bobs",
"employees": [
{ "name": "Bob" },
{ "name": "Bob" },
{ "name": "Robert" },
]
}
},
{
"id": "lkjljsdflsdkfj=",
"rowId": 2,
"name": "Bob",
"company": {
"rowId": 2,
"name": "A Company of Bobs",
"employees": [
{ "name": "Bob" },
{ "name": "Bob" },
{ "name": "Robert" },
]
}
}
]
} Note that the above does away with Does that make sense? Thoughts? (This suggestion is based on the idea that the purpose of fields like |
I have thought about adding a I also think a A field like |
I agree PostGraphQL should be ideal/useable for people not using Relay, I just happen to think that design choices made by Relay are helpful for everyone using GraphQL. If you really think (As a side note |
I agree; I certainly wouldn't want to get rid of them, but I do want to make them optional. In production, I'd generally prefer to use
That sounds great to me. I do like the idea of Again, I view This kind of exploration seems to me a primary goal of PostgraphQL, but you're the author so the goals are up to you 😉
I was referring to the top-level |
Whoops, forgot a few:
Is that important? I'm not sure how intentional that choice was, or how widespread its adoption may be.
Are global ID's for people, or machines? Primary keys are much more dev-friendly; if I have to base64 encode |
Well thought out points.
I'm really not super excited about copying all of I think the standard way PostGraphQL should return collectiond is by connections. It's not hard to work with after the initial learning bump and comes with great benefits.
The difficulty with a
I realize now that I may have been miscommunicating when only saying
Good point. That's why I want to see the In summary I'm +1 unique constraint fields and -1 a plain list field as while I do get the DX reasons, we'd just be duplicating logic and forcing devs to make a choice we already know the answer to. |
Well, as a user I'm bummed, but not going to cry 😸 it would be great to make clear, though, that this is primarily a Relay project in the README if that's the direction you want to take.
They're queried against if provided? I don't think Now, also having |
I’m going to close this since there hasn’t been a lot of activity. I’m super for fields that select using table unique indexes (so |
The |
Maybe I'm doing something wrong, I don't know GraphQL yet, but this is a simple way to reproduce what I'm seeing. I can't query a table by id.
The text was updated successfully, but these errors were encountered: