deckardcain
Advanced tools
Comparing version 0.3.5 to 0.4.0
@@ -22,2 +22,7 @@ 'use strict'; | ||
exports.SWAGGER_YAML = SWAGGER_YAML; | ||
var OPENAPI_JSON = /^[\uFEFF]?{[\s\S]*["']openapi["']\s*:\s*["']\d\.\d+.\d+["'],?/i; | ||
exports.OPENAPI_JSON = OPENAPI_JSON; | ||
var OPENAPI_YAML = /(?:^|\n)\s*openapi: ["']\d\.\d+.\d+["']\n/i; | ||
exports.OPENAPI_YAML = OPENAPI_YAML; | ||
var REFRACT_API_DESCRIPTION_ELEMENT_JSON = /[\uFEFF]?\n?\s*["']element["']\s*:\s*["']category["']/i; | ||
@@ -58,2 +63,11 @@ exports.REFRACT_API_DESCRIPTION_ELEMENT_JSON = REFRACT_API_DESCRIPTION_ELEMENT_JSON; | ||
// see https://stackoverflow.com/questions/52541842/what-is-the-media-type-of-an-openapi-schema | ||
if (source.match(OPENAPI_YAML)) { | ||
return 'application/vnd.oai.openapi'; | ||
} | ||
if (source.match(OPENAPI_JSON)) { | ||
return 'application/vnd.oai.openapi+json'; | ||
} | ||
if (source.match(REFRACT_API_DESCRIPTION_ELEMENT_JSON) && source.match(REFRACT_API_DESCRIPTION_CLASS_JSON) && !source.match(REFRACT_PARSE_RESULT_ELEMENT_JSON)) { | ||
@@ -60,0 +74,0 @@ // File contains element `category` with class `api`, but |
{ | ||
"name": "deckardcain", | ||
"version": "0.3.5", | ||
"version": "0.4.0", | ||
"description": "Identifies (media) type of API description files", | ||
@@ -5,0 +5,0 @@ "main": "lib/deckardcain", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
9393
81