Skip to content

Argument default values and descriptions not available in introspection #880

Closed
@mrtnzlml

Description

@mrtnzlml

Hello, me again! 😅

Describe the bug

Argument default values and descriptions are not available in introspection (and via as_schema_language). I followed this syntax: https://graphql-rust.github.io/juniper/master/types/objects/complex_fields.html?highlight=arguments#customizing-arguments

To Reproduce

  1. create a field with arguments like so:
#[juniper::graphql_object]
impl Product {
    #[juniper::graphql(arguments(first(default = 1, description = "TEST")))]
    fn images(&self, first: i32) -> Vec<Image> {
        // …
    }
    // …
}
  1. introspect the schema and try to get the default value and description (it's not there)

Expected behavior

The default value and description should be available via introspection.

Additional context

Here is how the introspection looks like in my case (notice the missing arg description and default value):

{
  name: "images",
  description: "A list of images for this product, meant to be displayable to the customer.",
  args: [
    {
      name: "first",
      description: null,
      type: {
        kind: "NON_NULL",
        name: null,
        ofType: {
          kind: "SCALAR",
          name: "Int",
          ofType: null,
        },
      },
      defaultValue: null,
    },
  ],
  type: {
    kind: "NON_NULL",
    name: null,
    ofType: {
      kind: "LIST",
      name: null,
      ofType: {
        kind: "NON_NULL",
        name: null,
        ofType: {
          kind: "OBJECT",
          name: "Image",
          ofType: null,
        },
      },
    },
  },
  isDeprecated: false,
  deprecationReason: null,
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions