graphql-go / graphql-go/graphql

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

Open
#273 2 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Go
Stars
10.1k
Forks
845
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.