Skip to content

Commit 90ea9f1

Browse files
authored
feat(http): add callbacks to components, tweak callback structure (#138)
1 parent 6f0fb0b commit 90ea9f1

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/http-spec.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export interface IBundledHttpService extends Omit<IHttpService, 'securitySchemes
4747
examples: (IComponentNode & (INodeExample | INodeExternalExample | Reference))[];
4848
requestBodies: (IComponentNode & (IHttpOperationRequestBody<true> | Reference))[];
4949
securitySchemes: (IComponentNode & (HttpSecurityScheme | Reference))[];
50+
callbacks: (IComponentNode & (IHttpCallbackOperation | IHttpKeyedReference))[];
5051
};
5152
}
5253

@@ -62,7 +63,7 @@ export interface IHttpOperation<Bundle extends boolean = false> extends INode, I
6263
? IHttpOperationResponse<true> | (Pick<IHttpOperationResponse, 'code'> & Reference)
6364
: IHttpOperationResponse<false>)[];
6465
servers?: IServer[];
65-
callbacks?: (Bundle extends true ? IHttpCallbackOperation[] | Reference : IHttpCallbackOperation<false>)[];
66+
callbacks?: (Bundle extends true ? (IHttpCallbackOperation | IHttpKeyedReference)[] : IHttpCallbackOperation<false>)[];
6667
security?: HttpSecurityScheme[][];
6768
securityDeclarationType?: HttpOperationSecurityDeclarationTypes;
6869
deprecated?: boolean;
@@ -81,7 +82,11 @@ export enum HttpOperationSecurityDeclarationTypes {
8182

8283
export interface IHttpCallbackOperation<Bundle extends boolean = false>
8384
extends Omit<IHttpOperation<Bundle>, 'callbacks'> {
84-
callbackName: string;
85+
key: string;
86+
}
87+
88+
export interface IHttpKeyedReference extends Reference {
89+
key: string;
8590
}
8691

8792
export interface IHttpOperationRequest<Bundle extends boolean = false> {
@@ -223,7 +228,7 @@ export interface IHttpCookieParam<Bundle extends boolean = false> extends IHttpP
223228
export interface IHttpContent<Bundle extends boolean = false> extends IShareableNode {
224229
schema?: JSONSchema7;
225230
examples?: (Bundle extends true
226-
? INodeExample | INodeExternalExample | (Pick<INodeExample, 'key'> & Reference)
231+
? INodeExample | INodeExternalExample | (IHttpKeyedReference)
227232
: INodeExample | INodeExternalExample)[];
228233
encodings?: IHttpEncoding<Bundle>[];
229234
}

0 commit comments

Comments
 (0)