openapi3-ts
Advanced tools
Comparing version 0.11.0 to 0.12.0
@@ -9,3 +9,3 @@ import * as oa from "../model"; | ||
getSpecAsYaml(): string; | ||
private static isValidOpenApiVersion(v?); | ||
private static isValidOpenApiVersion; | ||
addOpenApiVersion(openApiVersion: string): OpenApiBuilder; | ||
@@ -12,0 +12,0 @@ addInfo(info: oa.InfoObject): OpenApiBuilder; |
@@ -89,3 +89,3 @@ import { ISpecificationExtension } from "./SpecificationExtension"; | ||
trace?: OperationObject; | ||
servers?: ServerObject; | ||
servers?: ServerObject[]; | ||
parameters?: (ParameterObject | ReferenceObject)[]; | ||
@@ -105,3 +105,3 @@ } | ||
security?: SecurityRequirementObject[]; | ||
servers?: ServerObject; | ||
servers?: ServerObject[]; | ||
} | ||
@@ -108,0 +108,0 @@ export interface ExternalDocumentationObject extends ISpecificationExtension { |
{ | ||
"name": "openapi3-ts", | ||
"version": "0.11.0", | ||
"version": "0.12.0", | ||
"description": "TS Model & utils for OpenAPI 3.0.x specification.", | ||
@@ -53,14 +53,14 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@types/chai": "^4.1.2", | ||
"@types/mocha": "^5.2.0", | ||
"@types/node": "^9.6.6", | ||
"@types/chai": "^4.1.3", | ||
"@types/mocha": "^5.2.1", | ||
"@types/node": "^10.0.3", | ||
"chai": "^4.1.2", | ||
"coveralls": "^3.0.0", | ||
"mocha": "^5.1.1", | ||
"nyc": "^11.7.1", | ||
"coveralls": "^3.0.1", | ||
"mocha": "^5.2.0", | ||
"nyc": "^12.0.1", | ||
"rimraf": "^2.6.2", | ||
"ts-node": "^6.0.0", | ||
"tslint": "^5.9.1", | ||
"typescript": "^2.8.3" | ||
"ts-node": "^6.1.0", | ||
"tslint": "^5.10.0", | ||
"typescript": "^2.9.1" | ||
} | ||
} |
@@ -8,3 +8,2 @@ # OpenApi3-TS | ||
[![Dependency Status](https://david-dm.org/metadevpro/openapi3-ts.svg)](https://david-dm.org/metadevpro/openapi3-ts) | ||
[![bitHound Overall Score](https://www.bithound.io/github/metadevpro/openapi3-ts/badges/score.svg)](https://www.bithound.io/github/metadevpro/openapi3-ts) | ||
[![Known Vulnerabilities](https://snyk.io/test/github/metadevpro/openapi3-ts/badge.svg)](https://snyk.io/test/github/metadevpro/openapi3-ts) | ||
@@ -31,3 +30,3 @@ [![npm version](https://badge.fury.io/js/openapi3-ts.svg)](http://badge.fury.io/js/openapi3-ts) | ||
* OpenAPI spec 3.0.0. [https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md) | ||
* OpenAPI spec 3.0.1. [https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md) | ||
@@ -40,2 +39,2 @@ ## License | ||
(c) 2017-2018. [Pedro J. Molina](http://pjmolina.com) at Metadev S.L. [https://metadev.pro](https://metadev.pro) | ||
(c) 2017-2018. [Pedro J. Molina](http://pjmolina.com) at Metadev S.L. [https://metadev.pro](https://metadev.pro) |
import "mocha"; | ||
import { expect } from "chai"; | ||
import { OpenApiBuilder } from "./OpenApiBuilder"; | ||
import { OpenApiBuilder } from "."; | ||
import * as oa from "../model"; | ||
@@ -51,2 +51,29 @@ | ||
}); | ||
it("addOpenApiVersion empty", (done) => { | ||
try { | ||
let sut = OpenApiBuilder.create().addOpenApiVersion("").rootDoc; | ||
done("failed"); | ||
} | ||
catch (err) { | ||
done(); | ||
} | ||
}); | ||
it("addOpenApiVersion null", (done) => { | ||
try { | ||
let sut = OpenApiBuilder.create().addOpenApiVersion(null).rootDoc; | ||
done("failed"); | ||
} | ||
catch (err) { | ||
done(); | ||
} | ||
}); | ||
it("addOpenApiVersion lower than 3", (done) => { | ||
try { | ||
let sut = OpenApiBuilder.create().addOpenApiVersion("2.5.6").rootDoc; | ||
done("failed"); | ||
} | ||
catch (err) { | ||
done(); | ||
} | ||
}); | ||
it("addInfo", () => { | ||
@@ -256,2 +283,19 @@ let info: oa.InfoObject = { | ||
}); | ||
it("get invalid Path", () => { | ||
let path1 = { | ||
get: { | ||
responses: { | ||
default: { | ||
description: "object created" | ||
} | ||
} | ||
} | ||
}; | ||
const sut = OpenApiBuilder.create() | ||
.addPath('/service7', path1) | ||
.rootDoc; | ||
oa.addExtension(sut.paths, 'x-my-extension', 42); | ||
expect(oa.getPath(sut.paths, 'x-path')).eql(undefined); | ||
}); | ||
it("getExtension", () => { | ||
@@ -275,3 +319,20 @@ let path1 = { | ||
}); | ||
it("retrieve invalid extension", () => { | ||
let path1 = { | ||
get: { | ||
responses: { | ||
default: { | ||
description: "object created" | ||
} | ||
} | ||
} | ||
}; | ||
const sut = OpenApiBuilder.create() | ||
.addPath('/service7', path1) | ||
.rootDoc; | ||
oa.addExtension(sut.paths, 'x-my-extension', 42); | ||
expect(oa.getExtension(sut.paths, 'y-other')).eql(undefined); | ||
}); | ||
describe("Serialize", () => { | ||
@@ -287,3 +348,16 @@ it("getSpecAsJson", () => { | ||
}); | ||
it("getSpecAsYaml", (done) => { | ||
try { | ||
let sut = OpenApiBuilder.create() | ||
.addTitle("app9") | ||
.addVersion("5.6.7") | ||
.getSpecAsYaml(); | ||
done('Not implemented'); | ||
} | ||
catch (e) { | ||
expect(e.message).eql('Not yet implemented.'); | ||
done(); | ||
} | ||
}); | ||
}); | ||
}); |
@@ -101,3 +101,3 @@ // Typed interfaces for OpenAPI 3.0.0-RC | ||
trace?: OperationObject; | ||
servers?: ServerObject; | ||
servers?: ServerObject[]; | ||
parameters?: (ParameterObject | ReferenceObject)[]; | ||
@@ -117,3 +117,3 @@ } | ||
security?: SecurityRequirementObject[]; | ||
servers?: ServerObject; | ||
servers?: ServerObject[]; | ||
} | ||
@@ -120,0 +120,0 @@ export interface ExternalDocumentationObject extends ISpecificationExtension { |
import "mocha"; | ||
import { expect } from "chai"; | ||
import { SpecificationExtension, ISpecificationExtension } from "./SpecificationExtension"; | ||
import { SpecificationExtension, ISpecificationExtension } from "./"; | ||
@@ -5,0 +5,0 @@ describe("SpecificationExtension", () => { |
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
40
1692
143769