@stoplight/types
Advanced tools
Comparing version 13.2.0 to 13.3.0
@@ -5,2 +5,5 @@ import { Extensions } from './http-spec'; | ||
} | ||
export interface IComponentNode { | ||
key: string; | ||
} | ||
export interface INode extends IShareableNode { | ||
@@ -7,0 +10,0 @@ /** An internal identifier. For example, the operationId property in OAS. */ |
import { JSONSchema7 } from 'json-schema'; | ||
import { Dictionary } from './basic'; | ||
import { IShareableNode, INode, INodeExample, INodeExternalExample } from './graph'; | ||
import { IShareableNode, INode, INodeExample, INodeExternalExample, IComponentNode } from './graph'; | ||
import { IServer } from './servers'; | ||
@@ -32,10 +32,24 @@ /** | ||
} | ||
export interface IBundledHttpService extends Omit<IHttpService, 'securitySchemes'> { | ||
operations: IHttpOperation<true>[]; | ||
components: { | ||
schemas: (IComponentNode & JSONSchema7)[]; | ||
responses: (IComponentNode & (IHttpOperationResponse<true> | Reference))[]; | ||
path: (IComponentNode & (IHttpHeaderParam<true> | Reference))[]; | ||
query: (IComponentNode & (IHttpQueryParam<true> | Reference))[]; | ||
header: (IComponentNode & (IHttpHeaderParam<true> | Reference))[]; | ||
cookie: (IComponentNode & (IHttpCookieParam<true> | Reference))[]; | ||
examples: (IComponentNode & (INodeExample | INodeExternalExample | Reference))[]; | ||
requestBodies: (IComponentNode & (IHttpOperationRequestBody<true> | Reference))[]; | ||
securitySchemes: (IComponentNode & (HttpSecurityScheme | Reference))[]; | ||
}; | ||
} | ||
/** | ||
* HTTP Operation | ||
*/ | ||
export interface IHttpOperation extends INode, IShareableNode { | ||
export interface IHttpOperation<Bundle extends boolean = false> extends INode, IShareableNode { | ||
method: string; | ||
path: string; | ||
request?: IHttpOperationRequest; | ||
responses: IHttpOperationResponse[]; | ||
request?: Bundle extends true ? IHttpOperationRequest<true> | Reference : IHttpOperationRequest<false>; | ||
responses: (Bundle extends true ? IHttpOperationResponse<true> | (Pick<IHttpOperationResponse, 'code'> & Reference) : IHttpOperationResponse<false>)[]; | ||
servers?: IServer[]; | ||
@@ -47,21 +61,21 @@ callbacks?: IHttpCallbackOperation[]; | ||
} | ||
export declare type IHttpCallbackOperation = Omit<IHttpOperation, 'servers' | 'security' | 'callbacks'> & { | ||
export declare type IHttpCallbackOperation = Omit<IHttpOperation<false>, 'servers' | 'security' | 'callbacks'> & { | ||
callbackName: string; | ||
}; | ||
export interface IHttpOperationRequest { | ||
path?: IHttpPathParam[]; | ||
query?: IHttpQueryParam[]; | ||
headers?: IHttpHeaderParam[]; | ||
cookie?: IHttpCookieParam[]; | ||
body?: IHttpOperationRequestBody; | ||
export interface IHttpOperationRequest<Bundle extends boolean = false> { | ||
path?: (Bundle extends true ? IHttpPathParam<true> | Reference : IHttpPathParam<false>)[]; | ||
query?: (Bundle extends true ? IHttpQueryParam<true> | Reference : IHttpQueryParam<false>)[]; | ||
headers?: (Bundle extends true ? IHttpHeaderParam<true> | Reference : IHttpHeaderParam<false>)[]; | ||
cookie?: (Bundle extends true ? IHttpCookieParam<true> | Reference : IHttpCookieParam<false>)[]; | ||
body?: Bundle extends true ? IHttpOperationRequestBody<true> | Reference : IHttpOperationRequestBody<false>; | ||
} | ||
export interface IHttpOperationRequestBody extends IShareableNode { | ||
contents?: IMediaTypeContent[]; | ||
export interface IHttpOperationRequestBody<Bundle extends boolean = false> extends IShareableNode { | ||
contents?: IMediaTypeContent<Bundle>[]; | ||
required?: boolean; | ||
description?: string; | ||
} | ||
export interface IHttpOperationResponse extends IShareableNode { | ||
export interface IHttpOperationResponse<Bundle extends boolean = false> extends IShareableNode { | ||
code: string; | ||
contents?: IMediaTypeContent[]; | ||
headers?: IHttpHeaderParam[]; | ||
contents?: IMediaTypeContent<Bundle>[]; | ||
headers?: (Bundle extends true ? IHttpHeaderParam<true> | (Pick<IHttpHeaderParam, 'name'> & Reference) : IHttpHeaderParam<false>)[]; | ||
description?: string; | ||
@@ -72,3 +86,3 @@ } | ||
*/ | ||
export interface IHttpParam extends IHttpContent, IShareableNode { | ||
export interface IHttpParam<Bundle extends boolean = false> extends IHttpContent<Bundle>, IShareableNode { | ||
name: string; | ||
@@ -91,6 +105,6 @@ style: HttpParamStyles; | ||
} | ||
export interface IHttpPathParam extends IHttpParam { | ||
export interface IHttpPathParam<Bundle extends boolean = false> extends IHttpParam<Bundle> { | ||
style: HttpParamStyles.Label | HttpParamStyles.Matrix | HttpParamStyles.Simple; | ||
} | ||
export interface IHttpQueryParam extends IHttpParam { | ||
export interface IHttpQueryParam<Bundle extends boolean = false> extends IHttpParam<Bundle> { | ||
style: HttpParamStyles.Form | HttpParamStyles.CommaDelimited | HttpParamStyles.SpaceDelimited | HttpParamStyles.PipeDelimited | HttpParamStyles.DeepObject; | ||
@@ -100,6 +114,6 @@ allowEmptyValue?: boolean; | ||
} | ||
export interface IHttpHeaderParam extends IHttpParam { | ||
export interface IHttpHeaderParam<Bundle extends boolean = false> extends IHttpParam<Bundle> { | ||
style: HttpParamStyles.Simple; | ||
} | ||
export interface IHttpCookieParam extends IHttpParam { | ||
export interface IHttpCookieParam<Bundle extends boolean = false> extends IHttpParam<Bundle> { | ||
style: HttpParamStyles.Form; | ||
@@ -110,14 +124,14 @@ } | ||
*/ | ||
export interface IHttpContent extends IShareableNode { | ||
export interface IHttpContent<Bundle extends boolean = false> extends IShareableNode { | ||
schema?: JSONSchema7; | ||
examples?: (INodeExample | INodeExternalExample)[]; | ||
encodings?: IHttpEncoding[]; | ||
examples?: (Bundle extends true ? INodeExample | INodeExternalExample | (Pick<INodeExample, 'key'> & Reference) : INodeExample | INodeExternalExample)[]; | ||
encodings?: IHttpEncoding<Bundle>[]; | ||
} | ||
export interface IMediaTypeContent extends IHttpContent { | ||
export interface IMediaTypeContent<Bundle extends boolean = false> extends IHttpContent<Bundle> { | ||
mediaType: string; | ||
} | ||
export interface IHttpEncoding { | ||
export interface IHttpEncoding<Bundle extends boolean = false> { | ||
property: string; | ||
style: HttpParamStyles.Form | HttpParamStyles.CommaDelimited | HttpParamStyles.SpaceDelimited | HttpParamStyles.PipeDelimited | HttpParamStyles.DeepObject; | ||
headers?: IHttpHeaderParam[]; | ||
headers?: (Bundle extends true ? IHttpHeaderParam<true> | Reference : IHttpHeaderParam<false>)[]; | ||
mediaType?: string; | ||
@@ -183,2 +197,7 @@ explode?: boolean; | ||
} | ||
export declare type Reference = { | ||
$ref: string; | ||
summary?: string; | ||
description?: string; | ||
}; | ||
export interface Extensions { | ||
@@ -185,0 +204,0 @@ [key: string]: unknown; |
{ | ||
"name": "@stoplight/types", | ||
"version": "13.2.0", | ||
"version": "13.3.0", | ||
"description": "Common typings for the Stoplight ecosystem.", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36492
669