// This file was generated from JSON Schema using quicktype, do not modify it directly.
// To parse and unparse this JSON data, add this code to your project and do:
//
// query, err := UnmarshalQuery(bytes)
// bytes, err = query.Marshal()
package main
import "encoding/json"
func UnmarshalQuery(data []byte) (Query, error) {
var r Query
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Query) Marshal() ([]byte, error) {
return json.Marshal(r)
}
type Query struct {
Data *Data `json:"data"`
Errors []Error `json:"errors"`
}
type Data struct {
Entry *EntryResponse `json:"entry"`
}
type EntryResponse struct {
NonNullable string `json:"non_nullable"`
Nullable string `json:"nullable"`
}
type Error struct {
Message string `json:"message"`
}
What I did
Generated Go code from graphQL schema and query, using quicktype:
What I expected
Nullable GraphQL fields to be nullable in the generated Go code.
What happened
Nullable scalars get defined as non-nullable in the Go code.
Source files
Output
Expected output