-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: port message, operation, correlation-id and security-requir…
…ements models (#542)
- Loading branch information
1 parent
e444b87
commit 3627d02
Showing
69 changed files
with
1,884 additions
and
399 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
import type { BaseModel } from "./base"; | ||
import type { DescriptionMixinInterface, ExtensionsMixinInterface } from "./mixins"; | ||
import type { SchemaInterface } from "./schema"; | ||
|
||
export interface ChannelParameterInterface extends BaseModel {} | ||
export interface ChannelParameterInterface extends BaseModel, DescriptionMixinInterface, ExtensionsMixinInterface { | ||
id(): string; | ||
hasSchema(): boolean; | ||
schema(): SchemaInterface | undefined; | ||
hasLocation(): boolean; | ||
location(): string | undefined; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
import type { BaseModel } from "./base"; | ||
import type { ChannelParametersInterface } from "./channel-parameters"; | ||
import type { BindingsMixinInterface, DescriptionMixinInterface, ExtensionsMixinInterface } from "./mixins"; | ||
import type { OperationsInterface } from "./operations"; | ||
import type { ServersInterface } from "./servers"; | ||
|
||
export interface ChannelInterface extends BaseModel {} | ||
export interface ChannelInterface extends BaseModel, BindingsMixinInterface, DescriptionMixinInterface, ExtensionsMixinInterface { | ||
id(): string; | ||
address(): string; | ||
servers(): ServersInterface; | ||
operations(): OperationsInterface; | ||
parameters(): ChannelParametersInterface; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
import type { BaseModel } from "./base"; | ||
import type { DescriptionMixinInterface, ExtensionsMixinInterface } from "./mixins"; | ||
|
||
export interface CorrelationIdInterface extends BaseModel {} | ||
export interface CorrelationIdInterface extends BaseModel, DescriptionMixinInterface, ExtensionsMixinInterface { | ||
hasLocation(): boolean; | ||
location(): string | undefined; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
import type { BaseModel } from "./base"; | ||
import type { ExtensionsMixinInterface } from './mixins'; | ||
|
||
export interface MessageExample extends BaseModel {} | ||
export interface MessageExampleInterface extends BaseModel, ExtensionsMixinInterface { | ||
hasName(): boolean; | ||
name(): string; | ||
hasSummary(): boolean; | ||
summary(): string; | ||
hasHeaders(): boolean; | ||
headers(): Record<string, any> | undefined; | ||
hasPayload(): boolean; | ||
payload(): Record<string, any> | undefined; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import type { Collection } from "./collection"; | ||
import type { MessageExampleInterface } from "./message-example"; | ||
|
||
export interface MessageExamplesInterface extends Collection<MessageExampleInterface> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,24 @@ | ||
import type { BaseModel } from "./base"; | ||
import type { CorrelationIdInterface } from "./correlation-id"; | ||
import type { MessageExamplesInterface } from "./message-examples"; | ||
import type { BindingsMixinInterface, DescriptionMixinInterface, ExtensionsMixinInterface, ExternalDocumentationMixinInterface, TagsMixinInterface } from './mixins'; | ||
import type { SchemaInterface } from "./schema"; | ||
|
||
export interface MessageTraitInterface extends BaseModel {} | ||
export interface MessageTraitInterface extends BaseModel, BindingsMixinInterface, DescriptionMixinInterface, ExtensionsMixinInterface, ExternalDocumentationMixinInterface, TagsMixinInterface { | ||
id(): string; | ||
hasMessageId(): boolean; | ||
messageId(): string | undefined; | ||
hasCorrelationId(): boolean; | ||
correlationId(): CorrelationIdInterface | undefined; | ||
hasContentType(): boolean; | ||
contentType(): string | undefined; | ||
hasHeaders(): boolean | ||
headers(): SchemaInterface | undefined; | ||
hasName(): boolean; | ||
name(): string | undefined; | ||
hasTitle(): boolean; | ||
title(): string | undefined; | ||
hasSummary(): boolean; | ||
summary(): string | undefined; | ||
examples(): MessageExamplesInterface; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import type { Collection } from "./collection"; | ||
import type { MessageTraitInterface } from "./message-trait"; | ||
|
||
export interface MessagesTraitsInterface extends Collection<MessageTraitInterface> {} | ||
export interface MessageTraitsInterface extends Collection<MessageTraitInterface> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
import type { BaseModel } from "./base"; | ||
import type { MessageTraitsInterface } from "./message-traits"; | ||
import type { MessageTraitInterface } from "./message-trait"; | ||
import type { SchemaInterface } from "./schema"; | ||
|
||
export interface MessageInterface extends BaseModel, MessageTraitInterface {} | ||
export interface MessageInterface extends BaseModel, MessageTraitInterface { | ||
hasPayload(): boolean; | ||
payload(): SchemaInterface | undefined; | ||
traits(): MessageTraitsInterface; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import { OAuthFlowInterface } from './oauth-flow'; | ||
import { BaseModel } from './base'; | ||
import {ExtensionsMixinInterface} from './mixins'; | ||
import type { BaseModel } from './base'; | ||
import type { OAuthFlowInterface } from './oauth-flow'; | ||
import type { ExtensionsMixinInterface } from './mixins'; | ||
|
||
export interface OAuthFlowsInterface extends BaseModel, ExtensionsMixinInterface { | ||
hasAuthorizationCode(): boolean; | ||
authorizationCode(): OAuthFlowInterface | undefined; | ||
hasClientCredentials(): boolean | ||
clientCredentials(): OAuthFlowInterface | undefined; | ||
hasImplicit(): boolean; | ||
implicit(): OAuthFlowInterface | undefined; | ||
hasPassword(): boolean; | ||
password(): OAuthFlowInterface | undefined; | ||
} | ||
hasAuthorizationCode(): boolean; | ||
authorizationCode(): OAuthFlowInterface | undefined; | ||
hasClientCredentials(): boolean | ||
clientCredentials(): OAuthFlowInterface | undefined; | ||
hasImplicit(): boolean; | ||
implicit(): OAuthFlowInterface | undefined; | ||
hasPassword(): boolean; | ||
password(): OAuthFlowInterface | undefined; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
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"; | ||
|
||
export interface OperationTraitInterface extends BaseModel {} | ||
export interface OperationTraitInterface extends BaseModel, BindingsMixinInterface, DescriptionMixinInterface, ExtensionsMixinInterface, ExternalDocumentationMixinInterface, TagsMixinInterface { | ||
id(): string; | ||
action(): OperationAction; | ||
hasOperationId(): boolean; | ||
operationId(): string | undefined; | ||
hasSummary(): boolean; | ||
summary(): string | undefined; | ||
security(): Array<Record<string, { schema: SecuritySchemeInterface; scopes: string[]; }>>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import type { Collection } from "./collection"; | ||
import type { OperationTraitInterface } from "./operation-trait"; | ||
|
||
export interface OperationsTraitsInterface extends Collection<OperationTraitInterface> {} | ||
export interface OperationTraitsInterface extends Collection<OperationTraitInterface> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
import type { BaseModel } from "./base"; | ||
import type { MessagesInterface } from "./messages"; | ||
import type { OperationTraitsInterface } from "./operation-traits"; | ||
import type { OperationTraitInterface } from "./operation-trait"; | ||
|
||
export interface OperationInterface extends BaseModel, OperationTraitInterface {} | ||
export type OperationAction = 'send' | 'receive' | 'publish' | 'subscribe'; | ||
|
||
export interface OperationInterface extends BaseModel, OperationTraitInterface { | ||
messages(): MessagesInterface; | ||
traits(): OperationTraitsInterface; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import type { BaseModel } from "./base"; | ||
import type { ExtensionsMixinInterface } from "./mixins"; | ||
|
||
export interface SchemaInterface extends BaseModel {} | ||
export interface SchemaInterface extends BaseModel, ExtensionsMixinInterface {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
import { BaseModel } from './base'; | ||
import { DescriptionMixinInterface, ExtensionsMixinInterface } from './mixins'; | ||
import { OAuthFlowsInterface } from './oauth-flows'; | ||
import type { BaseModel } from './base'; | ||
import type { OAuthFlowsInterface } from './oauth-flows'; | ||
import type { DescriptionMixinInterface, ExtensionsMixinInterface } from './mixins'; | ||
|
||
export type SecuritySchemaType = 'userPassword' | 'apiKey' | 'X509' | 'symmetricEncryption' | 'asymmetricEncryption' | 'httpApiKey' | 'http' | 'oauth2' | 'openIdConnect' | 'plain' | 'scramSha256' | 'scramSha512' | 'gssapi'; | ||
|
||
|
||
export interface SecuritySchemeInterface extends BaseModel, DescriptionMixinInterface, ExtensionsMixinInterface { | ||
id(): string | ||
hasBearerFormat(): boolean; | ||
bearerFormat(): string | undefined; | ||
openIdConnectUrl(): string; | ||
scheme(): string | undefined; | ||
flows(): OAuthFlowsInterface | undefined; | ||
scopes(): string[]; | ||
type(): SecuritySchemaType; | ||
in(): string | undefined; | ||
} | ||
id(): string | ||
hasBearerFormat(): boolean; | ||
bearerFormat(): string | undefined; | ||
openIdConnectUrl(): string; | ||
scheme(): string | undefined; | ||
flows(): OAuthFlowsInterface | undefined; | ||
scopes(): string[]; | ||
type(): SecuritySchemaType; | ||
in(): string | undefined; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import {Collection} from './collection'; | ||
import { SecuritySchemeInterface } from './security-scheme'; | ||
import type { Collection} from './collection'; | ||
import type { SecuritySchemeInterface } from './security-scheme'; | ||
|
||
export interface SecuritySchemesInterface extends Collection<SecuritySchemeInterface> {} | ||
export interface SecuritySchemesInterface extends Collection<SecuritySchemeInterface> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import type { BaseModel } from "./base"; | ||
import type { BindingsMixinInterface, DescriptionMixinInterface, ExtensionsMixinInterface } from './mixins'; | ||
import type { ServerVariablesInterface } from "./server-variables"; | ||
import type { SecuritySchemeInterface } from "./security-scheme"; | ||
|
||
export interface ServerInterface extends BaseModel, DescriptionMixinInterface, BindingsMixinInterface, ExtensionsMixinInterface { | ||
id(): string | ||
url(): string; | ||
protocol(): string | undefined; | ||
protocol(): string; | ||
protocolVersion(): string; | ||
hasProtocolVersion(): boolean; | ||
variables(): ServerVariablesInterface | ||
} | ||
variables(): ServerVariablesInterface; | ||
security(): Array<Record<string, { schema: SecuritySchemeInterface; scopes: string[]; }>>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { BaseModel } from "../base"; | ||
|
||
import { Mixin } from '../utils'; | ||
import { DescriptionMixin } from './mixins/description'; | ||
import { ExtensionsMixin } from './mixins/extensions'; | ||
|
||
import type { CorrelationIdInterface } from "../correlation-id"; | ||
|
||
export class CorrelationId extends Mixin(BaseModel, DescriptionMixin, ExtensionsMixin) implements CorrelationIdInterface { | ||
hasLocation(): boolean { | ||
return !!this._json.location; | ||
} | ||
|
||
location(): string | undefined { | ||
return this._json.location; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.