Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

oas-normalize

Package Overview
Dependencies
Maintainers
10
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oas-normalize - npm Package Compare versions

Comparing version 5.0.0 to 5.0.1

17

index.js

@@ -10,3 +10,8 @@ const fetch = require('node-fetch');

this.file = file;
this.opts = { enablePaths: false, ...opts };
this.opts = {
colorizeErrors: false,
enablePaths: false,
...opts,
};
this.type = utils.type(this.file);

@@ -73,3 +78,5 @@

async validate(convertToLatest) {
async validate(convertToLatest = false) {
const colorizeErrors = this.opts.colorizeErrors;
return this.load().then(async schema => {

@@ -89,3 +96,7 @@ const baseVersion = parseInt(utils.version(schema), 10);

return openapiParser
.validate(clonedSchema)
.validate(clonedSchema, {
validate: {
colorizeErrors,
},
})
.then(() => {

@@ -92,0 +103,0 @@ if (!convertToLatest) {

2

package.json
{
"name": "oas-normalize",
"version": "5.0.0",
"version": "5.0.1",
"description": "OpenAPI 3.x or Swagger 2.0? YAML or JSON? URL, path, string or object? Who cares! It just works.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -86,1 +86,15 @@ OpenAPI 3.x or Swagger 2.0? YAML or JSON? URL, path, string or object? Who cares! It just works.

```
### Colorized errors
If you wish errors from `.validate()` to be styled and colorized, supply `colorizeErrors: true` to your instance of `OASNormalize`:
```js
const oas = new OASNormalize('https://example.com/petstore.json', {
colorizeErrors: true,
})
```
Error messages will look like such:
<img src="https://user-images.githubusercontent.com/33762/137796648-7e1157c2-cee4-466e-9129-dd2a743dd163.png" width="600" />
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc