absinthe
absinthe copied to clipboard
Default values not rendered in the sdl
When specifying default values in input arguments they aren't rendered in the sdl, using Absinthe.Schema.to_sdl
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:
- https://github.com/absinthe-graphql/absinthe/blob/master/test/absinthe/schema/sdl_render_test.exs#L48
Macro schema doesn't render default values:
- https://github.com/absinthe-graphql/absinthe/blob/master/test/absinthe/schema/sdl_render_test.exs#L198
- https://github.com/absinthe-graphql/absinthe/blob/master/test/absinthe/schema/sdl_render_test.exs#L254
This is probably another situation where the SDL & Macro schemas generate different structs when they are compiled.
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:
- https://github.com/absinthe-graphql/absinthe/blob/master/test/absinthe/schema/sdl_render_test.exs#L48
Macro schema doesn't render default values:
- https://github.com/absinthe-graphql/absinthe/blob/master/test/absinthe/schema/sdl_render_test.exs#L198
- https://github.com/absinthe-graphql/absinthe/blob/master/test/absinthe/schema/sdl_render_test.exs#L254
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?
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.
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