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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@map-colonies/schemas

v1.0.1

Published

Package for all of MapColonies config schemas

Downloads

123

Readme

Schemas

A repo for all configuration schemas and for generating the schema NPM package. Any schema can be created based on need.

When a new version is released, an NPM package containing all the schemas, and their equivalent typescript definitions is published.

Directory structure

  • All schemas created should be nested under the schemas folder.
  • The folder structure indicates the name and location of the schema.
  • Each schema file should be named in ascending order (v1, v2, v3, ...).
  • Schema references should be relative to the root schemas folder. For example, the reference to the the db schema in common is https://mapcolonies.com/common/db/v1.
└── schemas/
    ├── common/
    │   └── db/
    │       ├── v1.schema.json
    │       └── v2.schema.json
    └── raster/
        ├── mapproxy/
        │   ├── v1.schema.json
        │   └── v2.schema.json
        └── pycsw/
            └── v1.schema.json

Schema versioning

In order to simplify the usage and maintainability of the schemas, each schema is given a version number that is a consecutive positive integer.

Once a new version of the package has been released, schemas should not be edited. Instead a new version of the schema should be created.

Schema files

  • The schema files are a JSON Schema in either JSON ~~or Typescript~~ format. Example of JSON schema in native json format:
{
  "$id": "https://mapcolonies.com/common/example/v1",
  "description": "Example schema",
  "properties": {
    "name": {
      "type": "string"
    }
  }
}
  • The JSON Schema version used is Draft-07.
  • Each schema should contain the ID field with the value based on the relative location of the schema in the schemas folder.
  • ~~If the schema is in Typescript, it should have a default export that is a valid JSON Schema. For convenience, the package typebox is installed to help generating JSON Schemas.~~
  • Schemas can be composed from other schemas using the key words AllOf, OneOf, AnyOf and using references. Example of schema with internal reference:
{
  "$id": "https://mapcolonies.com/common/example/v1",
  "description": "Example internal reference",
  "properties": {
    "name": {
      "$ref": "#/definitions/name"
    }
  },
  "definitions": {
    "name": {
      "type": "string",
      "x-env-value": "NAME"
    }
  }
}
  • The Schemas can contain both internal references and references to other schemas in the repository. Circular references are not allowed (schemas referencing themselves). Example of schema with external reference:
{
  "$id": "https://mapcolonies.com/common/example/v1",
  "description": "Example external reference",
  "properties": {
    "name": {
      "$ref": "https://mapcolonies.com/common/name/v1"
    }
  }
}

Custom schema properties

In order to enable extra abilities and features we have added custom properties that can be added to schemas.

  • x-env-value - The value from which to pull environment variables to override the config values.
  • x-populate-as-env - experimental Whether to place the value into the environment variable defined in x-env-value.
{
  "$id": "https://mapcolonies.com/common/example/v1",
  "description": "Example custom properties",
  "properties": {
    "name": {
      "type": "string",
      "x-env-value": "NAME"
    }
  }
}

Validations

The repo contains a validation script to make sure all the schemas are valid. To run the script write the following command into your terminal: npm run validate.

The script contains the following validations:

  • Each folder contains either folders or only schema files (schema | markdown).
  • The schema files are in the correct format - ~~Typescript or~~ JSON.
  • The files in the folders are in ascending order (v1,v2,v3,...).
  • Each file contains a valid JSON Schema.
  • The ID of each schema is in the correct structure - https://mapcolonies.com/directory/v1.schema.json#subReference
  • All the references in the schema are valid and point to other schemas in the repo.
  • There are no circular references.

Release

The releases in this repo are managed by release-please. Release pull requests are automatically opened and are based on commit messages written using conventional commits. To execute the release you only need to merge the opened pull request.

For more information about release-please check the documentation.