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

@jsonschema-editor/json-schema-extensions

v0.1.9

Published

Format and geometry extensions for JSON Schema (email, url, phone, x-geometry) with validators and schema helpers

Readme

@jsonschema-editor/json-schema-extensions

Format extensions for email, url, and phone, plus x-values-source (static lists and API-backed selects) on top of @jsonschema-editor/json-schema.

Installation

npm install @jsonschema-editor/json-schema-extensions @jsonschema-editor/json-schema

Peer dependency: @jsonschema-editor/json-schema

Load schemas with extensions

Custom attributes are ignored unless the extensions registry is used:

import { documentFromJSONWithExtensions } from "@jsonschema-editor/json-schema-extensions";

const doc = documentFromJSONWithExtensions({
  type: "object",
  properties: {
    email: { type: "string", format: "email" },
    manager: {
      type: "string",
      title: "Manager",
      "x-values-source": {
        kind: "fetch",
        url: "https://jsonplaceholder.typicode.com/users",
        valueField: "id",
        labelField: "name",
      },
    },
  },
});

doc.root.getProperty("manager")?.getCustomAttribute("x-values-source");
// { kind: "fetch", url: "...", valueField: "id", labelField: "name" }

Always pair this with @jsonschema-editor/vue-extensions in the UI so fetch/static selects render as dropdowns.

Validators

import {
  validateEmail,
  validateUrl,
  validatePhone,
  validateFormatValue,
} from "@jsonschema-editor/json-schema-extensions";

validateEmail("[email protected]"); // true
validateUrl("https://example.com"); // true
validatePhone("+49 170 1234567"); // true (whitespace stripped)
validateFormatValue("phone", "+442079460123");

JSON Schema fragments

import { createFormatSchemaFragment } from "@jsonschema-editor/json-schema-extensions";

createFormatSchemaFragment("email");
// { type: "string", format: "email", pattern: "...", "x-format-extension": "email", ... }

| Extension id | JSON Schema format | Notes | | --- | --- | --- | | email | email | Includes practical pattern | | url | uri | HTTP(S) only via URL parser | | phone | phone | Custom format + E.164-oriented pattern |

OOP model integration

import {
  createExtensionsRegistry,
  createStringSchemaWithFormat,
  createStaticValuesSourceSchema,
  createFetchValuesSourceSchema,
} from "@jsonschema-editor/json-schema-extensions";
import { ObjectSchema } from "@jsonschema-editor/json-schema";

const registry = createExtensionsRegistry();
const person = new ObjectSchema();

person.setProperty("email", createStringSchemaWithFormat("email", registry), true);
person.setProperty(
  "role",
  createStaticValuesSourceSchema(["Admin", "User"], registry),
);
person.setProperty(
  "manager",
  createFetchValuesSourceSchema("https://api.example.com/users", {
    valueField: "id",
    labelField: "displayName",
  }, registry),
);

The custom attributes x-format-extension and x-values-source roundtrip when the same registry is used with schemaFromJSON / documentFromJSONWithExtensions.

x-values-source

Two kinds are supported:

Static list

{
  "type": "string",
  "title": "Department",
  "enum": ["Sales", "Engineering", "Support"],
  "x-values-source": {
    "kind": "static",
    "values": ["Sales", "Engineering", "Support"]
  }
}

Fetch from API

{
  "type": "string",
  "title": "Manager",
  "x-values-source": {
    "kind": "fetch",
    "url": "https://jsonplaceholder.typicode.com/users",
    "valueField": "id",
    "labelField": "name"
  }
}

For nested responses, set itemsPath (dot notation, e.g. "data.items").

import { readValuesSourceConfig, isFetchValuesSource } from "@jsonschema-editor/json-schema-extensions";

const config = readValuesSourceConfig(schemaNode);
if (config && isFetchValuesSource(config)) {
  console.log(config.url);
}

AJV (runtime validation)

import Ajv from "ajv";
import { registerAjvFormats, compileFormatValidator } from "@jsonschema-editor/json-schema-extensions";

const ajv = await registerAjvFormats(new Ajv());
const validateEmailField = compileFormatValidator(ajv, "email");
validateEmailField("[email protected]"); // true

registerAjvFormats loads ajv-formats for email/uri and registers the custom phone format.

Development

pnpm install
pnpm run build
pnpm test

License

MIT