From 7bb078584131e4774052c01c4161d7aef60118e4 Mon Sep 17 00:00:00 2001 From: Peter Golm Date: Sat, 1 Jul 2017 11:08:38 +0200 Subject: [PATCH 1/2] Add special rendering for deprecated operations --- demo/swagger.yaml | 1 + lib/components/Operation/operation.html | 3 +++ lib/components/Operation/operation.scss | 4 ++++ lib/components/Operation/operation.ts | 2 ++ lib/components/SideMenu/side-menu-items.html | 2 +- lib/components/SideMenu/side-menu-items.scss | 5 +++++ lib/services/menu.service.ts | 3 ++- 7 files changed, 18 insertions(+), 2 deletions(-) diff --git a/demo/swagger.yaml b/demo/swagger.yaml index 63a0bcbb1d..7ffec7508d 100644 --- a/demo/swagger.yaml +++ b/demo/swagger.yaml @@ -336,6 +336,7 @@ paths: summary: Finds Pets by tags description: 'Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.' operationId: findPetsByTags + deprecated: true produces: - application/xml - application/json diff --git a/lib/components/Operation/operation.html b/lib/components/Operation/operation.html index 4fa9a34522..28a5592d86 100644 --- a/lib/components/Operation/operation.html +++ b/lib/components/Operation/operation.html @@ -5,6 +5,9 @@

+
+ Warning: Deprecated +
{{tag}}
diff --git a/lib/components/Operation/operation.scss b/lib/components/Operation/operation.scss index d6cdfaf432..4c63abe2d8 100644 --- a/lib/components/Operation/operation.scss +++ b/lib/components/Operation/operation.scss @@ -18,6 +18,10 @@ margin-bottom: calc(1em - 6px); } +.operation-deprecated { + font-weight: bold; +} + .operation-tags { margin-top: 20px; diff --git a/lib/components/Operation/operation.ts b/lib/components/Operation/operation.ts index 0ad54e6b9c..dc86e7e67b 100644 --- a/lib/components/Operation/operation.ts +++ b/lib/components/Operation/operation.ts @@ -7,6 +7,7 @@ import { OptionsService, MenuService } from '../../services/'; import { SwaggerBodyParameter } from '../../utils/swagger-typings'; export interface OperationInfo { + deprecated: boolean; verb: string; path: string; info: { @@ -50,6 +51,7 @@ export class Operation extends BaseComponent implements OnInit { this.operationId = this.componentSchema.operationId; this.operation = { + deprecated: this.componentSchema.deprecated, verb: JsonPointer.baseName(this.pointer), path: JsonPointer.baseName(this.pointer, 2), info: { diff --git a/lib/components/SideMenu/side-menu-items.html b/lib/components/SideMenu/side-menu-items.html index 8010e40485..726900cd3f 100644 --- a/lib/components/SideMenu/side-menu-items.html +++ b/lib/components/SideMenu/side-menu-items.html @@ -1,6 +1,6 @@