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

@mintlify/validation

Package Overview
Dependencies
Maintainers
4
Versions
232
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mintlify/validation - npm Package Compare versions

Comparing version 0.1.117 to 0.1.118

1

dist/openapi/OpenApiToEndpointConverter.d.ts

@@ -14,3 +14,4 @@ import { OpenAPIV3_1 } from 'openapi-types';

private convertResponses;
private convertCodeSamples;
static convert(spec: OpenAPIV3_1.Document, path: string, method: HttpMethod, safeParse?: boolean): Endpoint | undefined;
}

@@ -43,2 +43,3 @@ import { BaseConverter } from './BaseConverter.js';

const deprecated = !!operationObject.deprecated;
const codeSamples = this.convertCodeSamples(['#', 'paths', this.path, this.method], operationObject);
const response = this.convertResponses(['#', 'paths', this.path, this.method, 'responses'], operationObject.responses);

@@ -55,2 +56,3 @@ return {

body,
codeSamples,
},

@@ -104,2 +106,41 @@ response,

}
convertCodeSamples(debugPath, operation) {
let key;
let rawCodeSamples;
if ('x-codeSamples' in operation) {
rawCodeSamples = operation['x-codeSamples'];
key = 'x-codeSamples';
}
else if ('x-code-samples' in operation) {
rawCodeSamples = operation['x-code-samples'];
key = 'x-code-samples';
}
else {
return undefined;
}
if (!Array.isArray(rawCodeSamples)) {
this.handleNewError(InvalidSchemaError, [...debugPath, key], `${key} must be an array`);
return;
}
const codeSamples = [];
rawCodeSamples.forEach((codeSample) => {
if (!codeSample ||
typeof codeSample !== 'object' ||
!('source' in codeSample) ||
typeof codeSample.source !== 'string' ||
!('lang' in codeSample) ||
typeof codeSample.lang !== 'string') {
this.handleNewError(InvalidSchemaError, [...debugPath, key], 'invalid code sample');
return;
}
codeSamples.push({
label: 'label' in codeSample && typeof codeSample.label === 'string'
? codeSample.label
: undefined,
lang: codeSample['lang'].toLowerCase(),
source: codeSample['source'],
});
});
return codeSamples;
}
static convert(spec, path, method, safeParse) {

@@ -106,0 +147,0 @@ return new OpenApiToEndpointConverter(spec, path, method, safeParse).convert();

@@ -35,3 +35,9 @@ export type Endpoint = {

body: BodySchema;
codeSamples?: CodeSample[];
};
export type CodeSample = {
label?: string;
lang: string;
source: string;
};
export type BodySchema = {

@@ -38,0 +44,0 @@ [contentType: string]: ContentSchema;

4

package.json
{
"name": "@mintlify/validation",
"version": "0.1.117",
"version": "0.1.118",
"description": "Validates mint.json files",

@@ -72,3 +72,3 @@ "author": "Mintlify, Inc.",

},
"gitHead": "e316deba89f166b69f5c5d94c3122f6f1d54a848"
"gitHead": "168db52ca32ca45c5b7f1b47a2b1f6e1b33eaf3d"
}

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