-
Notifications
You must be signed in to change notification settings - Fork 42
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
@bsRecord's record being wrong isn't reported properly in bsb's output #42
Comments
@justgage try to run the bsb command separately in the terminal. Reason-scripts is eating the error report. And from the information available, there is nothing wrong with the ppx, it’s working as intended. The graphql query result is a string ==> this has type string. But somewhere wanted ==> your record type |
What's the type signature for the |
@thangngoc89 I would say it's still not very clear: @mhallin The Maybe the real thing that's making this output unclear is the error pretty printer? |
Ah, sorry for the irrelevant question. I see the problem now, and yes that's a bug in the record decoder, I suppose. Thanks for reporting this! |
No problem @mhallin! |
Having the same issue on a much more basic level: Data.re type total = {
month: string,
amount: int,
};
type account = {
id: int,
name: string,
overdraft: int,
totals: array(total),
};
type accounts = array(account); App.re open Data;
module GetAccounts = [%graphql {|
query FetchAccounts {
accounts @bsRecord {
id
name
overdraft
totals {
month
amount
}
}
}
|}]; With this schema: type Total {
month: String!
amount: Int!
}
type Account {
id: ID!
name: String!
overdraft: Int!
balance: Int!
savings: Int
expenditures: [Expenditure!]!
totals: [Total!]!
}
type Query {
accounts: [Account!]!
} Gets me this:
Is this the correct way to type an array of records? Or do I need to type all existing fields in the record type and not just the ones I use in the query? UPDATE: This solved it, seems nested types need to be hinted explicitely? module GetAccounts = [%graphql {|
query FetchAccounts {
accounts @bsRecord {
id
name
overdraft
- totals {
+ totals @bsRecord {
month
amount
}
}
}
|}]; |
Yeah, every subselection will need an Another issue with your data model is that the |
The original issue - incorrect source location for record fields - is fixed in version 0.2.8. |
For instance this name should be a string, not an int
record:
graphql string
How bsb reports it:
It doesn't even tell me what file it's in, let alone the line number :/.
The text was updated successfully, but these errors were encountered: