From 3c2acdce77266993066f63c3b6025e406f9e3091 Mon Sep 17 00:00:00 2001 From: Martin Acosta Date: Thu, 25 Jul 2024 22:17:04 -0300 Subject: [PATCH] minor fix --- src/writer.js | 4 ++-- test/index.js.snapshot | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/writer.js b/src/writer.js index 5c5dd7b..9947b57 100644 --- a/src/writer.js +++ b/src/writer.js @@ -292,8 +292,8 @@ export const write = async (source, opts = {}) => { w.inlineBlock(() => { // this is necessary to allow validate dynamic json objects if (!optionsKeys.includes('additionalProperties')) { - // optionsKeys.push('additionalProperties') - // options.additionalProperties = true + optionsKeys.push('additionalProperties') + options.additionalProperties = true } optionsKeys.forEach((optionKey) => { diff --git a/test/index.js.snapshot b/test/index.js.snapshot index 946d36f..ef94794 100644 --- a/test/index.js.snapshot +++ b/test/index.js.snapshot @@ -1,9 +1,9 @@ exports[`basic test > basic test cjs 1`] = ` -"/* eslint eslint-comments/no-unlimited-disable: off */\\n/* eslint-disable */\\n// This document was generated automatically by openapi-box\\n\\n/**\\n * @typedef {import('@sinclair/typebox').TSchema} TSchema\\n */\\n\\n/**\\n * @template {TSchema} T\\n * @typedef {import('@sinclair/typebox').Static} Static\\n */\\n\\n/**\\n * @typedef {import('@sinclair/typebox').SchemaOptions} SchemaOptions\\n */\\n\\n/**\\n * @typedef {{\\n * [Path in keyof typeof schema]: {\\n * [Method in keyof typeof schema[Path]]: {\\n * [Prop in keyof typeof schema[Path][Method]]: typeof schema[Path][Method][Prop] extends TSchema ?\\n * Static :\\n * undefined\\n * }\\n * }\\n * }} SchemaType\\n */\\n\\n/**\\n * @typedef {{\\n * [ComponentType in keyof typeof _components]: {\\n * [ComponentName in keyof typeof _components[ComponentType]]: typeof _components[ComponentType][ComponentName] extends TSchema ?\\n * Static :\\n * undefined\\n * }\\n * }} ComponentType\\n */\\n\\nconst { Type: T, TypeRegistry, Kind, CloneType } = require('@sinclair/typebox')\\nconst { Value } = require('@sinclair/typebox/value')\\n\\n/**\\n * @template {TSchema[]} T\\n * @typedef {{\\n * [Kind]: 'UnionOneOf'\\n * static: { [K in keyof T]: Static }[number]\\n * oneOf: T\\n * } & TSchema} TUnionOneOf\\n */\\n\\n/**\\n * @template {TSchema[]} T\\n * @param {[...T]} oneOf\\n * @param {SchemaOptions} [options={}]\\n * @returns {TUnionOneOf}\\n */\\nconst UnionOneOf = (oneOf, options = {}) => {\\n /**\\n * Checks if the value matches exactly one schema in the union.\\n *\\n * @param {TUnionOneOf} schema - The union schema to check against.\\n * @param {unknown} value - The value to check.\\n * @returns {boolean} True if the value matches exactly one schema, otherwise false.\\n */\\n function UnionOneOfCheck(schema, value) {\\n return (\\n 1 ===\\n schema.oneOf.reduce(\\n (acc, schema) => (Value.Check(schema, value) ? acc + 1 : acc),\\n 0\\n )\\n )\\n }\\n\\n if (!TypeRegistry.Has('UnionOneOf'))\\n TypeRegistry.Set('UnionOneOf', UnionOneOfCheck)\\n\\n return /** @type {TUnionOneOf} */ ({\\n ...options,\\n [Kind]: 'UnionOneOf',\\n oneOf\\n })\\n}\\n\\n/**\\n * @namespace\\n */\\nconst refs = {}\\nrefs['ComponentsSchemasDef0'] = T.Object({\\n lat: T.Number(),\\n long: T.Number()\\n})\\nrefs['ComponentsSchemasDef1'] = T.Array(\\n T.Object({\\n title: T.String(),\\n address: T.String(),\\n coordinates: CloneType(refs['ComponentsSchemasDef0'])\\n })\\n)\\n\\nconst schema = {\\n '/hello': {\\n GET: {\\n args: T.Void(),\\n data: T.Any({ 'x-status-code': '200' }),\\n error: T.Union([T.Any({ 'x-status-code': 'default' })])\\n }\\n },\\n '/hello-typed': {\\n GET: {\\n args: T.Void(),\\n data: T.Object(\\n {\\n hello: T.Boolean()\\n },\\n {\\n 'x-status-code': '200',\\n 'x-content-type': 'application/json'\\n }\\n ),\\n error: T.Union([\\n T.Object(\\n {\\n error: T.String()\\n },\\n {\\n 'x-status-code': '404',\\n 'x-content-type': 'application/json'\\n }\\n )\\n ])\\n }\\n },\\n '/multiple-content': {\\n GET: {\\n args: T.Void(),\\n data: T.Object(\\n {\\n name: T.String()\\n },\\n {\\n 'x-status-code': '200',\\n 'x-content-type': 'application/json'\\n }\\n ),\\n error: T.Union([\\n T.Object(\\n {\\n error: T.String()\\n },\\n {\\n 'x-status-code': '404',\\n 'x-content-type': 'application/json'\\n }\\n )\\n ])\\n }\\n },\\n '/some-route/{id}': {\\n POST: {\\n args: T.Object({\\n headers: T.Object({\\n auth: T.String({ 'x-in': 'header' })\\n }),\\n params: T.Object({\\n id: T.String({ 'x-in': 'path' })\\n }),\\n query: T.Object({\\n filter: T.String({ 'x-in': 'query' }),\\n address: T.Array(T.String(), { 'x-in': 'query' }),\\n deep: T.Object(\\n {\\n deepTitle: T.Optional(T.String())\\n },\\n {\\n 'x-in': 'query'\\n }\\n )\\n }),\\n body: T.Object(\\n {\\n human: T.Object({\\n name: T.String(),\\n age: T.Optional(T.Number()),\\n gender: T.Union([T.Literal('batman'), T.Literal('joker')])\\n }),\\n address: CloneType(refs['ComponentsSchemasDef1']),\\n recursive: T.Object({}, {})\\n },\\n {\\n 'x-content-type': 'application/json'\\n }\\n )\\n }),\\n data: T.Object(\\n {\\n params: T.Object({\\n id: T.Optional(T.String())\\n }),\\n query: T.Object({\\n filter: T.String(),\\n address: T.Array(T.String()),\\n deep: T.Object({\\n deepTitle: T.String()\\n })\\n }),\\n body: T.Object({\\n human: T.Object({\\n name: T.String(),\\n age: T.Optional(T.Number()),\\n gender: T.Union([T.Literal('batman'), T.Literal('joker')])\\n }),\\n address: CloneType(refs['ComponentsSchemasDef1']),\\n recursive: T.Object({}, {})\\n })\\n },\\n {\\n 'x-status-code': '201',\\n 'x-content-type': 'application/json'\\n }\\n ),\\n error: T.Union([T.Any({ 'x-status-code': 'default' })])\\n }\\n }\\n}\\n\\nconst _components = {\\n schemas: {\\n 'def-0': CloneType(refs['ComponentsSchemasDef0']),\\n 'def-1': CloneType(refs['ComponentsSchemasDef1'])\\n }\\n}\\n\\nmodule.exports = { schema, components: _components }\\n" +"/* eslint eslint-comments/no-unlimited-disable: off */\\n/* eslint-disable */\\n// This document was generated automatically by openapi-box\\n\\n/**\\n * @typedef {import('@sinclair/typebox').TSchema} TSchema\\n */\\n\\n/**\\n * @template {TSchema} T\\n * @typedef {import('@sinclair/typebox').Static} Static\\n */\\n\\n/**\\n * @typedef {import('@sinclair/typebox').SchemaOptions} SchemaOptions\\n */\\n\\n/**\\n * @typedef {{\\n * [Path in keyof typeof schema]: {\\n * [Method in keyof typeof schema[Path]]: {\\n * [Prop in keyof typeof schema[Path][Method]]: typeof schema[Path][Method][Prop] extends TSchema ?\\n * Static :\\n * undefined\\n * }\\n * }\\n * }} SchemaType\\n */\\n\\n/**\\n * @typedef {{\\n * [ComponentType in keyof typeof _components]: {\\n * [ComponentName in keyof typeof _components[ComponentType]]: typeof _components[ComponentType][ComponentName] extends TSchema ?\\n * Static :\\n * undefined\\n * }\\n * }} ComponentType\\n */\\n\\nconst { Type: T, TypeRegistry, Kind, CloneType } = require('@sinclair/typebox')\\nconst { Value } = require('@sinclair/typebox/value')\\n\\n/**\\n * @template {TSchema[]} T\\n * @typedef {{\\n * [Kind]: 'UnionOneOf'\\n * static: { [K in keyof T]: Static }[number]\\n * oneOf: T\\n * } & TSchema} TUnionOneOf\\n */\\n\\n/**\\n * @template {TSchema[]} T\\n * @param {[...T]} oneOf\\n * @param {SchemaOptions} [options={}]\\n * @returns {TUnionOneOf}\\n */\\nconst UnionOneOf = (oneOf, options = {}) => {\\n /**\\n * Checks if the value matches exactly one schema in the union.\\n *\\n * @param {TUnionOneOf} schema - The union schema to check against.\\n * @param {unknown} value - The value to check.\\n * @returns {boolean} True if the value matches exactly one schema, otherwise false.\\n */\\n function UnionOneOfCheck(schema, value) {\\n return (\\n 1 ===\\n schema.oneOf.reduce(\\n (acc, schema) => (Value.Check(schema, value) ? acc + 1 : acc),\\n 0\\n )\\n )\\n }\\n\\n if (!TypeRegistry.Has('UnionOneOf'))\\n TypeRegistry.Set('UnionOneOf', UnionOneOfCheck)\\n\\n return /** @type {TUnionOneOf} */ ({\\n ...options,\\n [Kind]: 'UnionOneOf',\\n oneOf\\n })\\n}\\n\\n/**\\n * @namespace\\n */\\nconst refs = {}\\nrefs['ComponentsSchemasDef0'] = T.Object({\\n lat: T.Number(),\\n long: T.Number()\\n})\\nrefs['ComponentsSchemasDef1'] = T.Array(\\n T.Object({\\n title: T.String(),\\n address: T.String(),\\n coordinates: CloneType(refs['ComponentsSchemasDef0'])\\n })\\n)\\n\\nconst schema = {\\n '/hello': {\\n GET: {\\n args: T.Void(),\\n data: T.Any({ 'x-status-code': '200' }),\\n error: T.Union([T.Any({ 'x-status-code': 'default' })])\\n }\\n },\\n '/hello-typed': {\\n GET: {\\n args: T.Void(),\\n data: T.Object(\\n {\\n hello: T.Boolean()\\n },\\n {\\n 'x-status-code': '200',\\n 'x-content-type': 'application/json',\\n additionalProperties: true\\n }\\n ),\\n error: T.Union([\\n T.Object(\\n {\\n error: T.String()\\n },\\n {\\n 'x-status-code': '404',\\n 'x-content-type': 'application/json',\\n additionalProperties: true\\n }\\n )\\n ])\\n }\\n },\\n '/multiple-content': {\\n GET: {\\n args: T.Void(),\\n data: T.Object(\\n {\\n name: T.String()\\n },\\n {\\n 'x-status-code': '200',\\n 'x-content-type': 'application/json',\\n additionalProperties: true\\n }\\n ),\\n error: T.Union([\\n T.Object(\\n {\\n error: T.String()\\n },\\n {\\n 'x-status-code': '404',\\n 'x-content-type': 'application/json',\\n additionalProperties: true\\n }\\n )\\n ])\\n }\\n },\\n '/some-route/{id}': {\\n POST: {\\n args: T.Object({\\n headers: T.Object({\\n auth: T.String({ 'x-in': 'header' })\\n }),\\n params: T.Object({\\n id: T.String({ 'x-in': 'path' })\\n }),\\n query: T.Object({\\n filter: T.String({ 'x-in': 'query' }),\\n address: T.Array(T.String(), { 'x-in': 'query' }),\\n deep: T.Object(\\n {\\n deepTitle: T.Optional(T.String())\\n },\\n {\\n 'x-in': 'query',\\n additionalProperties: true\\n }\\n )\\n }),\\n body: T.Object(\\n {\\n human: T.Object({\\n name: T.String(),\\n age: T.Optional(T.Number()),\\n gender: T.Union([T.Literal('batman'), T.Literal('joker')])\\n }),\\n address: CloneType(refs['ComponentsSchemasDef1']),\\n recursive: T.Object(\\n {},\\n {\\n additionalProperties: true\\n }\\n )\\n },\\n {\\n 'x-content-type': 'application/json',\\n additionalProperties: true\\n }\\n )\\n }),\\n data: T.Object(\\n {\\n params: T.Object({\\n id: T.Optional(T.String())\\n }),\\n query: T.Object({\\n filter: T.String(),\\n address: T.Array(T.String()),\\n deep: T.Object({\\n deepTitle: T.String()\\n })\\n }),\\n body: T.Object({\\n human: T.Object({\\n name: T.String(),\\n age: T.Optional(T.Number()),\\n gender: T.Union([T.Literal('batman'), T.Literal('joker')])\\n }),\\n address: CloneType(refs['ComponentsSchemasDef1']),\\n recursive: T.Object(\\n {},\\n {\\n additionalProperties: true\\n }\\n )\\n })\\n },\\n {\\n 'x-status-code': '201',\\n 'x-content-type': 'application/json',\\n additionalProperties: true\\n }\\n ),\\n error: T.Union([T.Any({ 'x-status-code': 'default' })])\\n }\\n }\\n}\\n\\nconst _components = {\\n schemas: {\\n 'def-0': CloneType(refs['ComponentsSchemasDef0']),\\n 'def-1': CloneType(refs['ComponentsSchemasDef1'])\\n }\\n}\\n\\nmodule.exports = { schema, components: _components }\\n" `; exports[`basic test > esm 1`] = ` -"/* eslint eslint-comments/no-unlimited-disable: off */\\n/* eslint-disable */\\n// This document was generated automatically by openapi-box\\n\\n/**\\n * @typedef {import('@sinclair/typebox').TSchema} TSchema\\n */\\n\\n/**\\n * @template {TSchema} T\\n * @typedef {import('@sinclair/typebox').Static} Static\\n */\\n\\n/**\\n * @typedef {import('@sinclair/typebox').SchemaOptions} SchemaOptions\\n */\\n\\n/**\\n * @typedef {{\\n * [Path in keyof typeof schema]: {\\n * [Method in keyof typeof schema[Path]]: {\\n * [Prop in keyof typeof schema[Path][Method]]: typeof schema[Path][Method][Prop] extends TSchema ?\\n * Static :\\n * undefined\\n * }\\n * }\\n * }} SchemaType\\n */\\n\\n/**\\n * @typedef {{\\n * [ComponentType in keyof typeof _components]: {\\n * [ComponentName in keyof typeof _components[ComponentType]]: typeof _components[ComponentType][ComponentName] extends TSchema ?\\n * Static :\\n * undefined\\n * }\\n * }} ComponentType\\n */\\n\\nimport { Type as T, TypeRegistry, Kind, CloneType } from '@sinclair/typebox'\\nimport { Value } from '@sinclair/typebox/value'\\n\\n/**\\n * @template {TSchema[]} T\\n * @typedef {{\\n * [Kind]: 'UnionOneOf'\\n * static: { [K in keyof T]: Static }[number]\\n * oneOf: T\\n * } & TSchema} TUnionOneOf\\n */\\n\\n/**\\n * @template {TSchema[]} T\\n * @param {[...T]} oneOf\\n * @param {SchemaOptions} [options={}]\\n * @returns {TUnionOneOf}\\n */\\nconst UnionOneOf = (oneOf, options = {}) => {\\n /**\\n * Checks if the value matches exactly one schema in the union.\\n *\\n * @param {TUnionOneOf} schema - The union schema to check against.\\n * @param {unknown} value - The value to check.\\n * @returns {boolean} True if the value matches exactly one schema, otherwise false.\\n */\\n function UnionOneOfCheck(schema, value) {\\n return (\\n 1 ===\\n schema.oneOf.reduce(\\n (acc, schema) => (Value.Check(schema, value) ? acc + 1 : acc),\\n 0\\n )\\n )\\n }\\n\\n if (!TypeRegistry.Has('UnionOneOf'))\\n TypeRegistry.Set('UnionOneOf', UnionOneOfCheck)\\n\\n return /** @type {TUnionOneOf} */ ({\\n ...options,\\n [Kind]: 'UnionOneOf',\\n oneOf\\n })\\n}\\n\\n/**\\n * @namespace\\n */\\nconst refs = {}\\nrefs['ComponentsSchemasDef0'] = T.Object({\\n lat: T.Number(),\\n long: T.Number()\\n})\\nrefs['ComponentsSchemasDef1'] = T.Array(\\n T.Object({\\n title: T.String(),\\n address: T.String(),\\n coordinates: CloneType(refs['ComponentsSchemasDef0'])\\n })\\n)\\n\\nconst schema = {\\n '/hello': {\\n GET: {\\n args: T.Void(),\\n data: T.Any({ 'x-status-code': '200' }),\\n error: T.Union([T.Any({ 'x-status-code': 'default' })])\\n }\\n },\\n '/hello-typed': {\\n GET: {\\n args: T.Void(),\\n data: T.Object(\\n {\\n hello: T.Boolean()\\n },\\n {\\n 'x-status-code': '200',\\n 'x-content-type': 'application/json'\\n }\\n ),\\n error: T.Union([\\n T.Object(\\n {\\n error: T.String()\\n },\\n {\\n 'x-status-code': '404',\\n 'x-content-type': 'application/json'\\n }\\n )\\n ])\\n }\\n },\\n '/multiple-content': {\\n GET: {\\n args: T.Void(),\\n data: T.Object(\\n {\\n name: T.String()\\n },\\n {\\n 'x-status-code': '200',\\n 'x-content-type': 'application/json'\\n }\\n ),\\n error: T.Union([\\n T.Object(\\n {\\n error: T.String()\\n },\\n {\\n 'x-status-code': '404',\\n 'x-content-type': 'application/json'\\n }\\n )\\n ])\\n }\\n },\\n '/some-route/{id}': {\\n POST: {\\n args: T.Object({\\n headers: T.Object({\\n auth: T.String({ 'x-in': 'header' })\\n }),\\n params: T.Object({\\n id: T.String({ 'x-in': 'path' })\\n }),\\n query: T.Object({\\n filter: T.String({ 'x-in': 'query' }),\\n address: T.Array(T.String(), { 'x-in': 'query' }),\\n deep: T.Object(\\n {\\n deepTitle: T.Optional(T.String())\\n },\\n {\\n 'x-in': 'query'\\n }\\n )\\n }),\\n body: T.Object(\\n {\\n human: T.Object({\\n name: T.String(),\\n age: T.Optional(T.Number()),\\n gender: T.Union([T.Literal('batman'), T.Literal('joker')])\\n }),\\n address: CloneType(refs['ComponentsSchemasDef1']),\\n recursive: T.Object({}, {})\\n },\\n {\\n 'x-content-type': 'application/json'\\n }\\n )\\n }),\\n data: T.Object(\\n {\\n params: T.Object({\\n id: T.Optional(T.String())\\n }),\\n query: T.Object({\\n filter: T.String(),\\n address: T.Array(T.String()),\\n deep: T.Object({\\n deepTitle: T.String()\\n })\\n }),\\n body: T.Object({\\n human: T.Object({\\n name: T.String(),\\n age: T.Optional(T.Number()),\\n gender: T.Union([T.Literal('batman'), T.Literal('joker')])\\n }),\\n address: CloneType(refs['ComponentsSchemasDef1']),\\n recursive: T.Object({}, {})\\n })\\n },\\n {\\n 'x-status-code': '201',\\n 'x-content-type': 'application/json'\\n }\\n ),\\n error: T.Union([T.Any({ 'x-status-code': 'default' })])\\n }\\n }\\n}\\n\\nconst _components = {\\n schemas: {\\n 'def-0': CloneType(refs['ComponentsSchemasDef0']),\\n 'def-1': CloneType(refs['ComponentsSchemasDef1'])\\n }\\n}\\n\\nexport { schema, _components as components }\\n" +"/* eslint eslint-comments/no-unlimited-disable: off */\\n/* eslint-disable */\\n// This document was generated automatically by openapi-box\\n\\n/**\\n * @typedef {import('@sinclair/typebox').TSchema} TSchema\\n */\\n\\n/**\\n * @template {TSchema} T\\n * @typedef {import('@sinclair/typebox').Static} Static\\n */\\n\\n/**\\n * @typedef {import('@sinclair/typebox').SchemaOptions} SchemaOptions\\n */\\n\\n/**\\n * @typedef {{\\n * [Path in keyof typeof schema]: {\\n * [Method in keyof typeof schema[Path]]: {\\n * [Prop in keyof typeof schema[Path][Method]]: typeof schema[Path][Method][Prop] extends TSchema ?\\n * Static :\\n * undefined\\n * }\\n * }\\n * }} SchemaType\\n */\\n\\n/**\\n * @typedef {{\\n * [ComponentType in keyof typeof _components]: {\\n * [ComponentName in keyof typeof _components[ComponentType]]: typeof _components[ComponentType][ComponentName] extends TSchema ?\\n * Static :\\n * undefined\\n * }\\n * }} ComponentType\\n */\\n\\nimport { Type as T, TypeRegistry, Kind, CloneType } from '@sinclair/typebox'\\nimport { Value } from '@sinclair/typebox/value'\\n\\n/**\\n * @template {TSchema[]} T\\n * @typedef {{\\n * [Kind]: 'UnionOneOf'\\n * static: { [K in keyof T]: Static }[number]\\n * oneOf: T\\n * } & TSchema} TUnionOneOf\\n */\\n\\n/**\\n * @template {TSchema[]} T\\n * @param {[...T]} oneOf\\n * @param {SchemaOptions} [options={}]\\n * @returns {TUnionOneOf}\\n */\\nconst UnionOneOf = (oneOf, options = {}) => {\\n /**\\n * Checks if the value matches exactly one schema in the union.\\n *\\n * @param {TUnionOneOf} schema - The union schema to check against.\\n * @param {unknown} value - The value to check.\\n * @returns {boolean} True if the value matches exactly one schema, otherwise false.\\n */\\n function UnionOneOfCheck(schema, value) {\\n return (\\n 1 ===\\n schema.oneOf.reduce(\\n (acc, schema) => (Value.Check(schema, value) ? acc + 1 : acc),\\n 0\\n )\\n )\\n }\\n\\n if (!TypeRegistry.Has('UnionOneOf'))\\n TypeRegistry.Set('UnionOneOf', UnionOneOfCheck)\\n\\n return /** @type {TUnionOneOf} */ ({\\n ...options,\\n [Kind]: 'UnionOneOf',\\n oneOf\\n })\\n}\\n\\n/**\\n * @namespace\\n */\\nconst refs = {}\\nrefs['ComponentsSchemasDef0'] = T.Object({\\n lat: T.Number(),\\n long: T.Number()\\n})\\nrefs['ComponentsSchemasDef1'] = T.Array(\\n T.Object({\\n title: T.String(),\\n address: T.String(),\\n coordinates: CloneType(refs['ComponentsSchemasDef0'])\\n })\\n)\\n\\nconst schema = {\\n '/hello': {\\n GET: {\\n args: T.Void(),\\n data: T.Any({ 'x-status-code': '200' }),\\n error: T.Union([T.Any({ 'x-status-code': 'default' })])\\n }\\n },\\n '/hello-typed': {\\n GET: {\\n args: T.Void(),\\n data: T.Object(\\n {\\n hello: T.Boolean()\\n },\\n {\\n 'x-status-code': '200',\\n 'x-content-type': 'application/json',\\n additionalProperties: true\\n }\\n ),\\n error: T.Union([\\n T.Object(\\n {\\n error: T.String()\\n },\\n {\\n 'x-status-code': '404',\\n 'x-content-type': 'application/json',\\n additionalProperties: true\\n }\\n )\\n ])\\n }\\n },\\n '/multiple-content': {\\n GET: {\\n args: T.Void(),\\n data: T.Object(\\n {\\n name: T.String()\\n },\\n {\\n 'x-status-code': '200',\\n 'x-content-type': 'application/json',\\n additionalProperties: true\\n }\\n ),\\n error: T.Union([\\n T.Object(\\n {\\n error: T.String()\\n },\\n {\\n 'x-status-code': '404',\\n 'x-content-type': 'application/json',\\n additionalProperties: true\\n }\\n )\\n ])\\n }\\n },\\n '/some-route/{id}': {\\n POST: {\\n args: T.Object({\\n headers: T.Object({\\n auth: T.String({ 'x-in': 'header' })\\n }),\\n params: T.Object({\\n id: T.String({ 'x-in': 'path' })\\n }),\\n query: T.Object({\\n filter: T.String({ 'x-in': 'query' }),\\n address: T.Array(T.String(), { 'x-in': 'query' }),\\n deep: T.Object(\\n {\\n deepTitle: T.Optional(T.String())\\n },\\n {\\n 'x-in': 'query',\\n additionalProperties: true\\n }\\n )\\n }),\\n body: T.Object(\\n {\\n human: T.Object({\\n name: T.String(),\\n age: T.Optional(T.Number()),\\n gender: T.Union([T.Literal('batman'), T.Literal('joker')])\\n }),\\n address: CloneType(refs['ComponentsSchemasDef1']),\\n recursive: T.Object(\\n {},\\n {\\n additionalProperties: true\\n }\\n )\\n },\\n {\\n 'x-content-type': 'application/json',\\n additionalProperties: true\\n }\\n )\\n }),\\n data: T.Object(\\n {\\n params: T.Object({\\n id: T.Optional(T.String())\\n }),\\n query: T.Object({\\n filter: T.String(),\\n address: T.Array(T.String()),\\n deep: T.Object({\\n deepTitle: T.String()\\n })\\n }),\\n body: T.Object({\\n human: T.Object({\\n name: T.String(),\\n age: T.Optional(T.Number()),\\n gender: T.Union([T.Literal('batman'), T.Literal('joker')])\\n }),\\n address: CloneType(refs['ComponentsSchemasDef1']),\\n recursive: T.Object(\\n {},\\n {\\n additionalProperties: true\\n }\\n )\\n })\\n },\\n {\\n 'x-status-code': '201',\\n 'x-content-type': 'application/json',\\n additionalProperties: true\\n }\\n ),\\n error: T.Union([T.Any({ 'x-status-code': 'default' })])\\n }\\n }\\n}\\n\\nconst _components = {\\n schemas: {\\n 'def-0': CloneType(refs['ComponentsSchemasDef0']),\\n 'def-1': CloneType(refs['ComponentsSchemasDef1'])\\n }\\n}\\n\\nexport { schema, _components as components }\\n" `; exports[`petstore.json 1`] = `