sangria-graphql/sangria

Deprecating InputField removes the fields in version 4.1.0

candeemis opened this issue · 5 comments

We have a few InputFields and I deprecated them with withDeprecationReason like the following:

  val MyArg = Argument(
    name = "myArg",
    description = "some important argument",
    argumentType = OptionInputType(
      InputObjectType[MyItem](
        "MyArg_",
        List(
          InputField("custom_filter", OptionInputType(CustomFilter.makeNew()), "Filter something"),
          InputField("max", OptionInputType(IntType), "Maximum number of items")
            .withDeprecationReason("No longer supported"),
          InputField("some_flag", OptionInputType(BooleanType), "Allows using some resource")
            .withDeprecationReason("No longer supported")
        )
      )
    )
  )

Instead of showing the input parameters deprected along with the deprecation message in the Docs UI (voyager views), the parameters disappear! Which is a breaking change in terms of API contract.

We are using version 4.1.0

For context, the PR that introduced the possibility to deprecated input fields.

Do you know which introspection query they're using?
If they use args(includeDeprecated = true)?
I see in the PR that includeDeprecated is false by default. It's the same behavior as deprecated fields: if the introspection query does not ask to include deprecated fields, they are not returned by default.

@candeemis do you have some news?

Hi @yanns, sorry for the late reply. We actually gave up on the relevant task. That's why I didn't have any chance to look deeper into the issue. If no one else is complaining about this, then perhaps we can close the issue without investing any resources into this, unless someone faces the same issue.

I'll close the issue for now. If you have any news, don't hesitate to open it again.

bxt commented

Seems like this can indeed be solved by setting includeDeprecated: true on the introspection query. When using the getIntrospectionQuery utility function from the NPM package graphql you can call it like getIntrospectionQuery({ inputValueDeprecation: true }) to get this added to the generated GraphQL query. This option was added in version 15.5.50: graphql/graphql-js#2855