@oh-my-pi/omptype 17.3.0 → 17.3.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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [17.3.1] - 2026-08-13
6
+
7
+ ### Fixed
8
+
9
+ - Fixed TypeBox adapter omitting pattern, non-URL format, and multipleOf constraints from the emitted JSON Schema.
10
+
5
11
  ## [17.3.0] - 2026-08-13
6
12
 
7
13
  ### Added
@@ -76,7 +76,13 @@ function tString(opts) {
76
76
  const valid = formatPredicate(format);
77
77
  schema = schema.narrow((value, ctx) => valid(value) || ctx.mustBe(`a string in ${format} format`));
78
78
  }
79
- return applyMeta(schema, opts);
79
+ const result = applyMeta(schema, opts);
80
+ const keywords = {};
81
+ if (opts?.pattern !== undefined)
82
+ keywords.pattern = opts.pattern;
83
+ if (opts?.format !== undefined)
84
+ keywords.format = opts.format === "url" ? "uri" : opts.format;
85
+ return opts?.pattern !== undefined || opts?.format !== undefined ? withJsonSchemaKeywords(result, keywords) : result;
80
86
  }
81
87
  function formatPredicate(format) {
82
88
  switch (format) {
@@ -147,7 +153,8 @@ function tNumber(opts, integer = false) {
147
153
  ctx.mustBe(`a multiple of ${divisor}`));
148
154
  });
149
155
  }
150
- return applyMeta(schema, opts);
156
+ const result = applyMeta(schema, opts);
157
+ return opts?.multipleOf !== undefined ? withJsonSchemaKeywords(result, { multipleOf: opts.multipleOf }) : result;
151
158
  }
152
159
  function tLiteral(value, opts) {
153
160
  return applyMeta(asRuntime(type.enumerated(value)), opts);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/omptype",
4
- "version": "17.3.0",
4
+ "version": "17.3.1",
5
5
  "description": "ArkType-compatible runtime schema validation with lazy JIT compilation",
6
6
  "homepage": "https://omp.sh",
7
7
  "author": "Can Boluk",
package/src/typebox.ts CHANGED
@@ -220,7 +220,11 @@ function tString(opts?: StringOpts): TString {
220
220
  const valid = formatPredicate(format);
221
221
  schema = schema.narrow((value, ctx) => valid(value) || ctx.mustBe(`a string in ${format} format`));
222
222
  }
223
- return applyMeta(schema, opts);
223
+ const result = applyMeta(schema, opts);
224
+ const keywords: Record<string, unknown> = {};
225
+ if (opts?.pattern !== undefined) keywords.pattern = opts.pattern;
226
+ if (opts?.format !== undefined) keywords.format = opts.format === "url" ? "uri" : opts.format;
227
+ return opts?.pattern !== undefined || opts?.format !== undefined ? withJsonSchemaKeywords(result, keywords) : result;
224
228
  }
225
229
 
226
230
  function formatPredicate(format: string): (value: string) => boolean {
@@ -290,7 +294,8 @@ function tNumber(opts?: NumberOpts, integer = false): TNumber {
290
294
  );
291
295
  });
292
296
  }
293
- return applyMeta(schema, opts);
297
+ const result = applyMeta(schema, opts);
298
+ return opts?.multipleOf !== undefined ? withJsonSchemaKeywords(result, { multipleOf: opts.multipleOf }) : result;
294
299
  }
295
300
 
296
301
  function tLiteral<const V extends string | number | boolean | null>(value: V, opts?: Meta): TLiteral<V> {