Skip to content

Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "database/sql.NullString" does not #273

@siddiquebagwan

Description

@siddiquebagwan

Hi, Graphql-go

Great library.
I found one issue.
Please find the detail of issue.

In my graphql object I have following fields

"SenderID": &graphql.Field{
       Type:        graphql.NewScalar(graphql.ScalarConfig{Name: "database/sql.NullString"}),
	Description: "The Senderid of the Address.",
},

Here Name field has / and . because my SenderID is of type database/sql.NullString and hence
At the time of creating Schema I am getting below error

ERROR: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "database/sql.NullString" does not

graphql/definiation.go at line number 1333 has regx

var NameRegExp, _ = regexp.Compile("^[_a-zA-Z][_a-zA-Z0-9]*$")

As per this regx database/sql.NullString is not valid name. I updated this regx to ^[_a-zA-Z][_a-zA-Z0-9./]*$ and issue get resolved, I am able to perform query operation.

Could you please incorporate this fix,

Note: model is auto generated using xo and graphql objects are auto generated from model using graphql-go-generate

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions