question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Automatically include @deprecated directive where ObsoleteAttribute is used

See original GitHub issue

Is your feature request related to a problem? Please describe. When creating a code-first GraphQL schema, placing an ObsoleteAttribute on fields for a model/type/query require an explicit call to the IFieldDescriptor.DeprecationReason(). This can lead to a disconnect between the code I’ve written and the GraphQL model since I need to denote the deprecation in multiple locations.

Describe the solution you’d like As part of schema generation, it would be great to look for attributes on fields (implicit or explicit) that use the ObsoleteAttribute and have a valid Message property value that conforms to the GraphQL spec. This would prevent the need to use both an ObsoleteAttribute and the DeprecationReason() method to denote a deprecated field.

Describe alternatives you’ve considered I have not considered additional alternatives at this time.

Additional context This is a feature that is supported by some ASP.NET Core Swagger implementations, and would be nice to include this as part of HotChocolate to provide additional support for code-first schema generation.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
willwolfram18commented, Jun 17, 2019

Closed as of #843

1reaction
willwolfram18commented, Jun 15, 2019

This is closed as of merge #826. One addition I could see being made is a new GraphQLDeprecatedAttribute(string) that could be added, similar to the GraphQLDescriptionAttribute. Would be nice to have both “implicit” support from core attributes, as well as a HotChocolate specific method like descriptions have.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Automatically include @deprecated directive where ...
When creating a code-first GraphQL schema, placing an ObsoleteAttribute on fields for a model/type/query require an explicit call to the ...
Read more >
Generate schema descriptions from XML docstrings #715
willwolfram18 mentioned this issue on May 15, 2019. Automatically include @deprecated directive where ObsoleteAttribute is used #747.
Read more >
ObsoleteAttribute Class (System)
ObsoleteAttribute is applicable to all program elements except assemblies, modules, parameters, and return values. Marking an element as obsolete informs users ...
Read more >
c# - When should I use the [Obsolete] attribute and when ...
The Obsolete attribute marks a program entity as one that is no longer recommended for use. Each use of an entity marked obsolete...
Read more >
C++ attribute: deprecated (since C++14)
Indicates that the name or entity declared with this attribute is deprecated, that is, the use is allowed, but discouraged for some reason....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found