Skip to content

fix: render default values in SDL output for schema.sdl task#1402

Open
jruhland wants to merge 2 commits intoabsinthe-graphql:mainfrom
brexhq:fix/default-values-in-sdl
Open

fix: render default values in SDL output for schema.sdl task#1402
jruhland wants to merge 2 commits intoabsinthe-graphql:mainfrom
brexhq:fix/default-values-in-sdl

Conversation

@jruhland
Copy link

@jruhland jruhland commented Dec 23, 2025

Fixes #1222

Previously, the mix absinthe.schema.sdl task would not include default values for arguments and input object fields in the generated SDL output, even though the mix absinthe.schema.json task would properly include them in its output.

Changes:

  • Modified SDL renderer to handle default values for InputValueDefinition (arguments) and FieldDefinition (input object fields)
  • Added support for DSL-defined schemas where default_value is an Elixir term that needs conversion to Blueprint.Input structures
  • Added support for SDL-parsed schemas where default_value_blueprint is already a Blueprint structure
  • Skip non-serializable values (refs, functions)

Tests:

  • Added DefaultValueTestSchema with default value coverage to prevent regression while rendering boolean, string, and input object default values
  • All existing tests updated to expect default values in output. There were 2 that confirmed this behavior wasn't working
  • We integrated this change into our production app, and have validated the expected outcomes against a significantly large schema that also employs the federation extensions.

Note:

Hit #1083 quite a bit, will see if I can address in a separate PR.

Previously, the `mix absinthe.schema.sdl` task would not include default
values for arguments and input object fields in the generated SDL output,
even though the schema.json task included them in its output.

Changes:
- Modified SDL renderer to handle default values for InputValueDefinition
  (arguments) and FieldDefinition (input object fields)
- Added support for DSL-defined schemas where default_value is an Elixir
  term that needs conversion to Blueprint.Input structures
- Added support for SDL-parsed schemas where default_value_blueprint is
  already a Blueprint structure
- Skip non-serializable values (refs, functions)

Tests:
- Added DefaultValueTestSchema with default value coverage to prevent
  regression while rendering boolean, string, and input object default values
- All existing tests updated to expect default values in output
@jruhland jruhland force-pushed the fix/default-values-in-sdl branch from 4d22224 to 8a5ef7d Compare December 23, 2025 17:18
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.

mix absinthe.schema.sdl does not include default_values

2 participants