redoc icon indicating copy to clipboard operation
redoc copied to clipboard

x-traitTag undepreceated, but not functional

Open jkijewski opened this issue 7 years ago • 3 comments

Hi, x-traitTag was depreceated around 1.4 version and undepreceated much later - however the code displaying tag disappeared from project - only the "continue" in MenuBuilder left.

Do you plan to bring back this functionality? I have to display badges with tag name (and possibly anchor to external doc)

jkijewski avatar Sep 07 '18 16:09 jkijewski

Thanks for the report. Yes, functionality disappeared during the rewrite. I will bring it back once I have some time.

PRs are welcome too!

RomanHotsiy avatar Sep 10 '18 14:09 RomanHotsiy

Have been looked into the x-traitTag property and as far as I can see it currently has little or no effect. While tags with x-traitTag=true are displayed in the left-hand side menu, adding a tag with x-TraitTag true to an operation does nothing related the display of the operation.

This is also documented in closed issue https://github.com/Redocly/redoc/issues/884

The comment https://github.com/Redocly/redoc/issues/141#issuecomment-262399440 from @RomanHotsiy in 2016 seems to indicate it was previously shown as a greyed out text line under the operation name, but this is no longer the case as far as I can see (with my limited knowledge of redoc)

Started analysing what needs to be changed to support x-traitTag

  1. src/components/Operation/Operation.tsx must be updated to display the trait tags below the summary of the operation Suggest to use <Badge type="warning"> or <OperationBadge> for display the name of the tag
  2. src/services/models/Operation.ts OperationModel must be updated to add a property of all traitTags
  3. src/services/MenuBuilder.ts Update function getOperationsItems to push the tag to the constructor of OperationModel ?
  4. Also update other places where constructor of OperationModel called? src/services/models/Callback.ts and src/services/models/Webhook.ts

Does the analysis make sense, or is something missing ?

Would it make sense to introduce x-traitTagType which is passed to the Badge or OperationBadge to be able to affect how the traitTag is displayed (as information, warning etc) ?

PS Are there any ongoing OpenAPI standardization efforts which should be taken into consideration?

elsewhat avatar Oct 14 '20 14:10 elsewhat

https://github.com/Redocly/redoc/issues/1909

AlexVarchuk avatar Mar 07 '22 12:03 AlexVarchuk