From b04920602bef7a971b4b24958e9a609a9b36cac3 Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Fri, 12 Aug 2022 14:06:21 +0200 Subject: [PATCH] fix: Add deprecated openapi tags as valid tags for operations (#1916) ## PR text I realized that the tag changes we introduced in #1907 would be breaking for people who use the unleash-server package and implement their own endpoints on top of it (as we do in unleash-enterprise). This change makes it possible to still use the old tags. However, these tags are purposefully not added to the root schema or the list of OpenAPI tag types. Any of our endpoints still using them (I think there is one in Unleash enterprise, see ivarconr/unleash-enterprise#109) should switch over when possible. ## Commits * fix: Add deprecated openapi tags as valid tags for operations * Docs: add explanatory comment for why the type exists. --- src/lib/openapi/util/api-operation.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lib/openapi/util/api-operation.ts b/src/lib/openapi/util/api-operation.ts index 4853782376..672dab5cf6 100644 --- a/src/lib/openapi/util/api-operation.ts +++ b/src/lib/openapi/util/api-operation.ts @@ -1,7 +1,16 @@ import { OpenAPIV3 } from 'openapi-types'; import { OpenApiTag } from './openapi-tags'; -export interface ApiOperation +type DeprecatedOpenAPITag = + // Deprecated tag names. Please use a tag from the OpenAPITag type instead. + // + // These tag names were the original ones we used for OpenAPI, but they + // turned out to be too generic and/or didn't match the new tag naming + // schema. Because we require our operations to have one of a predefined set + // of values, it would be breaking change to remove them completely. + 'client' | 'other' | 'auth' | 'admin'; + +export interface ApiOperation extends Omit { operationId: string; tags: [Tag];