Skip to content

Custom Functions: Can't use _ in identifiers #5641

@ardan-bkennedy

Description

@ardan-bkennedy

What version of Dgraph are you using?

master

Have you tried reproducing the issue with the latest release?

Only on master

What is the hardware spec (RAM, OS)?

Mac with latest OS

Steps to reproduce the issue (command/config used to run Dgraph).

I have to define function parameters and field names in the body like this.

type Query{
	uploadFeed(countryCode: String!, cityName: String!, lat: Float!, lng: Float!): UploadFeedResponse @custom(http:{
		url: "{{.UploadFeedURL}}",
		method: "POST",
		body: "{countrycode: $countryCode, cityname: $cityName, lat: $lat, lng: $lng}"
	})
}

If I attempt to use an underscore _ I get an error. As an example, renamingcountryCode to country_code:

type Query{
	uploadFeed(country_code: String!, cityName: String!, lat: Float!, lng: Float!): UploadFeedResponse @custom(http:{
		url: "{{.UploadFeedURL}}",
		method: "POST",
		body: "{countrycode: $countryCode, cityname: $cityName, lat: $lat, lng: $lng}"
	})
}

I get this error.

Type Query; Field uploadFeed; body template inside @custom directive could not be parsed.

This would also happen if I use underscores for fields in the body document.

Expected behaviour and actual result.

I expect I can use JSON proper variable naming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/graphqlIssues related to GraphQL support on Dgraph.kind/bugSomething is broken.status/acceptedWe accept to investigate/work on it.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions