Comments (15)
Not a bad idea, although I wouldn't say it's any more explicit than the current way of doing it. What if you wanted upserted
... then you have to apply two directives?
type Movie {
id: ID
upsertedAt: DateTime! @CreatedDate @LastModifiedDate
}
from graphql.
I think we need to consider the size and surface area of the library, if we introduce lots and lots of directives for each use case; how will that be to document & remember?
You can define a partial schema containing all the frameworks types (like e.g. DeleteInfo
) and directives, add it to your npm package the IDE will allow code completion and documentation for your types:
"""
some nice doc
"""
directive @CreatedDate on FIELD_DEFINITION
Additionally you can define where the user can place the directive.
Plus adding more directives restricts users in implementing there own.
come on...
but you can prefix all directives with neo4j
from graphql.
Just for your information @Andy2003, with this we're taking the direction:
directive @timestamp(operation: TimestampEvent! = UPSERT) on FIELD_DEFINITION
enum TimestampEvent{
CREATE,
UPDATE,
UPSERT
}
That would mean if someone wanted a general timestamp of the last update or creation, they just use @timestamp
. And then if someone wanted two separate create and update fields, they would have @timestamp(operation: CREATE)
and @timestamp(operation: UPDATE)
.
from graphql.
Where do you see each directive mentioned being applied? On the type definition? Or a field?
from graphql.
on the field
from graphql.
type Movie {
id: ID
createdAt: DateTime! @CreatedDate
updatedAt: DateTime! @LastModifiedDate
}
from graphql.
then you have to apply two directives?
Yes, this looks very familiar to me as a Java user :-)
from graphql.
Not a bad idea, although I wouldn't say it's any more explicit than the current way of doing it. What if you wanted
upserted
... then you have to apply two directives?type Movie { id: ID upsertedAt: DateTime! @CreatedDate @LastModifiedDate }
Personally not a fan of this at all, in my opinion would have to come up with a cleaner way of implementing this.
from graphql.
One could argue just make a @Upserted
directive and jobs a gooden. I think we need to consider the size and surface area of the library, if we introduce lots and lots of directives for each use case; how will that be to document & remember? Plus adding more directives restricts users in implementing there own.
from graphql.
Personally not a fan of this at all, in my opinion would have to come up with a cleaner way of implementing this.
So if you stay with @autogenerate
, you should at least make the operations
argument an enum array.
from graphql.
I think we need to consider the size and surface area of the library, if we introduce lots and lots of directives for each use case; how will that be to document & remember?
You can define a partial schema containing all the frameworks types (like e.g.
DeleteInfo
) and directives, add it to your npm package the IDE will allow code completion and documentation for your types:""" some nice doc """ directive @CreatedDate on FIELD_DEFINITIONAdditionally you can define where the user can place the directive.
Love this, code completion for our directives would be a game changer.
from graphql.
This is the reason, why I extracted the directives and made them "static". So the Intellij graphql plugin will scan the whole project for *.graphql
files and provides you with code completion.
from graphql.
from graphql.
Yep, completely onboard with this, definitely going on the roadmap!
Time for me to relax for the evening. 😪 Thanks for all of the feedback on this, it's really valuable. Have a good weekend!
from graphql.
This has now been implemented and will be in the next release. In the end, the definition is as follows:
enum TimestampOperation {
CREATE
UPDATE
}
"""Instructs @neo4j/graphql to generate timestamps on particular events, which will be available as the value of the specified field."""
directive @timestamp(
"""Which events to generate timestamps on. Defaults to both create and update."""
operations: [TimestampOperation!]! = [CREATE, UPDATE]
) on FIELD_DEFINITION
from graphql.
Related Issues (20)
- Model.find({where: {id}}) returns wrong output. HOT 6
- Regression on ID scalar type filtering HOT 8
- Neo4jError: Variable `<propertyName>Count` not defined HOT 5
- Error "Cannot return null for non-nullable field" when limit exceeds result count in queries with non-nullable fields HOT 2
- Authorization rules can't compare enum property with context HOT 3
- Compatibility of @neo4j/graphql with neo4j-driver HOT 16
- GraphQL parsing issue with `[[String!]]!` HOT 2
- Filtering issue in `@authorization` directive HOT 2
- Nested mutation with deep connect inside a create is failing with the error- Neo4jError: Variable `this` already declared HOT 3
- Creating distinct relationships on interface field no longer possible since v5 if the interface does not include common identifier HOT 5
- @authentication doesn't work HOT 4
- ```authorization doesn't work``` HOT 1
- How to make custom resolver for create users
- Custom resolver for auto-generated resolvers HOT 2
- Spatial type projection fails if the `srid` is included in the SelectionSet HOT 2
- Generated `*OnCreateInput` types do not include fields to connect/create types with `@relationship` directives HOT 10
- Authorization filter causing undefined error HOT 2
- graphql-ogm with aggregations and full text searches HOT 1
- @neo4j/graphql:auth TypeError: Key for the RS256 algorithm must be one of type KeyObject or CryptoKey. Received an instance of Buffer HOT 17
- `{type}Connection` queries return results irrespective of the fulltext search phrase. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql.