@deepseek-ai/schemastery review
A configuration object can pass validation and still keep keys you never declared. @deepseek-ai/schemastery 3.18.5 is a callable JavaScript schema validator with defaults, value conversion and metadata for configuration interfaces. Ordinary object schemas retain extra keys. That makes the package worth examining when you maintain software already using its schema format, but you need to choose missing-value and unknown-key policies before treating it as an input boundary.
Use @deepseek-ai/schemastery 3.18.5 when its configuration schema format already fits your application and you can make missing-value and mutation policies explicit. For a new boundary that must reject undeclared fields, choose a validator and object policy that directly enforce that requirement.
Answers from our run
@deepseek-ai/schemastery or zod: which should you use?
zod: Consider Zod when you want TypeScript-first schema declarations with static type inference, as described by its npm package. This is a choice of schema API, not a measured performance comparison. Use @deepseek-ai/schemastery 3.18.5 when its configuration schema format already fits your application and you can make missing-value and mutation policies explicit.
When should you not use @deepseek-ai/schemastery?
You need undeclared object keys rejected by the ordinary object parser. It retains them, so this parser alone does not enforce a closed payload contract.
Use it if
- You maintain an application already using this scoped package and need to understand the configuration values it accepts.
- Your configuration definitions need validation rules alongside descriptions and renderer-role metadata. You will supply the interface that reads that metadata.
- You want callable schemas with explicit defaults and synchronous conversion functions, and can review how parsing affects the original input.
- You can test the exact 3.18.5 package against your own configuration fixtures before adopting it.
- You need undeclared object keys rejected by the ordinary object parser. It retains them, so this parser alone does not enforce a closed payload contract.
- You expect missing primitive fields to fail automatically. The primitive factories need an explicit required policy.
- You need parsing to leave caller-owned objects untouched. Nested adaptation and autofix can modify the supplied container.
- Your contract is already JSON Schema, or your application already standardizes on another validator. A second schema dialect adds maintenance work.
- You need verified async-transform behavior or integration compatibility guarantees. The inspected synchronous implementation and these unexecuted examples do not establish them.
Setup reality
Install the scoped package explicitly: npm install --save-exact @deepseek-ai/schemastery@3.18.5. The registry declares separate ESM import and CommonJS require entry points, plus TypeScript declarations. Those declarations describe the published API; we have not installed this package, compiled the examples or run its tests. Every snippet below is an unexecuted illustration checked against the version-pinned implementation and declarations, not a recorded runtime result.
Start with missing values. A plain primitive schema can return null or undefined without an error. .required() rejects nullable input before consulting a default, so combining required and default does not make a missing required value acceptable. Objects and arrays have built-in empty defaults. Decide whether an absent outer object should become an empty configuration or fail, and mark the outer schema required when absence should fail.
Ordinary object schemas retain extra keys. A successful parse therefore does not prove that every returned field was checked. Numbers are checked as numbers, so a string such as '3000' needs explicit conversion before a numeric rule. Use the returned parsed value throughout the application, but also review input ownership: nested transforms can write adapted values back into the original object. The autofix option can delete invalid properties. Neither is an appropriate accidental default for a request boundary.
Keep transform callbacks free of side effects. With the default preserve setting, the resolver invokes the callback for both the parsed value and adapted input. Setting the third transform argument to true takes the single-result branch shown in the implementation; it does not establish general concurrency or async safety. Catch validation errors deliberately instead of using .loose() to conceal bad configuration.
The package includes description and role metadata, but those fields do not render a settings screen by themselves. Its toJSON() method produces a reference-based schema representation; do not label that output JSON Schema. Keep application setup separate from this dependency's parsing rules.
Ratings below use an editorial evidence scale: 1 means thin support for adoption, 3 means a usable inspected surface with material gaps, and 5 would require strong operational and compatibility evidence. They assess the available documentation and implementation, not measured performance. npm recorded 1,468,710 downloads for October 23 through October 29, 2026. Downloads count package retrievals, not distinct developers or proof of downstream compatibility.
Patterns
Require a nonempty label required-string
import Schema from '@deepseek-ai/schemastery';
const Label = Schema.string().min(1).required();
const label = Label('worker');Unexecuted 3.18.5 illustration. A plain string schema permits nullable input unless required. min(1) checks string length, not trimmed content.
Supply a bounded integer port default-port
import Schema from '@deepseek-ai/schemastery';
const Port = Schema.number().min(1).max(65535).step(1).default(3000);
const port = Port(undefined);Unexecuted illustration. Defaults cover nullable input. Do not add required() expecting its missing-value error to fall through to the default. Numeric strings need separate conversion.
See the ordinary object policy object-extra-keys
import Schema from '@deepseek-ai/schemastery';
const Settings = Schema.object({
label: Schema.string().required(),
});
const settings = Settings({ label: 'worker', extra: true });Unexecuted illustration. The ordinary object resolver merges undeclared keys into its result, so extra remains present and unvalidated. The object itself has an empty default unless marked required.
Check a configuration identifier string-pattern
import Schema from '@deepseek-ai/schemastery';
const Identifier = Schema.string()
.pattern(/^[a-z][a-z0-9-]*$/)
.required();
const id = Identifier('worker-1');Unexecuted illustration. The expression is anchored to check the whole value. The string resolver constructs a fresh RegExp from the stored source and flags.
Validate a list of labels list-default
import Schema from '@deepseek-ai/schemastery';
const Labels = Schema.array(Schema.string().min(1).required()).max(5);
const labels = Labels(['build', 'deploy']);Unexecuted illustration. The array factory supplies an empty-array default. Add required() to the outer schema if a missing list must fail rather than become empty.
Limit a mode to literal values enum-values
import Schema from '@deepseek-ai/schemastery';
const Mode = Schema.union([
Schema.const('manual'),
Schema.const('automatic'),
]).required();
const mode = Mode('manual');Unexecuted illustration. Union members are tried in order. The outer required() rejects nullable input before the union resolver can accept an optional member.
Validate named retry limits dictionary-values
import Schema from '@deepseek-ai/schemastery';
const Limits = Schema.dict(
Schema.number().min(0).step(1).required(),
);
const limits = Limits({ fetch: 2, upload: 0 });Unexecuted illustration. Dictionary keys use a string schema by default. Numeric values are not coerced from strings, and a missing dictionary uses an empty-object default.
Normalize a checked string normalize-text
import Schema from '@deepseek-ai/schemastery';
const Label = Schema.transform(
Schema.string().min(1).required(),
value => value.trim(),
true,
).required();
const label = Label(' worker ');Unexecuted illustration. true selects the single-result transform branch. The inner min checks before trim, so whitespace-only input can become an empty string. Default transforms can call a callback twice and adapt nested input.
Handle a configuration error validation-errors
import Schema from '@deepseek-ai/schemastery';
const Port = Schema.number().min(1).max(65535).required();
try {
Port('3000');
} catch (error) {
if (!Schema.ValidationError.is(error)) throw error;
console.error(error.message);
}Unexecuted illustration. The string input is deliberately invalid. ValidationError.is recognizes this package error marker. Re-throw unrelated errors instead of treating every exception as invalid configuration.
Attach settings-interface metadata description-metadata
import Schema from '@deepseek-ai/schemastery';
const Label = Schema.string()
.description('Name shown beside the worker')
.role('text')
.required();
const label = Label('worker');Unexecuted illustration. description and role attach metadata. They do not install a form renderer or add validation beyond the string and required rules.
Alternatives
| Package | Registry | Pick it when |
|---|---|---|
| zod | npm | Consider Zod when you want TypeScript-first schema declarations with static type inference, as described by its npm package. This is a choice of schema API, not a measured performance comparison. |
| ajv | npm | Consider Ajv when JSON Schema is the contract you want to validate. Its npm package identifies it as a JSON Schema validator; migration from callable configuration schemas still needs a deliberate contract rewrite. |
More cli & tooling guides
commander · chalk · typescript · esbuild · yargs · vite · the whole shelf →
How this guide is made: grounded in the library's documentation, release notes, changelog, and issue history, on a fixed rubric — not a hands-on install of every release. The 50 most-downloaded entries are additionally install-verified in clean containers. Corrections: contact the desk.