npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@umpire/json-schema

v0.1.0

Published

JSON Schema composition profile for @umpire/core — portable nested value-shape validation alongside field availability evaluation

Downloads

22

Readme

@umpire/json-schema

JSON Schema composition profile for Umpire.

This optional package pairs Umpire's field-availability evaluation with JSON Schema structural validation, keeping both as independent authorities. It does not translate one into the other or merge their results.

Install

yarn add @umpire/json-schema

Quick start

import { compileProfile, compileSchemas } from '@umpire/json-schema'

const profile = compileProfile({
  $schema:
    'https://spec.umpire.tools/profiles/json-schema/v1/profile.schema.json',
  profileVersion: 1,
  valueSchema: {
    $schema: 'https://json-schema.org/draft/2020-12/schema',
    type: 'object',
    properties: {
      name: { type: 'string' },
      count: { type: 'integer' },
    },
    additionalProperties: false,
  },
  umpire: {
    version: 1,
    fields: { name: {}, count: {} },
    rules: [],
  },
})

if (profile.ok) {
  // Umpire availability
  const availability = profile.profile.check({ name: 'hello' })
  // Structural validation
  const structure = profile.profile.validateStructure({ name: 'hello' })
  // Both together
  const { availability: a, structure: s } = profile.profile.evaluate({
    name: 'hello',
  })
}

API

compileProfile(raw)

Parse a canonical profile document, compile both authorities, and run consistency checks.

compileSchemas({ valueSchema, umpire })

Accept separately-supplied JSON Schema and Umpire documents, wrap them in a canonical profile v1 document, and proceed as compileProfile().

CompiledProfile

  • check(values, conditions?, prev?) — delegates to the hydrated Umpire evaluator.
  • validateStructure(values) — runs AJV 2020-12 against raw values, returns normalized structural issues.
  • evaluate(values, conditions?, prev?) — calls both and returns separate results.

filterStructuralIssues(availability, issues)

Pure UI helper: drops structural issues whose first RFC 6901 path segment matches a known disabled Umpire field name. For example, an issue at path /nodes/0/id is suppressed when the nodes field is disabled. Root issues at path / are always retained.

Authority boundaries

  • Umpire evaluates field availability, satisfaction, requiredness, fairness, reasons, and transitions.
  • JSON Schema validates structural correctness: types, nested objects, arrays, enums, constants, bounds, strict properties, and tagged unions.
  • The two never mix.

Summary of the public API

| Export | Kind | Purpose | | --------------------------------------------------------------- | --------- | ---------------------------------------------------------------------------------- | | compileProfile(raw) | function | Parse and compile a canonical profile document. | | compileSchemas({ valueSchema, umpire }) | function | Compile separately-supplied authorities by wrapping them in a profile v1 document. | | CompiledProfile | interface | check(), validateStructure(), evaluate(). | | filterStructuralIssues(availability, issues) | function | Drop structural issues whose root field is disabled. | | ProfileDocument, CompileProfileResult, StructuralIssue, … | types | Public typing. |

Structural issue contract

Structural issues carry source ("json-schema"), code, path (RFC 6901 into the instance), an optional schemaPath, and a human message. code is the offending JSON Schema keyword (type, required, additionalProperties, minItems, maxItems, minLength, maxLength, minimum, maximum, exclusiveMinimum, exclusiveMaximum, enum, const) or a profile runtime code (discriminator). Issues are normalized: deduplicated by (source, code, path), sorted by path then code, with tagger union branch noise suppressed and same-path type failures suppressing value-dependent keywords.

Tagged unions

Profile v1 unions use a oneOf whose branches share one required discriminator property holding a distinct string const. The package injects AJV's discriminator keyword at compile time and reports:

  • a missing discriminator as required at the discriminator path;
  • an unknown discriminator value as discriminator at the discriminator path.

Conditions

Profile availability evaluation reuses base Umpire condition semantics unchanged: conditions is passed through to check()/evaluate() as-is, and an unsupplied condition referenced by a rule fails exactly as it does in @umpire/json. No new availability behavior is layered onto the profile wrapper.

Vendored specification files

The package ships the pinned umpire-spec release under schemas/ (the canonical profile meta-schema) and conformance/ (the profile conformance fixtures). Keep them in sync with node scripts/sync-umpire-spec.mjs at the repo root; a sync test asserts the inline profile meta-schema matches the shipped file.