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

openapi3-ts

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openapi3-ts - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

18

dist/dsl/OpenApiBuilder.d.ts

@@ -19,11 +19,11 @@ import * as oa from "../model";

addPath(path: string, pathItem: oa.PathItemObject): OpenApiBuilder;
addSchema(name: string, schema: oa.SchemaObject): OpenApiBuilder;
addResponse(name: string, response: oa.ResponseObject): OpenApiBuilder;
addParameter(name: string, parameter: oa.ParameterObject): OpenApiBuilder;
addExample(name: string, example: oa.ExampleObject): OpenApiBuilder;
addRequestBody(name: string, reqBody: oa.RequestBodyObject): OpenApiBuilder;
addHeader(name: string, header: oa.HeaderObject): OpenApiBuilder;
addSecurityScheme(name: string, secScheme: oa.SecuritySchemeObject): OpenApiBuilder;
addLink(name: string, link: oa.LinkObject): OpenApiBuilder;
addCallback(name: string, callback: oa.CallbackObject): OpenApiBuilder;
addSchema(name: string, schema: oa.SchemaObject | oa.ReferenceObject): OpenApiBuilder;
addResponse(name: string, response: oa.ResponseObject | oa.ReferenceObject): OpenApiBuilder;
addParameter(name: string, parameter: oa.ParameterObject | oa.ReferenceObject): OpenApiBuilder;
addExample(name: string, example: oa.ExampleObject | oa.ReferenceObject): OpenApiBuilder;
addRequestBody(name: string, reqBody: oa.RequestBodyObject | oa.ReferenceObject): OpenApiBuilder;
addHeader(name: string, header: oa.HeaderObject | oa.ReferenceObject): OpenApiBuilder;
addSecurityScheme(name: string, secScheme: oa.SecuritySchemeObject | oa.ReferenceObject): OpenApiBuilder;
addLink(name: string, link: oa.LinkObject | oa.ReferenceObject): OpenApiBuilder;
addCallback(name: string, callback: oa.CallbackObject | oa.ReferenceObject): OpenApiBuilder;
addServer(server: oa.ServerObject): OpenApiBuilder;

@@ -30,0 +30,0 @@ addTag(tag: oa.TagObject): OpenApiBuilder;

@@ -45,27 +45,27 @@ import { ISpecificationExtension } from "./SpecificationExtension";

schemas?: {
[schema: string]: SchemaObject;
[schema: string]: SchemaObject | ReferenceObject;
};
responses?: {
[response: string]: ResponseObject;
[response: string]: ResponseObject | ReferenceObject;
};
parameters?: {
[parameter: string]: ParameterObject;
[parameter: string]: ParameterObject | ReferenceObject;
};
examples?: {
[example: string]: ExampleObject;
[example: string]: ExampleObject | ReferenceObject;
};
requestBodies?: {
[request: string]: RequestBodyObject;
[request: string]: RequestBodyObject | ReferenceObject;
};
headers?: {
[heaer: string]: HeaderObject;
[heaer: string]: HeaderObject | ReferenceObject;
};
securitySchemes?: {
[securityScheme: string]: SecuritySchemeObject;
[securityScheme: string]: SecuritySchemeObject | ReferenceObject;
};
links?: {
[link: string]: LinkObject;
[link: string]: LinkObject | ReferenceObject;
};
callbacks?: {
[callback: string]: CallbackObject;
[callback: string]: CallbackObject | ReferenceObject;
};

@@ -72,0 +72,0 @@ }

{
"name": "openapi3-ts",
"version": "1.0.3",
"version": "1.1.0",
"description": "TS Model & utils for OpenAPI 3.0.x specification.",

@@ -53,5 +53,5 @@ "main": "dist/index.js",

"devDependencies": {
"@types/chai": "^4.1.6",
"@types/chai": "^4.1.7",
"@types/mocha": "^5.2.5",
"@types/node": "^10.11.7",
"@types/node": "^10.12.1",
"chai": "^4.2.0",

@@ -64,4 +64,4 @@ "coveralls": "^3.0.2",

"tslint": "^5.11.0",
"typescript": "^3.1.3"
"typescript": "^3.1.4"
}
}

@@ -169,2 +169,9 @@ import "mocha";

});
it("addSchema reference", () => {
let schema1 = {
$ref: "#/components/schemas/id"
};
let sut = OpenApiBuilder.create().addSchema("schema01", schema1).rootDoc;
expect(sut.components.schemas.schema01).eql(schema1);
});
it("addResponse", () => {

@@ -177,2 +184,9 @@ let resp00 = {

});
it("addResponse reference", () => {
let resp00 = {
$ref: "#/components/responses/reference"
};
let sut = OpenApiBuilder.create().addResponse("resp00", resp00).rootDoc;
expect(sut.components.responses.resp00).eql(resp00);
});
it("addParameter", () => {

@@ -189,2 +203,9 @@ let par5 = {

});
it("addParameter reference", () => {
let par5 = {
$ref: "#/components/parameters/id"
};
let sut = OpenApiBuilder.create().addParameter("par5", par5).rootDoc;
expect(sut.components.parameters.par5).eql(par5);
});
it("addExample", () => {

@@ -198,2 +219,9 @@ let example4 = {

});
it("addExample reference", () => {
let example4 = {
$ref: "#/components/examples/id"
};
let sut = OpenApiBuilder.create().addExample("example4", example4).rootDoc;
expect(sut.components.examples.example4).eql(example4);
});
it("addRequestBody", () => {

@@ -217,2 +245,9 @@ let reqBody9: oa.RequestBodyObject = {

});
it("addRequestBody reference", () => {
let reqBody9 = {
$ref: "#/components/requestBodies/id"
};
let sut = OpenApiBuilder.create().addRequestBody("reqBody9", reqBody9).rootDoc;
expect(sut.components.requestBodies.reqBody9).eql(reqBody9);
});
it("addHeaders", () => {

@@ -225,2 +260,9 @@ let h5: oa.HeaderObject = {

});
it("addHeaders Reference", () => {
let h5: oa.HeaderObject = {
$ref: "#/components/headers/id"
};
let sut = OpenApiBuilder.create().addHeader("h5", h5).rootDoc;
expect(sut.components.headers.h5).eql(h5);
});
it("addSecuritySchemes", () => {

@@ -234,2 +276,9 @@ let sec7: oa.SecuritySchemeObject = {

});
it("addSecuritySchemes reference", () => {
let sec7 = {
$ref: "#/components/securitySchemes/id"
};
let sut = OpenApiBuilder.create().addSecurityScheme("sec7", sec7).rootDoc;
expect(sut.components.securitySchemes.sec7).eql(sec7);
});
it("addLink", () => {

@@ -242,2 +291,9 @@ let link0: oa.LinkObject = {

});
it("addLink reference", () => {
let link0 = {
$ref: "#/components/links/id"
};
let sut = OpenApiBuilder.create().addLink("link0", link0).rootDoc;
expect(sut.components.links.link0).eql(link0);
});
it("addCallback", () => {

@@ -268,2 +324,9 @@ let cb1: oa.CallbackObject = {

});
it("addCallback reference", () => {
let cb1 = {
$ref: "#/components/callbacks/id"
};
let sut = OpenApiBuilder.create().addCallback("cb1", cb1).rootDoc;
expect(sut.components.callbacks.cb1).eql(cb1);
});
it("addTag", () => {

@@ -270,0 +333,0 @@ let t1: oa.TagObject = {

@@ -99,35 +99,35 @@ import * as oa from "../model";

}
addSchema(name: string, schema: oa.SchemaObject): OpenApiBuilder {
addSchema(name: string, schema: oa.SchemaObject | oa.ReferenceObject): OpenApiBuilder {
this.rootDoc.components.schemas[name] = schema;
return this;
}
addResponse(name: string, response: oa.ResponseObject): OpenApiBuilder {
addResponse(name: string, response: oa.ResponseObject | oa.ReferenceObject): OpenApiBuilder {
this.rootDoc.components.responses[name] = response;
return this;
}
addParameter(name: string, parameter: oa.ParameterObject): OpenApiBuilder {
addParameter(name: string, parameter: oa.ParameterObject | oa.ReferenceObject): OpenApiBuilder {
this.rootDoc.components.parameters[name] = parameter;
return this;
}
addExample(name: string, example: oa.ExampleObject): OpenApiBuilder {
addExample(name: string, example: oa.ExampleObject | oa.ReferenceObject): OpenApiBuilder {
this.rootDoc.components.examples[name] = example;
return this;
}
addRequestBody(name: string, reqBody: oa.RequestBodyObject): OpenApiBuilder {
addRequestBody(name: string, reqBody: oa.RequestBodyObject | oa.ReferenceObject): OpenApiBuilder {
this.rootDoc.components.requestBodies[name] = reqBody;
return this;
}
addHeader(name: string, header: oa.HeaderObject): OpenApiBuilder {
addHeader(name: string, header: oa.HeaderObject | oa.ReferenceObject): OpenApiBuilder {
this.rootDoc.components.headers[name] = header;
return this;
}
addSecurityScheme(name: string, secScheme: oa.SecuritySchemeObject): OpenApiBuilder {
addSecurityScheme(name: string, secScheme: oa.SecuritySchemeObject | oa.ReferenceObject): OpenApiBuilder {
this.rootDoc.components.securitySchemes[name] = secScheme;
return this;
}
addLink(name: string, link: oa.LinkObject): OpenApiBuilder {
addLink(name: string, link: oa.LinkObject | oa.ReferenceObject): OpenApiBuilder {
this.rootDoc.components.links[name] = link;
return this;
}
addCallback(name: string, callback: oa.CallbackObject): OpenApiBuilder {
addCallback(name: string, callback: oa.CallbackObject | oa.ReferenceObject): OpenApiBuilder {
this.rootDoc.components.callbacks[name] = callback;

@@ -134,0 +134,0 @@ return this;

@@ -56,11 +56,11 @@ // Typed interfaces for OpenAPI 3.0.0-RC

export interface ComponentsObject extends ISpecificationExtension {
schemas?: { [schema: string]: SchemaObject };
responses?: { [response: string]: ResponseObject };
parameters?: { [parameter: string]: ParameterObject };
examples?: { [example: string]: ExampleObject };
requestBodies?: { [request: string]: RequestBodyObject };
headers?: { [heaer: string]: HeaderObject };
securitySchemes?: { [securityScheme: string]: SecuritySchemeObject };
links?: { [link: string]: LinkObject };
callbacks?: { [callback: string]: CallbackObject };
schemas?: { [schema: string]: SchemaObject | ReferenceObject };
responses?: { [response: string]: ResponseObject | ReferenceObject };
parameters?: { [parameter: string]: ParameterObject | ReferenceObject };
examples?: { [example: string]: ExampleObject | ReferenceObject };
requestBodies?: { [request: string]: RequestBodyObject | ReferenceObject };
headers?: { [heaer: string]: HeaderObject | ReferenceObject };
securitySchemes?: { [securityScheme: string]: SecuritySchemeObject | ReferenceObject };
links?: { [link: string]: LinkObject | ReferenceObject };
callbacks?: { [callback: string]: CallbackObject | ReferenceObject };
}

@@ -67,0 +67,0 @@

Sorry, the diff of this file is not supported yet

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