New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@scalar/openapi-parser

Package Overview
Dependencies
Maintainers
0
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@scalar/openapi-parser - npm Package Compare versions

Comparing version 0.8.9 to 0.8.10

dist/utils/transform/index.d.ts

6

CHANGELOG.md
# @scalar/openapi-parser
## 0.8.10
### Patch Changes
- 98e9cb2: feat: new `sanitize` utility to make documents OpenAPI-compliant
## 0.8.9

@@ -4,0 +10,0 @@

3

dist/index.js

@@ -27,1 +27,4 @@ export { ERRORS, OpenApiSpecifications, OpenApiVersions } from './configuration/index.js';

export { validate } from './utils/validate.js';
export { DEFAULT_OPENAPI_VERSION } from './utils/transform/utils/addLatestOpenApiVersion.js';
export { DEFAULT_TITLE, DEFAULT_VERSION } from './utils/transform/utils/addInfoObject.js';
export { sanitize } from './utils/transform/sanitize.js';

2

dist/utils/dereference.d.ts
import type { AnyApiDefinitionFormat, DereferenceResult, Filesystem, ThrowOnErrorOption } from '../types';
export type DereferenceOptions = ThrowOnErrorOption;
/**
* Validates an OpenAPI schema and resolves all references.
* Resolves all references in an OpenAPI document
*/
export declare function dereference(value: AnyApiDefinitionFormat | Filesystem, options?: DereferenceOptions): Promise<DereferenceResult>;
//# sourceMappingURL=dereference.d.ts.map

@@ -7,3 +7,3 @@ import { details } from './details.js';

/**
* Validates an OpenAPI schema and resolves all references.
* Resolves all references in an OpenAPI document
*/

@@ -10,0 +10,0 @@ async function dereference(value, options) {

import type { AnyObject, DetailsResult } from '../types';
/**
* Get versions of the OpenAPI specification.
* Get versions of the OpenAPI document.
*/
export declare function details(specification: AnyObject): DetailsResult;
//# sourceMappingURL=details.d.ts.map
import { OpenApiVersions } from '../configuration/index.js';
/**
* Get versions of the OpenAPI specification.
* Get versions of the OpenAPI document.
*/

@@ -6,0 +6,0 @@ function details(specification) {

@@ -26,2 +26,3 @@ export * from './dereference.js';

export * from './validate.js';
export * from './transform';
//# sourceMappingURL=index.d.ts.map
import type { AnyObject, Filesystem } from '../types';
/**
* Normalize the OpenAPI specification to a JavaScript object.
* Don’t touch the object if it’s a `Filesystem` (multiple files).
* Normalize the OpenAPI document (YAML, JSON, object) to a JavaScript object.
*
* Doesn’t modify the object if it’s a `Filesystem` (multiple files) already.
*/
export declare function normalize(specification: string | AnyObject | Filesystem): AnyObject | Filesystem;
//# sourceMappingURL=normalize.d.ts.map

@@ -5,4 +5,5 @@ import { parse } from 'yaml';

/**
* Normalize the OpenAPI specification to a JavaScript object.
* Don’t touch the object if it’s a `Filesystem` (multiple files).
* Normalize the OpenAPI document (YAML, JSON, object) to a JavaScript object.
*
* Doesn’t modify the object if it’s a `Filesystem` (multiple files) already.
*/

@@ -9,0 +10,0 @@ function normalize(specification) {

import type { AnyObject, Filesystem, ThrowOnErrorOption, ValidateResult } from '../types';
export type ValidateOptions = ThrowOnErrorOption;
/**
* Validates an OpenAPI schema.
* Validates an OpenAPI document
*/
export declare function validate(value: string | AnyObject | Filesystem, options?: ValidateOptions): Promise<ValidateResult>;
//# sourceMappingURL=validate.d.ts.map

@@ -5,3 +5,3 @@ import { makeFilesystem } from './makeFilesystem.js';

/**
* Validates an OpenAPI schema.
* Validates an OpenAPI document
*/

@@ -8,0 +8,0 @@ async function validate(value, options) {

@@ -20,3 +20,3 @@ {

],
"version": "0.8.9",
"version": "0.8.10",
"engines": {

@@ -68,3 +68,3 @@ "node": ">=18"

"tinybench": "^2.8.0",
"@scalar/build-tooling": "0.1.11",
"@scalar/build-tooling": "0.1.12",
"@scalar/openapi-types": "0.1.5"

@@ -71,0 +71,0 @@ },

@@ -66,3 +66,3 @@ # Scalar OpenAPI Parser

### Modify an OpenAPI specification
### Modify an OpenAPI document

@@ -84,5 +84,5 @@ ```ts

### Upgrade your OpenAPI specification
### Upgrade your OpenAPI document
There’s an `upgrade` command to upgrade all your OpenAPI specifications to the latest OpenAPI version.
There’s an `upgrade` command to upgrade all your OpenAPI documents to the latest OpenAPI version.

@@ -107,2 +107,25 @@ > ⚠️ The upgrade from Swagger 2.0 is still experimental and probably lacks features.

### Sanitize your OpenAPI document
The `sanitize()` utility helps ensure your OpenAPI document is valid and complete.
It automatically adds any missing required properties like the OpenAPI version and info object, collects operation tags
and adds them to the global tags array and normalizes security scheme types.
This makes your document as OpenAPI-compliant as possible with minimal effort, handling many common specification
requirements automatically.
> ⚠️ This doesn’t support Swagger 2.0 documents.
```ts
import { sanitize } from '@scalar/openapi-parser'
const result = sanitize({
info: {
title: 'Hello World',
},
})
console.log(result)
```
### Pipeline syntax

@@ -109,0 +132,0 @@

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

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