🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@amritk/generate-validators

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@amritk/generate-validators - npm Package Compare versions

Comparing version
0.11.6
to
0.11.7
+5
-1
dist/generators/collect-validator-imports.js

@@ -57,3 +57,7 @@ import { refToFilename } from '@amritk/helpers/ref-to-filename';

// harmless no-op.
const subSchemaMaps = ['properties', 'patternProperties', 'dependentSchemas'];
// `dependencies` (draft-07) is dual-form: a string array (dependentRequired) or
// a subschema (dependentSchemas). The emitter delegates the schema form via
// `validateX`, so a `$ref` inside it must be imported; the string-array form is
// a harmless no-op here (its values are strings, not schemas).
const subSchemaMaps = ['properties', 'patternProperties', 'dependentSchemas', 'dependencies'];
for (const mapKey of subSchemaMaps) {

@@ -60,0 +64,0 @@ const map = schema[mapKey];

+3
-3
{
"name": "@amritk/generate-validators",
"version": "0.11.6",
"version": "0.11.7",
"description": "Generate TypeScript validation functions from JSON Schemas.",

@@ -49,6 +49,6 @@ "module": "./dist/index.js",

"json-schema-typed": "^8.0.1",
"@amritk/helpers": "0.13.0"
"@amritk/helpers": "0.13.1"
},
"devDependencies": {
"@amritk/runtime-validators": "0.7.0",
"@amritk/runtime-validators": "0.7.1",
"@ryoppippi/unplugin-typia": "^2.6.5",

@@ -55,0 +55,0 @@ "@scalar/openapi-parser": "^0.26.1",

+11
-10

@@ -132,16 +132,17 @@ <div align="center">

|:--|--:|--:|--:|--:|--:|
| small (4 fields) | **~22M** ops/s | ~4.2M ops/s | ~7.0M ops/s | ~4.0M ops/s | ~1.8M ops/s |
| order (nested + array) | **~6.9M** ops/s | ~1.7M ops/s | ~2.5M ops/s | ~1.7M ops/s | ~0.4M ops/s |
| assert-loose | **~110M** ops/s | ~100M ops/s | ~31M ops/s | ~41M ops/s | ~3.2M ops/s |
| assert-strict | **~98M** ops/s | ~82M ops/s | ~13M ops/s | ~28M ops/s | ~1.1M ops/s |
| small (4 fields) | **~48M** ops/s | ~5M ops/s | ~10.5M ops/s | ~5.3M ops/s | ~2M ops/s |
| order (nested + array) | **~7.8M** ops/s | ~2.2M ops/s | ~3.5M ops/s | ~2.1M ops/s | ~0.5M ops/s |
| assert-loose | **~184M** ops/s | ~183M ops/s | ~45M ops/s | ~63M ops/s | ~3.8M ops/s |
| assert-strict | **~162M** ops/s | ~148M ops/s | ~22M ops/s | ~38M ops/s | ~1.3M ops/s |
The `assert-loose` / `assert-strict` rows are the exact shape used by
[`moltar/typescript-runtime-type-benchmarks`](https://github.com/moltar/typescript-runtime-type-benchmarks)
(seven scalar roots plus a nested object); the boolean guard lets mjst edge past
typia on both, with and without `additionalProperties: false`. (typia and
TypeBox still win the *invalid* path, where they bail on the first error rather
than collecting a full error list.)
(seven scalar roots plus a nested object): the boolean guard puts mjst clearly
ahead of typia on `assert-strict` (with `additionalProperties: false`) and
neck-and-neck with it on `assert-loose` — the two trade the lead run-to-run
within noise. (typia and TypeBox still win the *invalid* path, where they bail on
the first error rather than collecting a full error list.)
Preparing a validator costs ~0.1 ms for mjst codegen and ~0.05–0.12 ms for a
TypeBox `TypeCompiler` compile, versus ~8–10 ms for an Ajv compile. Every library
Preparing a validator costs ~0.3–0.6 ms for mjst codegen and ~0.05–0.2 ms for a
TypeBox `TypeCompiler` compile, versus ~9–12 ms for an Ajv compile. Every library
agrees on every verdict; parity is asserted before timing (TypeBox is given

@@ -148,0 +149,0 @@ uuid/email format checkers so every library does the same work). Each library is

Sorry, the diff of this file is too big to display