openapi-mock-express-middleware
Advanced tools
Comparing version 4.0.1 to 4.1.1
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -0,1 +1,2 @@ | ||
/// <reference types="cookie-parser" /> | ||
import { OpenAPIV3 } from 'openapi-types'; | ||
@@ -2,0 +3,0 @@ import express from 'express'; |
@@ -0,1 +1,2 @@ | ||
/// <reference types="cookie-parser" /> | ||
import { OpenAPIV3 } from 'openapi-types'; | ||
@@ -2,0 +3,0 @@ import { Request } from 'express'; |
import { JSF, JSFOptions } from 'json-schema-faker'; | ||
export { JSONSchema, JSFOptions, JSF } from 'json-schema-faker'; | ||
export declare type JSFCallback = (jsfInstance: JSF) => void; | ||
export type JSFCallback = (jsfInstance: JSF) => void; | ||
export declare const handleExamples: (value: any) => any; | ||
export declare const createGenerator: (options?: Partial<JSFOptions>, callback?: JSFCallback) => JSF; |
@@ -8,4 +8,6 @@ "use strict"; | ||
const json_schema_faker_1 = __importDefault(require("json-schema-faker")); | ||
const lodash_1 = require("lodash"); | ||
const defaultOptions = { | ||
optionalsProbability: 0.5, | ||
useExamplesValue: true, | ||
}; | ||
@@ -24,9 +26,12 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
const createGenerator = (options = defaultOptions, callback = (() => { })) => { | ||
json_schema_faker_1.default.option(Object.assign(Object.assign({}, defaultOptions), options)); | ||
json_schema_faker_1.default.define('example', (value) => { | ||
return value; | ||
}); | ||
json_schema_faker_1.default.define('examples', exports.handleExamples); | ||
callback(json_schema_faker_1.default); | ||
return json_schema_faker_1.default; | ||
const applyedOptions = Object.assign(Object.assign({}, defaultOptions), options); | ||
const generator = (0, lodash_1.cloneDeep)(json_schema_faker_1.default); | ||
generator.option(applyedOptions); | ||
if (applyedOptions.useExamplesValue) { | ||
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */ | ||
generator.define('example', (value) => value); | ||
generator.define('examples', exports.handleExamples); | ||
} | ||
callback(generator); | ||
return generator; | ||
}; | ||
@@ -33,0 +38,0 @@ exports.createGenerator = createGenerator; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
{ | ||
"name": "openapi-mock-express-middleware", | ||
"version": "4.0.1", | ||
"version": "4.1.1", | ||
"description": "Generates express mock-servers from OpenAPI specs", | ||
@@ -20,3 +20,4 @@ "main": "dist/index.js", | ||
"release": "standard-version", | ||
"commit": "git-cz" | ||
"commit": "git-cz", | ||
"prepare": "husky || true" | ||
}, | ||
@@ -59,3 +60,3 @@ "engines": { | ||
"method-override": "^3.0.0", | ||
"openapi-types": "^10.0.0", | ||
"openapi-types": "^12.1.3", | ||
"path-to-regexp": "^6.2.0" | ||
@@ -66,33 +67,28 @@ }, | ||
"@types/express": "^4.17.13", | ||
"@types/jest": "^27.4.0", | ||
"@types/jest": "^29.5.12", | ||
"@types/lodash": "^4.14.178", | ||
"@types/method-override": "0.0.32", | ||
"@types/node": "^17.0.13", | ||
"@types/supertest": "^2.0.11", | ||
"@typescript-eslint/eslint-plugin": "^5.10.2", | ||
"@typescript-eslint/parser": "^5.10.2", | ||
"@types/method-override": "0.0.35", | ||
"@types/node": "^20.11.25", | ||
"@types/supertest": "^6.0.2", | ||
"@typescript-eslint/eslint-plugin": "^7.2.0", | ||
"@typescript-eslint/parser": "^7.2.0", | ||
"commitizen": "^4.2.4", | ||
"concurrently": "^7.0.0", | ||
"concurrently": "^8.2.2", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"eslint": "^8.8.0", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-import": "^2.25.4", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"husky": "^7.0.4", | ||
"jest": "^27.4.7", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"husky": "^9.0.11", | ||
"jest": "^29.7.0", | ||
"json-schema-faker-types": "^0.1.6", | ||
"nodemon": "^2.0.15", | ||
"prettier": "^2.5.1", | ||
"nodemon": "^3.1.0", | ||
"prettier": "^3.2.5", | ||
"standard-version": "^9.3.2", | ||
"supertest": "^6.2.2", | ||
"ts-jest": "^27.1.3", | ||
"ts-jest": "^29.1.2", | ||
"ts-node": "^10.4.0", | ||
"typescript": "^4.5.5" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "./scripts/process-staged-files" | ||
} | ||
}, | ||
"config": { | ||
@@ -99,0 +95,0 @@ "commitizen": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
1376
100392
57
+ Addedopenapi-types@12.1.3(transitive)
- Removedopenapi-types@10.0.0(transitive)
Updatedopenapi-types@^12.1.3