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

web-schema-forms

v0.0.2

Published

Web Schema is a technology that is used to describe data on the Web in a way that is intended to minimise impedance mismatch between the various uses of Web data (forms, DB, validation, APIs…).

Readme

Web Schema Forms

Web Schema is a technology that is used to describe data on the Web in a way that is intended to minimise impedance mismatch between the various uses of Web data (forms, DB, validation, APIs…).

Web Schema Forms converts Web Schema documents to HTML forms. Most systems that generate forms from schemata are either very limited, or when they have advanced features they tend to be linked to client-side dependencies that might not match what you prefer to use in your system. It can also be difficult to modify or enhance the behaviour of generated forms. This package tries very hard to work around those problems in order to enable the generic form generator. It does this by relying on the powerful Swig templating system, that notably supports very flexible template inheritance and extensions.

Example usage

var wsf = require("web-schema-forms");
wsf.loadPlugin(require("web-schema-forms-bootstrap"));

var form = WSF.form(["basic", "bootstrap"],
                    {
                      // web schema...
                    }
));

Installation

npm install web-schema-forms

API

form([inheritance], schema, [hints])

This is the core functionality that takes a schema and returns a string representing an HTML form. (Note that there is nothing HTML-specific in the fundamental code; if you produce a set of templates that inherits directly from root instead of basic then you can generate pretty much anything you want from a schema.)

It takes three parameters, the first and last of which are optional:

  • inheritance. An array that describes the inheritance line of templates. If left unspecified, defaults to ["root", "basic"] which will produce very bare bones HTML. If you wanted to use the Bootstrap and AngulasJS plugins together (so that your forms use both of these technologies) then you would specify ["basic", "bootstrap", "angular"] (the order of the two latter does not matter much). You don't need to start with root, it gets added for you.
  • schema. A Web Schema. Note that Web Schema is still evolving technology at this time, and so this package will evolve to match. Breaking changes are still possible.
  • hints. Optionally some hints can be provided in order to better control the behaviour of the templates. Currently the only supported hint is form_attrs which is an object the keys and values of which produce attributes on the <form> element. More hints will be added so that the templating behaviour can be modified without having to write templates.

register(name, path)

This registers a source of templates. Typically a plugin will call that in order to tell Web Schema Forms where its templates are, and for what key.

If you write your own extensions, you can call this directly to add your set of templates, without having to create a plugin.

Parameters:

  • name. The simple name for that template set, like root or basic.
  • path. The path to the directory containing the templates.

loadPlugin(plugin)

Load a plugin by specifying the plugin object. A plugin can be absolutely any object that responds to the API defined in the next section (it does not need to be a module for instance). Note that unless you want to somehow package and distribute them, you do not need to create a plugin in order to produce extensions; you can simply register your templates directly.

Parameters:

  • plugin. A plugin object.

Plugin API

The plugin API is extremely simple. A typical plugin will mostly be composed of templates, with the code simply serving as glue.

init(wsf)

Takes a Web Schema Forms instance and isn't expected to return anything. In the typical case, it will simply call register() on the provided object in order to configure the location of its templates set.

Writing plugins

Most of the complexity involved in plugins is in the writing of forms.

XXX

  • link to Swig
  • don't use extend, and use special import
  • available information: schema, hints, path