Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stoplight/types

Package Overview
Dependencies
Maintainers
7
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stoplight/types - npm Package Compare versions

Comparing version 1.2.2 to 2.0.0

http.js

252

http.d.ts
import { INode } from './node';
import { ISchema } from './schema';
import { IServer } from './server';
import { ISchema } from './schema';
export interface IHttpOperation extends INode {
method: string;
path: string;
responses: IHttpResponse[];
servers?: IServer[];
request?: IHttpRequest;
security?: HttpSecurityScheme[];
deprecated?: boolean;
method: string;
path: string;
responses: IHttpResponse[];
servers?: IServer[];
request?: IHttpRequestParams;
security?: HttpSecurityScheme[];
deprecated?: boolean;
}
export interface IExample {
key: string;
summary?: string;
description?: string;
value?: any;
externalValue?: any;
key: string;
summary?: string;
description?: string;
value?: any;
externalValue?: any;
}
// Inspired by: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#parameterObject
export interface IHttpParam {
name: string;
style?: HttpParamStyles;
description?: string;
required?: boolean;
explode?: boolean;
deprecated?: boolean;
// most of the type, params from oas2/oas3 will simply be converted to content with one '*' key
content: {
[mediaType: string]: IHttpContent;
};
name: string;
style?: HttpParamStyles;
description?: string;
required?: boolean;
explode?: boolean;
deprecated?: boolean;
content: {
[mediaType: string]: IHttpContent;
};
}
declare const enum HttpParamStyles {
Simple = 'simple',
Matrix = 'matrix',
Label = 'label',
Form = 'form',
SpaceDelimited = 'spaceDelimited',
PipeDelimited = 'pipeDelimited',
DeepObject = 'deepObject',
export declare const enum HttpParamStyles {
Simple = "simple",
Matrix = "matrix",
Label = "label",
Form = "form",
SpaceDelimited = "spaceDelimited",
PipeDelimited = "pipeDelimited",
DeepObject = "deepObject"
}
export interface IHttpPathParam extends IHttpParam {
// defaults to simple
style?: HttpParamStyles.Label | HttpParamStyles.Matrix | HttpParamStyles.Simple;
style?: HttpParamStyles.Label | HttpParamStyles.Matrix | HttpParamStyles.Simple;
}
export interface IHttpQueryParam extends IHttpParam {
// defaults to form
style?:
| HttpParamStyles.Form
| HttpParamStyles.SpaceDelimited
| HttpParamStyles.PipeDelimited
| HttpParamStyles.DeepObject;
allowEmptyValue?: boolean;
allowReserved?: boolean;
style?: HttpParamStyles.Form | HttpParamStyles.SpaceDelimited | HttpParamStyles.PipeDelimited | HttpParamStyles.DeepObject;
allowEmptyValue?: boolean;
allowReserved?: boolean;
}
export interface IHttpHeaderParam extends IHttpParam {
// defaults to simple
style?: HttpParamStyles.Simple;
style?: HttpParamStyles.Simple;
}
export interface IHttpCookieParam extends IHttpParam {
// defaults to form
style?: HttpParamStyles.Form;
style?: HttpParamStyles.Form;
}
export interface IHttpEncoding {
property: string;
mediaType?: string;
headers?: IHttpHeaderParam[];
// deafults to form
style:
| HttpParamStyles.Form
| HttpParamStyles.SpaceDelimited
| HttpParamStyles.PipeDelimited
| HttpParamStyles.DeepObject;
explode?: boolean;
allowReserved?: boolean;
property: string;
mediaType?: string;
headers?: IHttpHeaderParam[];
style: HttpParamStyles.Form | HttpParamStyles.SpaceDelimited | HttpParamStyles.PipeDelimited | HttpParamStyles.DeepObject;
explode?: boolean;
allowReserved?: boolean;
}
export interface IHttpContent {
mediaType: string;
schema?: ISchema;
examples?: IExample[];
encodings?: IHttpEncoding[];
mediaType: string;
schema?: ISchema;
examples?: IExample[];
encodings?: IHttpEncoding[];
}
// https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#link-object
export interface IHttpLink {
operationRef: string;
parameters: Array<{
name: string;
value?: any;
expression?: string;
}>;
requestBody?: any;
description?: string;
server?: IServer;
operationRef: string;
parameters: Array<{
name: string;
value?: any;
expression?: string;
}>;
requestBody?: any;
description?: string;
server?: IServer;
}
// https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#requestBodyObject
export interface IHttpRequestBody {
description?: string;
required?: boolean;
contents: IHttpContent[];
description?: string;
required?: boolean;
contents: IHttpContent[];
}
export interface IHttpRequest {
path?: IHttpPathParam[];
query?: IHttpQueryParam[];
headers?: IHttpHeaderParam[];
cookie?: IHttpCookieParam[];
body?: IHttpRequestBody;
export interface IHttpRequestParams {
path?: IHttpPathParam[];
query?: IHttpQueryParam[];
headers?: IHttpHeaderParam[];
cookie?: IHttpCookieParam[];
body?: IHttpRequestBody;
}
export interface IHttpResponse {
// Note: code MAY contain uppercase "X" to indicate wildcard
// Examples: 200, 2XX, 4XX, XXX ("default" in OAS)
// When mocking, should select most specific defined code
code: string;
contents: IHttpContent[];
description?: string;
headers?: IHttpHeaderParam[];
links?: IHttpLink;
code: string;
contents: IHttpContent[];
description?: string;
headers?: IHttpHeaderParam[];
links?: IHttpLink;
}
/**
* Security
*/
type HttpSecurityScheme =
| IApiKeySecurityScheme
| IBearerSecurityScheme
| IBasicSecurityScheme
| IOauth2SecurityScheme
| IOpenIdConnectSecurityScheme;
declare type HttpSecurityScheme = IApiKeySecurityScheme | IBearerSecurityScheme | IBasicSecurityScheme | IOauth2SecurityScheme | IOpenIdConnectSecurityScheme;
export interface ISecurityScheme {
description?: string;
description?: string;
}
export interface IApiKeySecurityScheme extends ISecurityScheme {
type: 'apiKey';
name: string;
in: 'query' | 'header' | 'cookie';
type: 'apiKey';
name: string;
in: 'query' | 'header' | 'cookie';
}
export interface IBearerSecurityScheme extends ISecurityScheme {
type: 'http';
scheme: 'bearer';
bearerFormat?: string;
type: 'http';
scheme: 'bearer';
bearerFormat?: string;
}
export interface IBasicSecurityScheme extends ISecurityScheme {
type: 'http';
scheme: 'basic';
type: 'http';
scheme: 'basic';
}
export interface IOpenIdConnectSecurityScheme extends ISecurityScheme {
type: 'openIdConnect';
openIdConnectUrl: string;
type: 'openIdConnect';
openIdConnectUrl: string;
}
export interface IOauth2SecurityScheme extends ISecurityScheme {
type: 'oauth2';
flows: IOauthFlowObjects;
type: 'oauth2';
flows: IOauthFlowObjects;
}
export interface IOauthFlowObjects {
implicit?: IOauth2ImplicitFlow;
password?: IOauth2PasswordFlow;
clientCredentials?: IOauth2ClientCredentialsFlow;
authorizationCode?: IOauth2AuthorizationCodeFlow;
implicit?: IOauth2ImplicitFlow;
password?: IOauth2PasswordFlow;
clientCredentials?: IOauth2ClientCredentialsFlow;
authorizationCode?: IOauth2AuthorizationCodeFlow;
}
export interface IOauth2Flow {
refreshUrl?: string;
scopes: Array<{
[name: string]: string;
}>;
refreshUrl?: string;
scopes: Array<{
[name: string]: string;
}>;
}
export interface IOauth2ImplicitFlow extends IOauth2Flow {
authorizationUrl: string;
authorizationUrl: string;
}
export interface IOauth2AuthorizationCodeFlow extends IOauth2Flow {
authorizationUrl: string;
tokenUrl: string;
authorizationUrl: string;
tokenUrl: string;
}
export interface IOauth2PasswordFlow extends IOauth2Flow {
tokenUrl: string;
tokenUrl: string;
}
export interface IOauth2ClientCredentialsFlow extends IOauth2Flow {
tokenUrl: string;
tokenUrl: string;
}
export {};
export * from './http';
export * from './logs';
export * from './node';
export * from './parsers';
export * from './schema';
export * from './server';
export * from './validations';
export interface INode {
id: string;
iid?: string; // An internal identifier. for example the operationId property in OAS
tags?: INodeTag[];
summary?: string;
description?: string;
id: string;
iid?: string;
tags?: INodeTag[];
summary?: string;
description?: string;
}
export interface INodeTag {
name: string;
description?: string;
name: string;
description?: string;
}
export interface INodeVariable {
default: string;
description?: string;
enum?: string[];
default: string;
description?: string;
enum?: string[];
}
{
"name": "@stoplight/types",
"version": "1.2.2",
"version": "2.0.0",
"description": "Common typings for the Stoplight ecosystem.",
"keywords": [],
"sideEffects": false,
"files": [
"**/*"
],
"author": "Stoplight <support@stoplight.io>",
"license": "MIT",
"main": "./index.d.ts",
"types": "./index.d.ts",
"scripts": {
"build": "tsc --project tsconfig.json"
"repository": {
"type": "git",
"url": "https://github.com/stoplightio/types.git"
},
"prettier": {
"printWidth": 100,
"singleQuote": true,
"trailingComma": "es5"
"license": "Apache-2.0",
"engines": {
"node": ">=8"
},
"devDependencies": {
"tslint": "5.11.x",
"tslint-config-stoplight": "1.1.x",
"typescript": "3.1.x"
}
"main": "index.js",
"typings": "index.d.ts"
}

@@ -1,6 +0,3 @@

// Here is OAS crazy subset of JSON Schema: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#schemaObject
// For now, let's keep it open-ended
export interface ISchema {
// anything goes for now
[key: string]: any;
[key: string]: any;
}
import { INodeVariable } from './node';
export interface IServer {
url: string;
name?: string;
description?: string;
variables?: {
[name: string]: INodeVariable;
};
url: string;
name?: string;
description?: string;
variables?: {
[name: string]: INodeVariable;
};
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc