oas-truth 0.5.0 → 0.5.1

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
@@ -499,7 +499,7 @@ export type Callbacks = {
499
499
  };
500
500
  /**
501
501
  * Where a value arrives as text: an OpenAPI parameter location, or `formData` for a field of
502
- * a form body. schema-to-library coerces the value from text for every one of them.
502
+ * a form body. schema-truth coerces the value from text for every one of them.
503
503
  */
504
504
  export type ParamIn = 'query' | 'path' | 'header' | 'cookie' | 'formData';
505
505
  /**
@@ -508,7 +508,7 @@ export type ParamIn = 'query' | 'path' | 'header' | 'cookie' | 'formData';
508
508
  * @see https://spec.openapis.org/oas/v3.2.0.html#style-values
509
509
  */
510
510
  export type ParamStyle = 'matrix' | 'label' | 'simple' | 'form' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';
511
- /** Narrow a Parameter Object's free-form `style` to one schema-to-library reads. */
511
+ /** Narrow a Parameter Object's free-form `style` to one schema-truth reads. */
512
512
  export declare function isParamStyle(style: string): style is ParamStyle;
513
513
  export type SchemaLib = 'zod' | 'valibot' | 'arktype' | 'effect' | 'typebox';
514
514
  /**
@@ -597,7 +597,7 @@ export declare function toPascalCase(str: string): string;
597
597
  export declare function schemaRefToName(ref: string): string;
598
598
  /**
599
599
  * Convert a name to a valid PascalCase TypeScript identifier. Mirrors
600
- * schema-to-library's `toIdentifierPascalCase` so reference identifiers match
600
+ * schema-truth's `toIdentifierPascalCase` so reference identifiers match
601
601
  * the component declaration names it emits. Non-ASCII names are encoded
602
602
  * injectively so distinct names never collide.
603
603
  */
@@ -681,7 +681,7 @@ type SchemasOptions = {
681
681
  readonly wrapDeclaration?: (expr: string, name: string) => string;
682
682
  /**
683
683
  * Register the OpenAPI key on each declaration. TypeBox puts it in the
684
- * outermost builder options via schema-to-library; the other libraries use
684
+ * outermost builder options via schema-truth; the other libraries use
685
685
  * `adapter.withRef` (an outer wrap). A bare identifier is left unchanged.
686
686
  */
687
687
  readonly ref?: boolean;
package/dist/index.js CHANGED
@@ -2,11 +2,11 @@ import path from "node:path";
2
2
  import SwaggerParser from "@apidevtools/swagger-parser";
3
3
  import { NodeHost, compile } from "@typespec/compiler";
4
4
  import { getOpenAPI3 } from "@typespec/openapi3";
5
- import { schemaToArktype } from "schema-to-library/arktype";
6
- import { schemaToEffect } from "schema-to-library/effect";
7
- import { schemaToTypebox } from "schema-to-library/typebox";
8
- import { schemaToValibot } from "schema-to-library/valibot";
9
- import { schemaToZod } from "schema-to-library/zod";
5
+ import { schemaToArktype } from "schema-truth/arktype";
6
+ import { schemaToEffect } from "schema-truth/effect";
7
+ import { schemaToTypebox } from "schema-truth/typebox";
8
+ import { schemaToValibot } from "schema-truth/valibot";
9
+ import { schemaToZod } from "schema-truth/zod";
10
10
  // src/openapi/index.ts
11
11
  async function parseOpenAPI(input) {
12
12
  try {
@@ -44,7 +44,7 @@ const PARAM_STYLES = [
44
44
  "pipeDelimited",
45
45
  "deepObject"
46
46
  ];
47
- /** Narrow a Parameter Object's free-form `style` to one schema-to-library reads. */
47
+ /** Narrow a Parameter Object's free-form `style` to one schema-truth reads. */
48
48
  function isParamStyle(style) {
49
49
  return PARAM_STYLES.includes(style);
50
50
  }
@@ -53,14 +53,14 @@ function isBareIdent(expr) {
53
53
  return /^[A-Za-z_$][\w$]*$/u.test(expr);
54
54
  }
55
55
  /**
56
- * Widen the rich `Schema` type to a bare JSON-Schema object for schema-to-library.
56
+ * Widen the rich `Schema` type to a bare JSON-Schema object for schema-truth.
57
57
  * `Schema` is not structurally assignable to its `JSONSchema` (e.g. `x-emailPattern`
58
58
  * literal unions differ), so this `as`-free bridge erases the incompatible members.
59
59
  */
60
60
  function toJsonSchema(schema) {
61
61
  return schema;
62
62
  }
63
- /** The wire options schema-to-library reads, without an `undefined` member. */
63
+ /** The wire options schema-truth reads, without an `undefined` member. */
64
64
  function wireOptions(paramIn, options) {
65
65
  return {
66
66
  ...paramIn && { paramIn },
@@ -280,7 +280,7 @@ function encodeNonAscii(name) {
280
280
  }
281
281
  /**
282
282
  * Convert a name to a valid PascalCase TypeScript identifier. Mirrors
283
- * schema-to-library's `toIdentifierPascalCase` so reference identifiers match
283
+ * schema-truth's `toIdentifierPascalCase` so reference identifiers match
284
284
  * the component declaration names it emits. Non-ASCII names are encoded
285
285
  * injectively so distinct names never collide.
286
286
  */
@@ -819,7 +819,7 @@ function mapSchema(schema, fn) {
819
819
  }
820
820
  /**
821
821
  * `readonly` as the declarative `x-readonly` extension on every object and array,
822
- * which schema-to-library turns into each library's readonly form.
822
+ * which schema-truth turns into each library's readonly form.
823
823
  */
824
824
  function markReadonly(schema) {
825
825
  return mapSchema(schema, (node) => {
@@ -833,7 +833,7 @@ function markReadonly(schema) {
833
833
  /**
834
834
  * TypeBox and Arktype cannot express a cycle with standalone `const`s: the group
835
835
  * becomes one `Type.Cyclic(...)` / `scope(...)` container and each member selects
836
- * its entry. schema-to-library builds the container from a `$defs` document.
836
+ * its entry. schema-truth builds the container from a `$defs` document.
837
837
  */
838
838
  function rewriteCollisionRef(node, identifiers) {
839
839
  if (typeof node.$ref !== "string" || !node.$ref.startsWith("#/components/schemas/")) return node;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oas-truth",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
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.7.0"
31
+ "schema-truth": "^0.7.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@apidevtools/swagger-parser": "^13.1.0",