@@ -1732,3 +1732,163 @@ function obj0(path, value, context) {
17321732 return result ;
17331733} "
17341734` ;
1735+
1736+ exports [` OpenAPI 3.1 type: null 1` ] = `
1737+ "/**
1738+ Validate a request against the OpenAPI spec
1739+ @param { { method: string ; path : string ; body ?: any ; query : Record < string , string | string[]>; headers: Record < string , string>; }} request - Input request to validate
1740+ @param { { stringFormats?: { [format : string ]: (value : string , path : string []) => ValidationError | string | null } } } [context] - Context object to pass to validation functions
1741+ @returns { { operationId?: string; params: Record < string , string>; query: Record < string , string | string[]>; body?: any; headers: Record < string , string>; }}
1742+ */
1743+ export function validateRequest(request, context) {
1744+ return new RequestError (404 , ' no operation match path' );
1745+ }
1746+ /**
1747+ Map of all components defined in the spec to their validation functions.
1748+ { Object .< string , <T >(path : string [], value : T , context : any ) => (T | ValidationError )> }
1749+ */
1750+ export const componentSchemas = { } ;
1751+ export class RequestError extends Error {
1752+ /** @param {number} code HTTP code for the error
1753+ @param {string} message The error message*/
1754+ constructor (code , message ) {
1755+ super(message );
1756+ /** @type {number} HTTP code for the error*/
1757+ this.code = code;
1758+ }
1759+ }
1760+ export class ValidationError extends RequestError {
1761+ /** @param {string[]} path The path that failed validation
1762+ @param {string} message The error message*/
1763+ constructor (path , message ) {
1764+ super(409, message );
1765+ /** @type {string[]} The path that failed validation*/
1766+ this.path = path;
1767+ }
1768+ }
1769+ function obj0(path, value, context) {
1770+ if (value !== null ) {
1771+ return new ValidationError(path , 'expected null ');
1772+ }
1773+ return value ;
1774+ } "
1775+ ` ;
1776+
1777+ exports [` OpenAPI 3.1 type array type: [string, null] 1` ] = `
1778+ "/**
1779+ Validate a request against the OpenAPI spec
1780+ @param { { method: string ; path : string ; body ?: any ; query : Record < string , string | string[]>; headers: Record < string , string>; }} request - Input request to validate
1781+ @param { { stringFormats?: { [format : string ]: (value : string , path : string []) => ValidationError | string | null } } } [context] - Context object to pass to validation functions
1782+ @returns { { operationId?: string; params: Record < string , string>; query: Record < string , string | string[]>; body?: any; headers: Record < string , string>; }}
1783+ */
1784+ export function validateRequest(request, context) {
1785+ return new RequestError (404 , ' no operation match path' );
1786+ }
1787+ /**
1788+ Map of all components defined in the spec to their validation functions.
1789+ { Object .< string , <T >(path : string [], value : T , context : any ) => (T | ValidationError )> }
1790+ */
1791+ export const componentSchemas = { } ;
1792+ export class RequestError extends Error {
1793+ /** @param {number} code HTTP code for the error
1794+ @param {string} message The error message*/
1795+ constructor (code , message ) {
1796+ super(message );
1797+ /** @type {number} HTTP code for the error*/
1798+ this.code = code;
1799+ }
1800+ }
1801+ export class ValidationError extends RequestError {
1802+ /** @param {string[]} path The path that failed validation
1803+ @param {string} message The error message*/
1804+ constructor (path , message ) {
1805+ super(409, message );
1806+ /** @type {string[]} The path that failed validation*/
1807+ this.path = path;
1808+ }
1809+ }
1810+ function obj1(path, value, context) {
1811+ if (typeof value !== ' string' ) {
1812+ return new ValidationError(path , 'expected a string ');
1813+ }
1814+ return value ;
1815+ }
1816+ function obj2(path, value, context) {
1817+ if (value !== null ) {
1818+ return new ValidationError(path , 'expected null ');
1819+ }
1820+ return value ;
1821+ }
1822+ function obj0(path, value, context) {
1823+ const value0 = obj1 (path , value , context );
1824+ if (! (value0 instanceof ValidationError )) {
1825+ return value0;
1826+ }
1827+ const value1 = obj2 (path , value , context );
1828+ if (! (value1 instanceof ValidationError )) {
1829+ return value1;
1830+ }
1831+ return new ValidationError (path , ' expected one of the anyOf schemas to match' );
1832+ } "
1833+ ` ;
1834+
1835+ exports [` OpenAPI 3.1 type array type: [string, number] 1` ] = `
1836+ "/**
1837+ Validate a request against the OpenAPI spec
1838+ @param { { method: string ; path : string ; body ?: any ; query : Record < string , string | string[]>; headers: Record < string , string>; }} request - Input request to validate
1839+ @param { { stringFormats?: { [format : string ]: (value : string , path : string []) => ValidationError | string | null } } } [context] - Context object to pass to validation functions
1840+ @returns { { operationId?: string; params: Record < string , string>; query: Record < string , string | string[]>; body?: any; headers: Record < string , string>; }}
1841+ */
1842+ export function validateRequest(request, context) {
1843+ return new RequestError (404 , ' no operation match path' );
1844+ }
1845+ /**
1846+ Map of all components defined in the spec to their validation functions.
1847+ { Object .< string , <T >(path : string [], value : T , context : any ) => (T | ValidationError )> }
1848+ */
1849+ export const componentSchemas = { } ;
1850+ export class RequestError extends Error {
1851+ /** @param {number} code HTTP code for the error
1852+ @param {string} message The error message*/
1853+ constructor (code , message ) {
1854+ super(message );
1855+ /** @type {number} HTTP code for the error*/
1856+ this.code = code;
1857+ }
1858+ }
1859+ export class ValidationError extends RequestError {
1860+ /** @param {string[]} path The path that failed validation
1861+ @param {string} message The error message*/
1862+ constructor (path , message ) {
1863+ super(409, message );
1864+ /** @type {string[]} The path that failed validation*/
1865+ this.path = path;
1866+ }
1867+ }
1868+ function obj1(path, value, context) {
1869+ if (typeof value !== ' string' ) {
1870+ return new ValidationError(path , 'expected a string ');
1871+ }
1872+ return value ;
1873+ }
1874+ function obj2(path, value, context) {
1875+ if (typeof value === ' string' ) {
1876+ value = Number(value );
1877+ }
1878+ if (typeof value !== ' number' || Number .isNaN (value )) {
1879+ return new ValidationError(path , 'expected a number ');
1880+ }
1881+ return value ;
1882+ }
1883+ function obj0(path, value, context) {
1884+ const value0 = obj1 (path , value , context );
1885+ if (! (value0 instanceof ValidationError )) {
1886+ return value0;
1887+ }
1888+ const value1 = obj2 (path , value , context );
1889+ if (! (value1 instanceof ValidationError )) {
1890+ return value1;
1891+ }
1892+ return new ValidationError (path , ' expected one of the anyOf schemas to match' );
1893+ } "
1894+ ` ;
0 commit comments