From 79d15538c882cb7a018f378cf2e6c00d24a5cb16 Mon Sep 17 00:00:00 2001 From: Sergio Moya <1083296+smoya@users.noreply.github.com> Date: Fri, 2 Sep 2022 17:20:42 +0200 Subject: [PATCH] refactor: simplify operation trait based on parser-api --- src/models/operation-trait.ts | 3 --- src/models/operation.ts | 3 +++ src/models/v2/operation-trait.ts | 8 ++++++ test/models/v2/operation-trait.spec.ts | 8 ------ test/models/v2/operation.spec.ts | 36 ++++++++++++++++++++++++++ 5 files changed, 47 insertions(+), 11 deletions(-) diff --git a/src/models/operation-trait.ts b/src/models/operation-trait.ts index e17bc79a2..2f4dd27da 100644 --- a/src/models/operation-trait.ts +++ b/src/models/operation-trait.ts @@ -1,12 +1,9 @@ import type { BaseModel } from "./base"; import type { BindingsMixinInterface, DescriptionMixinInterface, ExtensionsMixinInterface, ExternalDocumentationMixinInterface, TagsMixinInterface } from './mixins'; -import type { OperationAction } from "./operation"; -import type { SecuritySchemeInterface } from "./security-scheme"; import { SecurityRequirements } from "./v2/security-requirements"; export interface OperationTraitInterface extends BaseModel, BindingsMixinInterface, DescriptionMixinInterface, ExtensionsMixinInterface, ExternalDocumentationMixinInterface, TagsMixinInterface { id(): string; - action(): OperationAction; hasOperationId(): boolean; operationId(): string | undefined; hasSummary(): boolean; diff --git a/src/models/operation.ts b/src/models/operation.ts index c72c38af4..6f91de2a8 100644 --- a/src/models/operation.ts +++ b/src/models/operation.ts @@ -8,6 +8,9 @@ import type { ServersInterface } from "./servers"; export type OperationAction = 'send' | 'receive' | 'publish' | 'subscribe'; export interface OperationInterface extends BaseModel, OperationTraitInterface { + action(): OperationAction; + isSend(): boolean; + isReceive(): boolean; servers(): ServersInterface; channels(): ChannelsInterface; messages(): MessagesInterface; diff --git a/src/models/v2/operation-trait.ts b/src/models/v2/operation-trait.ts index c46a38a2c..cc3ab6f41 100644 --- a/src/models/v2/operation-trait.ts +++ b/src/models/v2/operation-trait.ts @@ -52,6 +52,14 @@ export class OperationTrait