neo4j-graphql-js icon indicating copy to clipboard operation
neo4j-graphql-js copied to clipboard

Field Default Value

Open metarama opened this issue 7 years ago • 6 comments

The @defaultValue constraint as shown below is not yet supported.

type Story { name: String isPublished: Boolean @defaultValue(value: "false") }

Computed @defaultValue constraint will be very cool to see as in the example below.

type Story { name: String isPublished: Boolean @defaultValue(value: "false") createdAt: DateTime @defaultValue(value: @cypher(statement:"RETURN datetime()) }

metarama avatar Oct 07 '18 04:10 metarama

That would be relly awesome!!! I tried it by using third party directives but sadly they have no effect at all. Is there a reason why my directives might not work?

appinteractive avatar Oct 17 '18 15:10 appinteractive

@appinteractive - which third party directives were you trying? There's nothing specific to neo4j-graphql.js that would prevent directives from working as expected.

johnymontana avatar Nov 11 '18 01:11 johnymontana

Bump - very useful for common use cases - please implement <3

ulfgebhardt avatar May 30 '19 02:05 ulfgebhardt

Yes please

Joshfindit avatar Jul 09 '19 19:07 Joshfindit

Just @default: value or @default(value) is enough syntax, surely.

Also, I agree such a constraint would be a boon, but given that no such function exists in cypher let alone in the GraphQL spec, it's a bit unfair to say "it's not yet supported".

benjamin-rood avatar Jul 10 '19 05:07 benjamin-rood

https://github.com/neo4j-graphql/neo4j-graphql-js/issues/608

michaeldgraham avatar May 02 '21 04:05 michaeldgraham