@digitalroute/bagger
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -15,2 +15,3 @@ "use strict"; | ||
var clean_object_1 = require("./utils/clean_object"); | ||
var validate_schema_1 = require("./utils/validate-schema"); | ||
function compileRequests(requests) { | ||
@@ -34,5 +35,10 @@ var compiledRequests = requests.map(function (request) { return request.compile(); }); | ||
var paths = compileRequests(requests); | ||
return clean_object_1.cleanObject(__assign({}, configuration, { openapi: '3.0', paths: paths, | ||
var swaggerDefinition = clean_object_1.cleanObject(__assign({}, configuration, { openapi: '3.0.0', paths: paths, | ||
components: components })); | ||
var errors = validate_schema_1.validateSchema(swaggerDefinition); | ||
if (errors.length > 0) { | ||
throw new Error(JSON.stringify(errors)); | ||
} | ||
return swaggerDefinition; | ||
} | ||
exports.compile = compile; |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -32,3 +43,3 @@ var BaggerRequest = /** @class */ (function () { | ||
}; | ||
BaggerRequest.prototype.security = function (scheme, scopes) { | ||
BaggerRequest.prototype.addSecurity = function (scheme, scopes) { | ||
if (scopes === void 0) { scopes = []; } | ||
@@ -47,7 +58,8 @@ if (!this.operationContext.security) { | ||
}; | ||
BaggerRequest.prototype.response = function (response) { | ||
BaggerRequest.prototype.addResponse = function (response) { | ||
if (!this.operationContext.responses) { | ||
this.operationContext.responses = []; | ||
this.operationContext.responses = {}; | ||
} | ||
this.operationContext.responses.push(response.compile()); | ||
var responseDefinition = response.compile(); | ||
this.operationContext.responses = __assign({}, responseDefinition, this.operationContext.responses); | ||
return this; | ||
@@ -54,0 +66,0 @@ }; |
@@ -15,6 +15,6 @@ import { BaggerResponse } from './response'; | ||
addTag(tag: string): BaggerRequest; | ||
security(scheme: string, scopes?: string[]): BaggerRequest; | ||
addSecurity(scheme: string, scopes?: string[]): BaggerRequest; | ||
body(requestBody: BaggerRequestBody): BaggerRequest; | ||
response(response: BaggerResponse): BaggerRequest; | ||
addResponse(response: BaggerResponse): BaggerRequest; | ||
compile(): PathsObject; | ||
} |
{ | ||
"name": "@digitalroute/bagger", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "🎒 A joi-compatible tool for building swagger definitions", | ||
@@ -50,2 +50,3 @@ "main": "dist/bagger.umd.js", | ||
"@types/hapi__joi": "^15.0.3", | ||
"ajv": "^6.10.2", | ||
"content-type": "^1.0.4", | ||
@@ -52,0 +53,0 @@ "joi": "^14.3.1", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
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
1722999
26
19385
8
3
+ Addedajv@^6.10.2
+ Addedajv@6.12.6(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addeduri-js@4.4.1(transitive)