question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problems when using generated input types from Hasura backend

See original GitHub issue

I’m facing several issues trying to execute mutation on a F# backend towards Hasura, sending instances of the generated input types, such as

type Example_insert_input =
    { AnotherType: Option<AnotherType_obj_rel_insert_input>
      anotherType: Option<string>
      id: Option<string>
    }

When using default serializer Newtonsoft.Json, it throws an exception A member with the name 'anotherType' already exists on 'KrevS2Graphql.SkillModelVersion_insert_input'. Use the JsonPropertyAttribute to specify another name.

When using System.Text.Json (“system”) serializer, Hasura return an error due to a mismatch between discriminated union names. Upon further investigation, this is caused by the fact that the CompiledName attributed is not respected. Next step is to set “normalizeEnumCases” to false. This solves the previous issues, but another error is given back by Hasura: expected an object for type 'Example_bool_exp', but found null. So, it looks like properties set to None on the various types generated by Snowflaqe are not serialized in a way that Hasura correctly receive them - I think those properties should be excluded, instead of defined with a null value.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
gmlioncommented, Dec 2, 2022

It is now working, thank you very much!

0reactions
Zaid-Ajajcommented, Dec 2, 2022

@gmlion thanks for confirming 🙏 glad to hear it is working for you

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support for generating types from Hasura · Issue #344
I used to do this automatically with https://graphql-code-generator.com/. It can even generate ready to use React hooks for you (Apollo or Urql) ...
Read more >
Top GraphQL Errors and How to fix them
Identifying error types will help quickly fix them. Clients can encounter these types of errors while communicating with the GraphQL server.
Read more >
Postgres: Supported Types | Hasura GraphQL Docs
When using a numeric value in an Action, the value is coerced to its expected scalar type based on type of the input...
Read more >
Build a GraphQL backend for an application
However, Hasura provides a solution to this problem by delivering a GraphQL backend instantly, and with a few simple steps. ... You've just...
Read more >
A Comprehensive Guide to GraphQL with Hasura
A schema is defined with fields mapped to types and serves as a contract between the client and the server. The schema contract...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found