openapi3-ts
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -39,3 +39,4 @@ "use strict"; | ||
} | ||
static isValidOpenApiVersion(v = "") { | ||
static isValidOpenApiVersion(v) { | ||
v = v || ''; | ||
let match = /(\d+)\.(\d+).(\d+)/.exec(v); | ||
@@ -42,0 +43,0 @@ if (match) { |
@@ -60,3 +60,3 @@ import { ISpecificationExtension } from "./SpecificationExtension"; | ||
headers?: { | ||
[heaer: string]: HeaderObject | ReferenceObject; | ||
[header: string]: HeaderObject | ReferenceObject; | ||
}; | ||
@@ -63,0 +63,0 @@ securitySchemes?: { |
@@ -25,4 +25,4 @@ "use strict"; | ||
listExtensions() { | ||
let res = []; | ||
for (let propName in this) { | ||
const res = []; | ||
for (const propName in this) { | ||
if (this.hasOwnProperty(propName)) { | ||
@@ -29,0 +29,0 @@ if (SpecificationExtension.isValidExtension(propName)) { |
{ | ||
"name": "openapi3-ts", | ||
"version": "1.3.0", | ||
"description": "TS Model & utils for OpenAPI 3.0.x specification.", | ||
"version": "1.4.0", | ||
"description": "TS Model & utils for OpenAPI 3.x specification.", | ||
"main": "dist/index.js", | ||
@@ -19,2 +19,4 @@ "typings": "dist/index.d.ts", | ||
"test": "mocha --recursive --require ts-node/register --require source-map-support/register \"src/**/*.spec.ts\"", | ||
"test:ci": "mocha --recursive --require ts-node/register --require source-map-support/register --reporter mocha-teamcity-reporter \"src/**/*.spec.ts\"", | ||
"cover:ci": "nyc --reporter teamcity --reporter html --reporter json --reporter text npm run test:ci", | ||
"cover": "nyc npm test" | ||
@@ -54,14 +56,15 @@ }, | ||
"devDependencies": { | ||
"@types/chai": "^4.1.7", | ||
"@types/mocha": "^5.2.6", | ||
"@types/node": "^12.0.2", | ||
"@types/chai": "^4.2.11", | ||
"@types/mocha": "^7.0.2", | ||
"@types/node": "^14.0.11", | ||
"chai": "^4.2.0", | ||
"coveralls": "^3.0.3", | ||
"mocha": "^6.1.4", | ||
"nyc": "^14.1.1", | ||
"rimraf": "^2.6.3", | ||
"ts-node": "^8.2.0", | ||
"tslint": "^5.16.0", | ||
"typescript": "^3.4.5" | ||
"coveralls": "^3.1.0", | ||
"mocha": "^7.2.0", | ||
"mocha-teamcity-reporter": "^3.0.0", | ||
"nyc": "^15.1.0", | ||
"rimraf": "^3.0.2", | ||
"ts-node": "^8.10.2", | ||
"tslint": "^6.1.2", | ||
"typescript": "3.4.5" | ||
} | ||
} |
@@ -14,3 +14,2 @@ # OpenApi3-TS | ||
## Includes | ||
@@ -22,5 +21,6 @@ | ||
## Install | ||
Install package via **npm**: | ||
``` | ||
```bash | ||
npm i --save openapi3-ts | ||
@@ -34,7 +34,9 @@ ``` | ||
## License | ||
Licensed under the MIT License. | ||
## Credits | ||
**Contact:** Pedro J. Molina | github: [pjmolina](https://github.com/pjmolina) | twitter: [pmolinam](https://twitter.com/pmolinam) | ||
(c) 2017-2019. [Pedro J. Molina](http://pjmolina.com) at Metadev S.L. [https://metadev.pro](https://metadev.pro) & contributors. | ||
(c) 2017-2020. [Pedro J. Molina](http://pjmolina.com) at Metadev S.L. [https://metadev.pro](https://metadev.pro) & contributors. |
export * from "./OpenApiBuilder"; |
@@ -75,2 +75,11 @@ import "mocha"; | ||
}); | ||
it("addOpenApiVersion missing value", (done) => { | ||
try { | ||
let sut = OpenApiBuilder.create().addOpenApiVersion(null).rootDoc; | ||
done("failed"); | ||
} | ||
catch (err) { | ||
done(); | ||
} | ||
}); | ||
it("addOpenApiVersion empty", (done) => { | ||
@@ -77,0 +86,0 @@ try { |
@@ -49,3 +49,4 @@ import * as oa from "../model"; | ||
private static isValidOpenApiVersion(v: string = ""): boolean { | ||
private static isValidOpenApiVersion(v: string): boolean { | ||
v = v || ''; | ||
let match = /(\d+)\.(\d+).(\d+)/.exec(v); | ||
@@ -52,0 +53,0 @@ if (match) { |
@@ -0,0 +0,0 @@ import "mocha"; |
export * from "./model"; | ||
export * from "./dsl"; |
export * from "./SpecificationExtension"; | ||
export * from "./OpenApi"; | ||
export * from "./Server"; |
import "mocha"; | ||
import { expect } from "chai"; | ||
import { isSchemaObject, isReferenceObject, SchemaObject, ReferenceObject } from "./OpenApi"; | ||
import { addExtension, isSchemaObject, isReferenceObject, SchemaObject, ReferenceObject } from "./OpenApi"; | ||
@@ -31,2 +31,15 @@ describe('type-guards unit tests', () => { | ||
describe('addExtension()', () => { | ||
it('valid extension', () => { | ||
const subject = {}; | ||
addExtension(subject, 'x-extension1', 'myvalue'); | ||
expect(subject['x-extension1']).to.equal('myvalue'); | ||
}); | ||
it('invalid extension', () => { | ||
const subject = {}; | ||
addExtension(subject, 'ZZ-extension1', 'myvalue'); | ||
expect(subject['ZZ-extension1']).not.to.equal('myvalue'); | ||
}); | ||
}); | ||
class TestSchemaObject implements SchemaObject { | ||
@@ -33,0 +46,0 @@ // empty schema |
@@ -61,3 +61,3 @@ // Typed interfaces for OpenAPI 3.0.0-RC | ||
requestBodies?: { [request: string]: RequestBodyObject | ReferenceObject }; | ||
headers?: { [heaer: string]: HeaderObject | ReferenceObject }; | ||
headers?: { [header: string]: HeaderObject | ReferenceObject }; | ||
securitySchemes?: { [securityScheme: string]: SecuritySchemeObject | ReferenceObject }; | ||
@@ -64,0 +64,0 @@ links?: { [link: string]: LinkObject | ReferenceObject }; |
@@ -0,0 +0,0 @@ import "mocha"; |
@@ -0,0 +0,0 @@ import * as oa from "./OpenApi"; |
import "mocha"; | ||
import { expect } from "chai"; | ||
import { SpecificationExtension, ISpecificationExtension } from "./"; | ||
import { SpecificationExtension } from "./SpecificationExtension"; | ||
@@ -5,0 +5,0 @@ describe("SpecificationExtension", () => { |
@@ -38,4 +38,4 @@ // Suport for Specification Extensions | ||
listExtensions(): string[] { | ||
let res: string[] = []; | ||
for (let propName in this) { | ||
const res: string[] = []; | ||
for (const propName in this) { | ||
if (this.hasOwnProperty(propName)) { | ||
@@ -42,0 +42,0 @@ if (SpecificationExtension.isValidExtension(propName)) { |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ { |
Sorry, the diff of this file is not supported yet
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
1830
40
74176
12