Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default values not rendered in the sdl #1110

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

SvenW
Copy link

@SvenW SvenW commented Oct 8, 2021

When specifying default values in input arguments they aren't rendered in the sdl, using Absinthe.Schema.to_sdl

@SvenW SvenW force-pushed the fix/sdl-default-values branch 2 times, most recently from affa92c to 5b751bf Compare October 8, 2021 12:59
@SvenW SvenW changed the title Default values wheren't rendered in the sdl Default values weren't rendered in the sdl Oct 8, 2021
@SvenW SvenW changed the title Default values weren't rendered in the sdl Default values wasn't rendered in the sdl Oct 8, 2021
@SvenW SvenW changed the title Default values wasn't rendered in the sdl Default values not rendered in the sdl Oct 8, 2021
Copy link
Contributor

@benwilson512 benwilson512 left a comment

Choose a reason for hiding this comment

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

@SvenW thank you for taking a crack at this!

Can you include some test case for list values, object values, and then nested combinations of lists / objects?

@binaryseed
Copy link
Contributor

I think we should identify the source of the problem first... It seems like perhaps it's a difference between SDL & Macro schemas.

SDL schema does correctly render default values:

Macro schema doesn't render default values:

This is probably another situation where the SDL & Macro schemas generate different structs when they are compiled.

@SvenW
Copy link
Author

SvenW commented Oct 11, 2021

I think we should identify the source of the problem first... It seems like perhaps it's a difference between SDL & Macro schemas.

SDL schema does correctly render default values:

Macro schema doesn't render default values:

This is probably another situation where the SDL & Macro schemas generate different structs when they are compiled.

Ok, so what's the way forward here. Are you guys digging in to the issue? Can I help in some way?

@benwilson512
Copy link
Contributor

I do not have time to dive into this, so @SvenW if you have time to look at the blueprints generated by both SDL and regular schemas that'd be the place to start.

@SvenW
Copy link
Author

SvenW commented Oct 15, 2021

So I've started to dig into this a little bit. import_sdl in the schema notation works with the language definition structs running the draft protocol https://github.com/absinthe-graphql/absinthe/blob/master/lib/absinthe/schema/notation/sdl.ex#L16 which generates blueprint types with correct default values default_value_blueprint is actually populated, this is not the case for macrobased schemas, it skips this part completely. Not sure how I should go forward here in a good way. It would be nice if the same protocol would be run in both cases so that the spec looks the same. Do you have any more pointers here, should I try to implement the draft protocol for all blueprint structs as well and not just the language structs? @benwilson512 @binaryseed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants