oas-truth 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -514,12 +514,22 @@ export type SchemaLib = 'zod' | 'valibot' | 'arktype' | 'effect' | 'typebox';
514
514
  * expression — e.g. hono-openapi wrapping it in `resolver(...)` — supplies it;
515
515
  * omitting it leaves the expression untouched (identity), so the shared library
516
516
  * stays framework-agnostic.
517
+ *
518
+ * Cycle handling lives next to each library: `wrapLazy` re-wraps a `$ref`
519
+ * inside a strongly connected component (Zod, Valibot, Effect);
520
+ * `cyclicAnnotation` is the TS7022 annotation on that declaration;
521
+ * `renderCyclic` post-processes the `$defs` container TypeBox and Arktype
522
+ * need (`Type.Cyclic` is already the expression; Arktype extracts `scope`).
517
523
  */
518
524
  export type ComponentAdapter = {
519
525
  readonly renderImport: () => string;
520
526
  readonly toExpression: (schema: Schema, paramIn?: ParamIn) => string;
521
527
  readonly renderTypeInfer: (constName: string) => string;
522
528
  readonly wrapSchema?: (expr: string) => string;
529
+ readonly wrapLazy?: (varName: string) => string;
530
+ readonly cyclicAnnotation?: (typeName: string) => string;
531
+ readonly renderCyclic?: (varName: string, containerExpr: string, externals: readonly string[]) => string;
532
+ readonly reservedTypeNames?: readonly string[];
523
533
  };
524
534
  export declare function makeAdapter(lib: SchemaLib): ComponentAdapter;
525
535
  //#endregion
@@ -579,6 +589,48 @@ export declare function makeRequestBodiesCode(components: Components, adapter: C
579
589
  //#region src/generator/components/responses.d.ts
580
590
  export declare function makeResponsesCode(components: Components, adapter: ComponentAdapter, readonly: boolean): string;
581
591
  //#endregion
592
+ //#region src/generator/components/schemas.d.ts
593
+ type SchemasOptions = {
594
+ readonly exportTypes?: boolean;
595
+ readonly readonly?: boolean;
596
+ /**
597
+ * How to name the exported type alias. `const` (default) matches the other
598
+ * builders (`UserSchema`); `key` uses the OpenAPI key (`User`).
599
+ */
600
+ readonly typeAlias?: 'const' | 'key';
601
+ /**
602
+ * Host hook around each declaration expression — e.g. hono-openapi ref
603
+ * registration. Applied after cycle handling.
604
+ */
605
+ readonly wrapDeclaration?: (expr: string, name: string) => string;
606
+ };
607
+ type SchemaDeclaration = {
608
+ readonly name: string;
609
+ readonly varName: string;
610
+ readonly fileName: string;
611
+ readonly code: string;
612
+ };
613
+ /**
614
+ * One `export const <X>Schema=...` declaration per `components.schemas` entry,
615
+ * in dependency-first order. Only references inside a `$ref` cycle are lazy
616
+ * (and their declarations get the annotation TypeScript needs); every other
617
+ * reference is a plain identifier, declared earlier.
618
+ */
619
+ export declare function makeSchemaDeclarations(schemas: {
620
+ readonly [k: string]: Schema;
621
+ }, adapter: ComponentAdapter, options?: SchemasOptions): {
622
+ name: string;
623
+ varName: string;
624
+ fileName: string;
625
+ code: string;
626
+ }[];
627
+ /**
628
+ * The import line and every `components.schemas` declaration, in dependency
629
+ * order. Returns `''` when schemas are missing or empty.
630
+ */
631
+ export declare function makeSchemasCode(components: Components, adapter: ComponentAdapter, options?: SchemasOptions): string;
632
+ //#endregion
582
633
  //#region src/generator/components/security-schemes.d.ts
583
634
  export declare function makeSecuritySchemesCode(components: Components, readonly: boolean): string;
584
- //#endregion
635
+ //#endregion
636
+ export type { SchemaDeclaration, SchemasOptions };
package/dist/index.js CHANGED
@@ -70,6 +70,20 @@ function stripZodLazy(code) {
70
70
  function stripValibotLazy(code) {
71
71
  return code.replaceAll(/v\.lazy\(\(\)\s*=>\s*(\w+Schema)\)/gu, "$1");
72
72
  }
73
+ /** Inline `Schema.suspend(() => XSchema)` back to the bare `XSchema` reference. */
74
+ function stripEffectSuspend(code) {
75
+ return code.replaceAll(/Schema\.suspend\(\(\)\s*=>\s*(\w+Schema)\)/gu, "$1");
76
+ }
77
+ /**
78
+ * Arktype's `$defs` document becomes `const types = scope({...}).export()` plus
79
+ * a selected member. The schemas builder needs the `scope` body so it can alias
80
+ * references that leave the cycle.
81
+ */
82
+ function renderArktypeCyclic(varName, containerExpr, externals) {
83
+ const body = containerExpr.match(/scope\(\{([\s\S]*)\}\)\.export\(\)/u)?.[1];
84
+ if (body === void 0) return containerExpr;
85
+ return `scope({${[...externals.map((ref) => `${ref}:${ref}`), body].join(",")}}).export().${varName}`;
86
+ }
73
87
  function makeZodAdapter() {
74
88
  return {
75
89
  toExpression(schema, paramIn) {
@@ -85,6 +99,12 @@ function makeZodAdapter() {
85
99
  },
86
100
  renderTypeInfer(constName) {
87
101
  return `export type ${constName}=z.infer<typeof ${constName}>`;
102
+ },
103
+ wrapLazy(varName) {
104
+ return `z.lazy(() => ${varName})`;
105
+ },
106
+ cyclicAnnotation(typeName) {
107
+ return `z.ZodType<${typeName}>`;
88
108
  }
89
109
  };
90
110
  }
@@ -103,6 +123,12 @@ function makeValibotAdapter() {
103
123
  },
104
124
  renderTypeInfer(constName) {
105
125
  return `export type ${constName}=v.InferOutput<typeof ${constName}>`;
126
+ },
127
+ wrapLazy(varName) {
128
+ return `v.lazy(() => ${varName})`;
129
+ },
130
+ cyclicAnnotation(typeName) {
131
+ return `v.GenericSchema<${typeName}>`;
106
132
  }
107
133
  };
108
134
  }
@@ -121,7 +147,9 @@ function makeArktypeAdapter() {
121
147
  },
122
148
  renderTypeInfer(constName) {
123
149
  return `export type ${constName}=typeof ${constName}.infer`;
124
- }
150
+ },
151
+ renderCyclic: renderArktypeCyclic,
152
+ reservedTypeNames: ["type", "scope"]
125
153
  };
126
154
  }
127
155
  function makeTypeboxAdapter() {
@@ -139,7 +167,12 @@ function makeTypeboxAdapter() {
139
167
  },
140
168
  renderTypeInfer(constName) {
141
169
  return `export type ${constName}=Static<typeof ${constName}>`;
142
- }
170
+ },
171
+ reservedTypeNames: [
172
+ "Type",
173
+ "Static",
174
+ "Codec"
175
+ ]
143
176
  };
144
177
  }
145
178
  function makeEffectAdapter() {
@@ -150,14 +183,21 @@ function makeEffectAdapter() {
150
183
  openapi: true,
151
184
  readonly: false,
152
185
  ...paramIn && { paramIn }
153
- }));
186
+ }), stripEffectSuspend);
154
187
  },
155
188
  renderImport() {
156
189
  return "import { Schema } from 'effect'";
157
190
  },
158
191
  renderTypeInfer(constName) {
159
192
  return `export type ${constName}=Schema.Schema.Type<typeof ${constName}>`;
160
- }
193
+ },
194
+ wrapLazy(varName) {
195
+ return `Schema.suspend(() => ${varName})`;
196
+ },
197
+ cyclicAnnotation() {
198
+ return "Schema.Codec<any>";
199
+ },
200
+ reservedTypeNames: ["Schema", "Effect"]
161
201
  };
162
202
  }
163
203
  //#endregion
@@ -404,6 +444,309 @@ function makeResponsesCode(components, adapter, readonly) {
404
444
  return exports.join(";");
405
445
  }
406
446
  //#endregion
447
+ //#region src/helper/graph.ts
448
+ /** Every `components.schemas` name a schema reaches through `$ref`, at any depth. */
449
+ function collectSchemaRefs(node) {
450
+ if (Array.isArray(node)) return node.flatMap(collectSchemaRefs);
451
+ if (!isRecord(node)) return [];
452
+ return [...typeof node.$ref === "string" && node.$ref.startsWith("#/components/schemas/") ? [schemaRefToName(node.$ref)] : [], ...Object.values(node).flatMap(collectSchemaRefs)];
453
+ }
454
+ /**
455
+ * Strongly connected components over the `$ref` graph. A component is closed
456
+ * only after every component it reaches, so the flattened result is a
457
+ * dependency-first declaration order; `cycles` maps each member of a recursive
458
+ * component (a mutual cycle, or a schema that refers to itself) to its whole
459
+ * group.
460
+ */
461
+ function analyzeSchemas(schemas) {
462
+ const edges = new Map(Object.entries(schemas).map(([name, schema]) => [name, [...new Set(collectSchemaRefs(schema))].filter((ref) => ref in schemas)]));
463
+ const index = /* @__PURE__ */ new Map();
464
+ const low = /* @__PURE__ */ new Map();
465
+ const stack = [];
466
+ const onStack = /* @__PURE__ */ new Set();
467
+ const components = [];
468
+ const connect = (name) => {
469
+ index.set(name, index.size);
470
+ low.set(name, index.size - 1);
471
+ stack.push(name);
472
+ onStack.add(name);
473
+ for (const next of edges.get(name) ?? []) {
474
+ if (!index.has(next)) connect(next);
475
+ if (onStack.has(next)) low.set(name, Math.min(low.get(name) ?? 0, low.get(next) ?? 0));
476
+ }
477
+ if (low.get(name) === index.get(name)) {
478
+ const group = stack.splice(stack.lastIndexOf(name));
479
+ for (const member of group) onStack.delete(member);
480
+ components.push(group);
481
+ }
482
+ };
483
+ for (const name of edges.keys()) if (!index.has(name)) connect(name);
484
+ const cycles = new Map(components.filter((group) => group.length > 1 || (edges.get(group[0] ?? "") ?? []).includes(group[0] ?? "")).flatMap((group) => group.map((name) => [name, group])));
485
+ return {
486
+ order: components.flat(),
487
+ cycles
488
+ };
489
+ }
490
+ function makeTypeString(schema, self, infer, readonly) {
491
+ const recurse = (s) => makeTypeString(s, self, infer, readonly);
492
+ const ro = readonly ? "readonly " : "";
493
+ if (schema.$ref) {
494
+ const name = schemaRefToName(schema.$ref);
495
+ return name === self.name ? self.typeName : infer(name);
496
+ }
497
+ const union = schema.oneOf ?? schema.anyOf;
498
+ if (union && union.length > 0) return `(${union.map(recurse).join("|")})`;
499
+ if (schema.allOf && schema.allOf.length > 0) return `(${schema.allOf.map(recurse).join("&")})`;
500
+ if (schema.enum && schema.enum.length > 0) return schema.enum.map((v) => JSON.stringify(v)).join("|");
501
+ if (schema.const !== void 0) return JSON.stringify(schema.const);
502
+ const types = schema.type === void 0 ? ["object"] : [schema.type].flat();
503
+ const nullable = schema.nullable === true || types.includes("null");
504
+ const base = types.filter((type) => type !== "null").map((type) => {
505
+ if (type === "string") return "string";
506
+ if (type === "number" || type === "integer") return "number";
507
+ if (type === "boolean") return "boolean";
508
+ if (type === "array") {
509
+ const items = schema.items;
510
+ const item = isRecord(items) ? recurse(items) : "unknown";
511
+ return `${ro}(${item})[]`;
512
+ }
513
+ if (type === "object") {
514
+ const props = Object.entries(schema.properties ?? {}).map(([key, prop]) => `${ro}${JSON.stringify(key)}${schema.required?.includes(key) ? "" : "?"}:${recurse(prop)}`);
515
+ const extra = isRecord(schema.additionalProperties) ? [`${ro}[key:string]:${recurse(schema.additionalProperties)}`] : props.length === 0 ? [`${ro}[key:string]:unknown`] : [];
516
+ return `{${[...props, ...extra].join(";")}}`;
517
+ }
518
+ return "unknown";
519
+ }).join("|");
520
+ if (!nullable) return base || "unknown";
521
+ return base ? `(${base}|null)` : "null";
522
+ }
523
+ /**
524
+ * The TypeScript shape of a recursive schema, so its declaration can carry an
525
+ * explicit `z.ZodType<XType>` / `v.GenericSchema<XType>` annotation (TS7022).
526
+ * References to other schemas go through their inferred types.
527
+ */
528
+ function makeCyclicType(name, typeName, schema, infer, readonly) {
529
+ return `type ${typeName}=${makeTypeString(schema, {
530
+ name,
531
+ typeName
532
+ }, infer, readonly)}`;
533
+ }
534
+ //#endregion
535
+ //#region src/helper/identifiers.ts
536
+ /**
537
+ * Identifier rewriting on generated source without a parser: skip quoted
538
+ * strings so identifier-shaped text inside descriptions and `Type.Ref('X')`
539
+ * keys is never mistaken for a reference. The schemas builder only applies
540
+ * this to libraries whose cycle form is a lazy wrapper (Zod, Valibot, Effect),
541
+ * where a schema name appears as an identifier.
542
+ */
543
+ function readQuoted(source, start) {
544
+ const quote = source[start] ?? "";
545
+ let i = start + 1;
546
+ while (i < source.length) {
547
+ const ch = source[i];
548
+ if (ch === "\\") {
549
+ i += 2;
550
+ continue;
551
+ }
552
+ if (ch === quote) return {
553
+ text: source.slice(start, i + 1),
554
+ end: i + 1
555
+ };
556
+ i += 1;
557
+ }
558
+ return {
559
+ text: source.slice(start),
560
+ end: source.length
561
+ };
562
+ }
563
+ function isIdentStart(ch) {
564
+ return /[A-Za-z_$]/u.test(ch);
565
+ }
566
+ function isIdentPart(ch) {
567
+ return /[A-Za-z0-9_$]/u.test(ch);
568
+ }
569
+ /** Rewrites every identifier in `names` with `wrap(name)`, leaving strings intact. */
570
+ function wrapReferences(expr, names, wrap) {
571
+ if (names.size === 0) return expr;
572
+ let result = "";
573
+ let i = 0;
574
+ while (i < expr.length) {
575
+ const ch = expr[i] ?? "";
576
+ if (ch === "\"" || ch === "'" || ch === "`") {
577
+ const quoted = readQuoted(expr, i);
578
+ result += quoted.text;
579
+ i = quoted.end;
580
+ continue;
581
+ }
582
+ if (isIdentStart(ch)) {
583
+ const start = i;
584
+ i += 1;
585
+ while (i < expr.length && isIdentPart(expr[i] ?? "")) i += 1;
586
+ const ident = expr.slice(start, i);
587
+ result += names.has(ident) ? wrap(ident) : ident;
588
+ continue;
589
+ }
590
+ result += ch;
591
+ i += 1;
592
+ }
593
+ return result;
594
+ }
595
+ //#endregion
596
+ //#region src/generator/components/schemas.ts
597
+ /** `name`, or the first of `name2`, `name3`, … not in `used`. */
598
+ function claimName(name, used, i = 2) {
599
+ if (!used.has(name)) return name;
600
+ return used.has(`${name}${i}`) ? claimName(name, used, i + 1) : `${name}${i}`;
601
+ }
602
+ /**
603
+ * `toIdentifierPascalCase` folds `user` and `User` into one identifier; later
604
+ * colliders get a numeric suffix so no declaration is lost. A `$ref` to a later
605
+ * collider still resolves to the first declaration.
606
+ */
607
+ function makeSchemaIdentifiers(schemas) {
608
+ return Object.keys(schemas).reduce((acc, key) => acc.set(key, claimName(toIdentifierPascalCase(key), new Set(acc.values()))), /* @__PURE__ */ new Map());
609
+ }
610
+ /** Keys whose value is a subschema (or a list of them) and keys whose value maps names to subschemas. */
611
+ const SUBSCHEMA_KEYS = /* @__PURE__ */ new Set([
612
+ "items",
613
+ "prefixItems",
614
+ "additionalProperties",
615
+ "allOf",
616
+ "anyOf",
617
+ "oneOf",
618
+ "not",
619
+ "if",
620
+ "then",
621
+ "else",
622
+ "contains",
623
+ "propertyNames",
624
+ "unevaluatedItems",
625
+ "unevaluatedProperties",
626
+ "contentSchema"
627
+ ]);
628
+ const SUBSCHEMA_MAP_KEYS = /* @__PURE__ */ new Set([
629
+ "properties",
630
+ "patternProperties",
631
+ "dependentSchemas",
632
+ "$defs"
633
+ ]);
634
+ function isSchema(value) {
635
+ return isRecord(value);
636
+ }
637
+ /** Rewrites a schema bottom-up with `fn`, following only subschemas (never example or default values). */
638
+ function mapSchema(schema, fn) {
639
+ const map = (value) => isSchema(value) ? mapSchema(value, fn) : value;
640
+ const node = Object.fromEntries(Object.entries(schema).map(([key, value]) => {
641
+ if (SUBSCHEMA_KEYS.has(key)) return [key, Array.isArray(value) ? value.map(map) : map(value)];
642
+ if (SUBSCHEMA_MAP_KEYS.has(key) && isRecord(value)) return [key, Object.fromEntries(Object.entries(value).map(([k, v]) => [k, map(v)]))];
643
+ return [key, value];
644
+ }));
645
+ return fn(isSchema(node) ? node : schema);
646
+ }
647
+ /**
648
+ * `readonly` as the declarative `x-readonly` extension on every object and array,
649
+ * which schema-to-library turns into each library's readonly form.
650
+ */
651
+ function markReadonly(schema) {
652
+ return mapSchema(schema, (node) => {
653
+ const types = new Set([node.type].flat());
654
+ return types.has("object") || types.has("array") ? {
655
+ ...node,
656
+ "x-readonly": true
657
+ } : node;
658
+ });
659
+ }
660
+ /**
661
+ * TypeBox and Arktype cannot express a cycle with standalone `const`s: the group
662
+ * becomes one `Type.Cyclic(...)` / `scope(...)` container and each member selects
663
+ * its entry. schema-to-library builds the container from a `$defs` document.
664
+ */
665
+ function makeCyclicContainer(varName, group, schemas, identifiers, adapter) {
666
+ const groupIdentifiers = new Map(group.map((name) => [name, identifiers.get(name) ?? name]));
667
+ const localize = (node) => {
668
+ const ident = node.$ref ? groupIdentifiers.get(schemaRefToName(node.$ref)) : void 0;
669
+ if (ident === void 0) return node;
670
+ const local = Object.fromEntries([...Object.entries(node), ["$ref", `#/$defs/${ident}Schema`]]);
671
+ return isSchema(local) ? local : node;
672
+ };
673
+ const $defs = Object.fromEntries(group.map((name) => [`${groupIdentifiers.get(name)}Schema`, mapSchema(schemas[name] ?? {}, localize)]));
674
+ return adapter.toExpression({
675
+ title: varName,
676
+ $defs
677
+ });
678
+ }
679
+ function schemaImportLine(adapter, options, hasContainerCycle) {
680
+ const line = adapter.renderImport();
681
+ if (hasContainerCycle && adapter.renderCyclic && line === "import { type } from 'arktype'") return "import { type, scope } from 'arktype'";
682
+ if (options?.exportTypes === true && line === "import { Type } from '@sinclair/typebox'") return "import { Type, type Static } from '@sinclair/typebox'";
683
+ return line;
684
+ }
685
+ function exportedTypeName(ident, varName, adapter, options) {
686
+ if (options?.typeAlias !== "key") return varName;
687
+ return (adapter.reservedTypeNames ?? []).includes(ident) ? `${ident}Type` : ident;
688
+ }
689
+ function fileNameOf(ident) {
690
+ return `${ident.charAt(0).toLowerCase()}${ident.slice(1)}`;
691
+ }
692
+ /**
693
+ * One `export const <X>Schema=...` declaration per `components.schemas` entry,
694
+ * in dependency-first order. Only references inside a `$ref` cycle are lazy
695
+ * (and their declarations get the annotation TypeScript needs); every other
696
+ * reference is a plain identifier, declared earlier.
697
+ */
698
+ function makeSchemaDeclarations(schemas, adapter, options) {
699
+ const prepared = Object.fromEntries(Object.entries(schemas).map(([name, schema]) => [name, options?.readonly === true ? markReadonly(schema) : schema]));
700
+ const identifiers = makeSchemaIdentifiers(schemas);
701
+ const { order, cycles } = analyzeSchemas(schemas);
702
+ const taken = /* @__PURE__ */ new Set([
703
+ ...identifiers.values(),
704
+ ...[...identifiers.values()].map((ident) => `${ident}Schema`),
705
+ ...adapter.reservedTypeNames ?? []
706
+ ]);
707
+ const infer = (varName) => adapter.renderTypeInfer(varName).replace(`export type ${varName}=`, "");
708
+ return order.map((name) => {
709
+ const schema = prepared[name] ?? {};
710
+ const ident = identifiers.get(name) ?? toIdentifierPascalCase(name);
711
+ const varName = `${ident}Schema`;
712
+ const group = cycles.get(name);
713
+ const arktypeReadonly = adapter.renderCyclic !== void 0 && options?.readonly === true;
714
+ const container = group && adapter.wrapLazy === void 0 ? makeCyclicContainer(varName, group, arktypeReadonly ? schemas : prepared, identifiers, adapter) : void 0;
715
+ const peers = group ?? [];
716
+ const rendered = container === void 0 ? void 0 : adapter.renderCyclic?.(varName, container, [...new Set(peers.flatMap((peer) => collectSchemaRefs(schemas[peer])))].flatMap((ref) => peers.includes(ref) || !identifiers.has(ref) ? [] : [`${identifiers.get(ref)}Schema`])) ?? container;
717
+ const expression = (rendered && arktypeReadonly ? `${rendered}.readonly()` : rendered) ?? adapter.toExpression({
718
+ ...schema,
719
+ title: varName
720
+ });
721
+ const body = adapter.wrapLazy ? wrapReferences(expression, new Set((group ?? []).map((peer) => `${identifiers.get(peer)}Schema`)), adapter.wrapLazy) : expression;
722
+ const value = options?.wrapDeclaration ? options.wrapDeclaration(body, name) : body;
723
+ const helper = group && adapter.cyclicAnnotation ? claimName(`${ident}Type`, taken) : void 0;
724
+ const annotationText = helper ? adapter.cyclicAnnotation?.(helper) : void 0;
725
+ const usesHelper = helper !== void 0 && annotationText?.includes(helper) === true;
726
+ if (helper && usesHelper) taken.add(helper);
727
+ const typeDef = helper && usesHelper ? `${makeCyclicType(name, helper, schema, (ref) => infer(`${identifiers.get(ref) ?? toIdentifierPascalCase(ref)}Schema`), options?.readonly === true)}\n\n` : "";
728
+ const annotation = annotationText === void 0 ? "" : `:${annotationText}`;
729
+ const typeExport = options?.exportTypes === true ? `\n\nexport type ${exportedTypeName(ident, varName, adapter, options)}=${infer(varName)}` : "";
730
+ return {
731
+ name,
732
+ varName,
733
+ fileName: fileNameOf(ident),
734
+ code: `${typeDef}export const ${varName}${annotation}=${value}${typeExport}`
735
+ };
736
+ });
737
+ }
738
+ /**
739
+ * The import line and every `components.schemas` declaration, in dependency
740
+ * order. Returns `''` when schemas are missing or empty.
741
+ */
742
+ function makeSchemasCode(components, adapter, options) {
743
+ const { schemas } = components;
744
+ if (!schemas) return "";
745
+ const declarations = makeSchemaDeclarations(schemas, adapter, options);
746
+ if (declarations.length === 0) return "";
747
+ return `${schemaImportLine(adapter, options, adapter.wrapLazy === void 0 && analyzeSchemas(schemas).cycles.size > 0)}\n\n${declarations.map((d) => d.code).join(";")}\n`;
748
+ }
749
+ //#endregion
407
750
  //#region src/generator/components/security-schemes.ts
408
751
  function makeSecuritySchemesCode(components, readonly) {
409
752
  const { securitySchemes } = components;
@@ -416,4 +759,4 @@ function makeSecuritySchemesCode(components, readonly) {
416
759
  }).join(";")}\n`;
417
760
  }
418
761
  //#endregion
419
- export { isRecord, makeAdapter, makeCallbacksCode, makeExamplesCode, makeHeadersCode, makeLinksCode, makeParametersCode, makePathItemsCode, makeRequestBodiesCode, makeResponsesCode, makeSafeKey, makeSchemaReplacements, makeSecuritySchemesCode, parseOpenAPI, schemaRefToName, toIdentifierPascalCase, toPascalCase, valueToCode };
762
+ export { isRecord, makeAdapter, makeCallbacksCode, makeExamplesCode, makeHeadersCode, makeLinksCode, makeParametersCode, makePathItemsCode, makeRequestBodiesCode, makeResponsesCode, makeSafeKey, makeSchemaDeclarations, makeSchemaReplacements, makeSchemasCode, makeSecuritySchemesCode, parseOpenAPI, schemaRefToName, toIdentifierPascalCase, toPascalCase, valueToCode };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oas-truth",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "oas-truth is a parser from OpenAPI and TypeSpec to a typed OpenAPI document",
5
5
  "keywords": [
6
6
  "openapi",
@@ -28,7 +28,7 @@
28
28
  }
29
29
  },
30
30
  "dependencies": {
31
- "schema-to-library": "^0.4.0"
31
+ "schema-to-library": "^0.4.1"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@apidevtools/swagger-parser": "^13.0.0",
@@ -39,7 +39,12 @@
39
39
  "@typespec/openapi3": "1.16.0",
40
40
  "@typespec/rest": "0.86.0",
41
41
  "@typespec/versioning": "0.86.0",
42
- "typescript": "^7.0.2"
42
+ "arktype": "^2.2.3",
43
+ "effect": "4.0.0-rc.112",
44
+ "typebox": "^1.3.30",
45
+ "typescript": "^7.0.2",
46
+ "valibot": "^1.5.0",
47
+ "zod": "^4.6.2"
43
48
  },
44
49
  "peerDependencies": {
45
50
  "@apidevtools/swagger-parser": ">=12.0.0 <14.0.0",