hapi-swagger
Advanced tools
Comparing version 14.1.2 to 14.1.3
@@ -36,3 +36,15 @@ const Hoek = require('@hapi/hoek'); | ||
sortPaths: Joi.string().valid('unsorted', 'path-method'), | ||
uiCompleteScript: Joi.string().allow(null), | ||
// patch: uiCompleteScript -- Define validation scope | ||
// to have another ability, you may use plain js script as "string" | ||
// or use external file by describe it as { src: 'URL' } | ||
// you may provide external js file as URL from static route, | ||
// eg: '/assets/js/doc-patch.js' | ||
uiCompleteScript: Joi.alternatives( | ||
Joi.string(), | ||
Joi.object() | ||
.keys({ | ||
src: Joi.string().required() | ||
}) | ||
).allow(null), | ||
xProperties: Joi.boolean(), | ||
@@ -128,2 +140,17 @@ reuseDefinitions: Joi.boolean(), | ||
// patch: uiCompleteScript -- Implementing | ||
// mutate the uiCompleteScript before render into h.views | ||
if ( | ||
(settings.uiCompleteScript !== '') && | ||
(settings.uiCompleteScript !== null) && | ||
(typeof settings.uiCompleteScript === 'object') | ||
) { | ||
settings.uiCompleteScript = ` | ||
const s = document.createElement('script'); | ||
s.src = '${settings.uiCompleteScript.src}'; | ||
s.type = 'text/javascript'; | ||
document.body.appendChild(s); | ||
`; | ||
} | ||
Joi.assert(settings, schema); | ||
@@ -130,0 +157,0 @@ |
{ | ||
"name": "hapi-swagger", | ||
"description": "A swagger documentation UI generator plugin for hapi", | ||
"version": "14.1.2", | ||
"version": "14.1.3", | ||
"author": "Glenn Jones", | ||
@@ -35,3 +35,3 @@ "repository": { | ||
"start:routes:simple": "node examples/group-ordered.js", | ||
"test": "npm run test:lib", | ||
"test": "yarn test:lib", | ||
"test:lib": "lab -L -t 98 -I '__core-js_shared__,regeneratorRuntime,core,CSS'", | ||
@@ -41,5 +41,4 @@ "test:ts": "tsd", | ||
"test:cov:html": "lab -r html -o coverage.html", | ||
"test:cov:coveralls": "npx lab -r lcov | npx coveralls", | ||
"precommit": "npm test", | ||
"postversion": "npm publish", | ||
"precommit": "yarn test", | ||
"postversion": "yarn publish", | ||
"postpublish": "git push origin --all; git push origin --tags" | ||
@@ -46,0 +45,0 @@ }, |
@@ -6,4 +6,3 @@ # hapi-swagger | ||
[![build status](https://img.shields.io/travis/glennjones/hapi-swagger.svg?style=for-the-badge)](http://travis-ci.org/glennjones/hapi-swagger) | ||
[![Coverage Status](https://img.shields.io/coveralls/glennjones/hapi-swagger/dev.svg?style=for-the-badge)](https://coveralls.io/r/glennjones/hapi-swagger) | ||
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/glennjones/hapi-swagger/Node.js%20CI?style=for-the-badge) | ||
[![npm downloads](https://img.shields.io/npm/dm/hapi-swagger.svg?style=for-the-badge)](https://www.npmjs.com/package/hapi-swagger) | ||
@@ -10,0 +9,0 @@ [![MIT license](http://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge)](https://raw.github.com/glennjones/hapi-swagger/master/license.txt) |
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
110216
3036
172