openapi3-ts
Advanced tools
Comparing version 1.0.1 to 1.0.2
import * as oa from "../model"; | ||
export declare class OpenApiBuilder { | ||
rootDoc: oa.OpenAPIObject; | ||
static create(): OpenApiBuilder; | ||
constructor(); | ||
static create(doc?: oa.OpenAPIObject): OpenApiBuilder; | ||
constructor(doc?: oa.OpenAPIObject); | ||
getSpec(): oa.OpenAPIObject; | ||
@@ -7,0 +7,0 @@ getSpecAsJson(replacer?: (key: string, value: any) => any, space?: string | number): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
class OpenApiBuilder { | ||
static create() { | ||
return new OpenApiBuilder(); | ||
static create(doc) { | ||
return new OpenApiBuilder(doc); | ||
} | ||
constructor() { | ||
this.rootDoc = { | ||
constructor(doc) { | ||
this.rootDoc = doc || { | ||
openapi: "3.0.0", | ||
@@ -10,0 +10,0 @@ info: { |
{ | ||
"name": "openapi3-ts", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "TS Model & utils for OpenAPI 3.0.x specification.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -30,2 +30,26 @@ import "mocha"; | ||
}); | ||
it("Build with custom object", () => { | ||
const obj: oa.OpenAPIObject = { | ||
openapi: "3.0.0", | ||
info: { | ||
title: "app1", | ||
version: "version2" | ||
}, | ||
paths: {}, | ||
components: { | ||
schemas: {}, | ||
responses: {}, | ||
parameters: {}, | ||
examples: {}, | ||
requestBodies: {}, | ||
headers: {}, | ||
securitySchemes: {}, | ||
links: {}, | ||
callbacks: {} | ||
}, | ||
tags: [], | ||
servers: [] | ||
}; | ||
expect(OpenApiBuilder.create(obj).getSpec()).eql(obj); | ||
}); | ||
it("addTitle", () => { | ||
@@ -32,0 +56,0 @@ let sut = OpenApiBuilder.create().addTitle("app7").rootDoc; |
@@ -9,8 +9,8 @@ import * as oa from "../model"; | ||
static create(): OpenApiBuilder { | ||
return new OpenApiBuilder(); | ||
static create(doc?: oa.OpenAPIObject): OpenApiBuilder { | ||
return new OpenApiBuilder(doc); | ||
} | ||
constructor() { | ||
this.rootDoc = { | ||
constructor(doc?: oa.OpenAPIObject) { | ||
this.rootDoc = doc || { | ||
openapi: "3.0.0", | ||
@@ -17,0 +17,0 @@ info: { |
Sorry, the diff of this file is not supported yet
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
124701
1678