Skip to content

Create a schema with custom directives first change for #156 #1314

Open
MarcoFuykschot wants to merge 2 commits into
graphql-rust:masterfrom
TitaniumIT:custom-directives
Open

Create a schema with custom directives first change for #156 #1314
MarcoFuykschot wants to merge 2 commits into
graphql-rust:masterfrom
TitaniumIT:custom-directives

Conversation

@MarcoFuykschot

Copy link
Copy Markdown
modified:   juniper/src/lib.rs
modified:   juniper/src/schema/model.rs

(feat) create schema with custom directives

First change for #156

@tyranron tyranron added k::api Related to API (application interface) feature New feature or request labels May 2, 2025

@tyranron tyranron left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MarcoFuykschot

First change for #156

Could you provide some grand vision/description of how it's supposed to work? And what would be the next steps?

From the provided example in the code and PR description, it's not very clear.

@MarcoFuykschot

Copy link
Copy Markdown
Author

@MarcoFuykschot

First change for #156

Could you provide some grand vision/description of how it's supposed to work? And what would be the next steps?

From the provided example in the code and PR description, it's not very clear.

Step 1: is allow custom directives, added to a schema to pass validation.
Step 2: Update graphql parser to support directive definitions
Step 3: Create a mechanisme for user code to react on directives during execution.

@tyranron

tyranron commented May 9, 2025

Copy link
Copy Markdown
Member

@MarcoFuykschot

Step 3: Create a mechanisme for user code to react on directives during execution.

Could you sketch your vision of API?

@MarcoFuykschot

Copy link
Copy Markdown
Author

For the api, i have two idea's

  1. A visitor like pattern, on the the incoming query,
  2. Add a context like object as paramter to the fields.

Both i still need to reseach the code, on how to implement this in a non breaking way.

	modified:   juniper/src/schema/model.rs#
    modified:   juniper/src/schema/translate/graphql_parser.rs

Added new function to create a schema with custom directives
Added doctest
Added directives to be included in the schema output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request k::api Related to API (application interface)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants