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

@scalar/oas-utils

Package Overview
Dependencies
Maintainers
8
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@scalar/oas-utils - npm Package Compare versions

Comparing version 0.1.11 to 0.1.12

dist/normalizeMimeType.d.ts

7

CHANGELOG.md
# @scalar/oas-utils
## 0.1.12
### Patch Changes
- 61b8ddc: fix: doesn’t render preview for mimetype variations like application/foobar+json
- 165b901: feat: dynamic values for generated examples
## 0.1.11

@@ -4,0 +11,0 @@

4

dist/getExampleFromSchema.d.ts

@@ -20,3 +20,7 @@ /**

mode?: 'read' | 'write';
/**
* Dynamic values to add to the example.
*/
variables?: Record<string, any>;
}, level?: number) => any;
//# sourceMappingURL=getExampleFromSchema.d.ts.map

9

dist/index.d.ts
export { createHash } from './createHash';
export { defaultStateFactory, ssrState } from './ssrState';
export { fetchSpecFromUrl } from './fetch-spec';

@@ -8,10 +9,10 @@ export { getExampleFromSchema } from './getExampleFromSchema';

export { getRequestFromOperation } from './getRequestFromOperation';
export type { HttpStatusCode, HttpStatusCodes } from './httpStatusCodes';
export { httpStatusCodes } from './httpStatusCodes';
export { json2xml } from './json2xml';
export { normalizeMimeTypeObject } from './normalizeMimeTypeObject';
export { json2xml } from './json2xml';
export { formatJsonOrYamlString, isJsonString, json, parseJsonOrYaml, transformToJson, yaml, } from './parse';
export { prettyPrintJson } from './prettyPrintJson';
export { defaultStateFactory, ssrState } from './ssrState';
export * from './normalizeMimeType';
export * from './types';
export type { HttpStatusCode, HttpStatusCodes } from './httpStatusCodes';
export { formatJsonOrYamlString, isJsonString, json, parseJsonOrYaml, transformToJson, yaml, } from './parse';
//# sourceMappingURL=index.d.ts.map

@@ -18,2 +18,5 @@ import { parse, stringify } from 'yaml';

const defaultStateFactory = () => ({});
const ssrState = typeof window !== "undefined" ? window.__SCALAR__ ?? defaultStateFactory() : defaultStateFactory();
const yaml = {

@@ -118,2 +121,11 @@ /** Parse and throw if the return value is not an object */

}
if (schema["x-variable"]) {
const value = options?.variables?.[schema["x-variable"]];
if (value !== void 0) {
if (schema.type === "number" || schema.type === "integer") {
return parseInt(value, 10);
}
return value;
}
}
if (Array.isArray(schema.examples) && schema.examples.length > 0) {

@@ -369,2 +381,6 @@ return schema.examples[0];

function normalizeMimeType(contentType) {
return contentType.replace(/;.*$/, "").replace(/\/.+\+/, "/").trim();
}
function normalizeMimeTypeObject(content) {

@@ -378,3 +394,3 @@ if (!content) {

Object.keys(newContent).forEach((key) => {
const newKey = key.replace(/;.*$/, "").replace(/\/.+\+/, "/").trim();
const newKey = normalizeMimeType(key);
newContent[newKey] = newContent[key];

@@ -830,5 +846,2 @@ if (key !== newKey) {

const defaultStateFactory = () => ({});
const ssrState = typeof window !== "undefined" ? window.__SCALAR__ ?? defaultStateFactory() : defaultStateFactory();
export { createHash, defaultStateFactory, fetchSpecFromUrl, formatJsonOrYamlString, getExampleFromSchema, getHarRequest, getParametersFromOperation, getRequestBodyFromOperation, getRequestFromOperation, httpStatusCodes, isJsonString, json, json2xml, normalizeMimeTypeObject, parseJsonOrYaml, prettyPrintJson, ssrState, transformToJson, yaml };
export { createHash, defaultStateFactory, fetchSpecFromUrl, formatJsonOrYamlString, getExampleFromSchema, getHarRequest, getParametersFromOperation, getRequestBodyFromOperation, getRequestFromOperation, httpStatusCodes, isJsonString, json, json2xml, normalizeMimeType, normalizeMimeTypeObject, parseJsonOrYaml, prettyPrintJson, ssrState, transformToJson, yaml };

@@ -19,3 +19,3 @@ {

],
"version": "0.1.11",
"version": "0.1.12",
"engines": {

@@ -22,0 +22,0 @@ "node": ">=18"

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