Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Expose user-defined directives in API schema #387

Open
marktani opened this issue Jan 23, 2018 · 4 comments
Open

Expose user-defined directives in API schema #387

marktani opened this issue Jan 23, 2018 · 4 comments

Comments

@marktani
Copy link
Contributor

Issue by schickling
Thursday Nov 09, 2017 at 11:16 GMT
Originally opened as https://github.com/graphcool/prisma/issues/1228


Graphcool currently supports a limited number of system directives which are used in the data model to construct the API. These system directives are not exposed through the GraphQL API. (Other directives are currently not accepted and will result in a deploy error.)

However, there are many other use cases (like in this forum post) for directives where you'd want to expose them directly in the GraphQL API.

@marktani
Copy link
Contributor Author

Comment by kbrandwijk
Thursday Nov 09, 2017 at 11:18 GMT


Generic feature request for https://github.com/graphcool/framework/issues/1032 too.

@marktani
Copy link
Contributor Author

Comment by develomark
Tuesday Jan 02, 2018 at 18:54 GMT


I'd like to add my +1 for this feature request.

With 1.0 coming up to release it puts a lot more power in the hands of the developer - I see this as a critical feature for its release. These directives will help to facilitate configuration of business logic - permissions, conditionals, caching, metadata etc.

The ideal situation would be: on gc deploy pass custom directives (and string/block descriptions) out to the generated src\generated\database.graphql schema - that way it can be used by graphql prepare and the graphql-yoga implementation - which already supports directives and block descriptions.

Any directives or descriptions should also pass to Input Definitions also.

"""
# Description of Post type
"""
type Post @custom(arg: "value"){
  id: ID! @unique
  title: String! @custom(arg: "value")
  "Text field desc"
  text: String!
  author: User! 
}

gc deploy generated output:

"""
# Description of Post type
"""
type Post implements Node @custom(arg: "value") {
  id: ID! @unique
  title: String! @custom(arg: "value")
  "Text field desc"
  text: String!
  author(where: UserWhereInput): User!
}

"""
# Description of Post type
"""
input PostCreateInput @custom(arg: "value") {
  title: String! @custom(arg: "value")
  "Text field desc"
  text: String!
  author: UserCreateOneWithoutPostsInput
}

"""
# Description of Post type
"""
input PostUpdateInput @custom(arg: "value") {
  title: String @custom(arg: "value")
  "Text field desc"
  text: String
  author: UserUpdateOneWithoutPostsInput
}

@marktani
Copy link
Contributor Author

Comment by develomark
Thursday Jan 04, 2018 at 11:08 GMT


@schickling Is there a possibility this could be added to the 1.0 feature list?

@marktani
Copy link
Contributor Author

Comment by kbrandwijk
Thursday Jan 04, 2018 at 11:13 GMT


Especially because it already preserves custom directives on fields, this is now in an inconsistent state that should be addressed. It's also blocking for quite a number of use cases.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

1 participant