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

evrythng-openapi-tools

v1.8.0

Published

Tools for building, splitting, and validating OpenAPI specs

Downloads

8

Readme

evrythng-openapi-tools

Tool to join (build), split, and validate OpenAPI 3.0 YAML API specification files using a standardised directory and file naming convention.

Also includes several commands to generate familiar ReadMe.io-compatible documentation snippets to help preserve structure and style.

Installation

Install as a the CLI command evrythng-openapi-tools:

$ npm i -g evrythng-openapi-tools

Work with specs

Join

Join repository spec files that meet the standardised directory and file naming convention by providing paths to base.yaml files.

More than one input directory (i.e: multiple API projects) can be specified after the output directory. Each must meet the directory structure outlined below.

$ evrythng-openapi-tools join $inputDir $outputDir [$inputDir2, ...]

Split

Split a single OpenAPI spec file into components that meet the standardised directory and file naming convention by providing the full spec and desired output directory.

$ evrythng-openapi-tools split $specFile $outputDir

Validate

Validate an existing or joined OpenAPI spec file.

$ evrythng-openapi-tools validate $specFile

Lint Schemas and Paths

Lint all in schemas and paths for common things like example, and description to help ensure format consistency.

$ evrythng-openapi-tools lint $specFile

Generate Documentation

To generate a page designed for ReadMe.io for a given API, use the print page command specifying the tag for the API. The output will be written to a local file of the same name as the tag. specFile is the complete spec file obtained using the join command:

$ evrythng-openapi-tools print $specFile page $tag

Some sections and examples will still need to be finished manually.

If more granular printing of individual page sections is needed, use the following commands:

Print API Status

Print the 'API Status' section for a given tag, such as Thngs. Paths with operations using the tag will be listed as 'General Availability' unless the path has x-api-status set to something else, such as 'Beta'. For example:

/thngs/{thngId}:
  x-api-status: Beta
  get:
    tags:
      - Thngs
    summary: Read a Thng
    ...

$ evrythng-openapi-tools print $specFile api-status $tag

Print Definitions

Run definition, but for all definitions associated to a tag, such as "Thngs". You will be asked to order the applicable definitions before the final output is printed.

$ evrythng-openapi-tools print $specFile definitions $tag

Print Definition

Included in definitions.

Print a trio of 'Fields', 'Schema', and 'Example' for documentation purposes. The summaryName should be a summary from an operation that uses the schema in its responses.

If the definition contains any $ref to other schemas, A 'See Also' section will also be generated as expected at the bottom of the widget.

If the definition includes x-filterable-fields, a table of filterable fields and supported operators will be included as well.

$ evrythng-openapi-tools print $specFile definition $schemaName $summaryName

Print Fields

Included in definition.

Print the properties of a schema as a list of fields + attributes for documentation purposes.

$ evrythng-openapi-tools print $specFile fields $schemaName

Print Schema

Included in definition.

Print a reduced JSON Schema of a schema component for documentation purposes.

$ evrythng-openapi-tools print $specFile schema $schemaName

Print Operations

Print Request/Response widget pairs for a given tag all at the same time. You will be asked to order the applicable summaries before the final output is printed.

$ evrythng-openapi-tools print $specFile operations $tag

Print Operation

Included in operations.

Print a ReadMe.io-compatible Request/Response widget pair, featuring muliple language examples, by summary such as 'Read all Thngs'.

$ evrythng-openapi-tools print $specFile operation $summary

Print Filter Table

Print a ReadMe.io-compatible table widget for use in the Filters documentation page as the list of 'Available Fields' for all resource types.

$ evrythng-openapi-tools print filter-table

Print API Key Permissions List

Print the list of endpoints and which keys can access them as shown in the API Keys and Permissions page.

$ evrythng-openapi-tools print $specFile keyPermissions

Directory Structure

The directory structure for each repository's spec mirrors the internal structure of a single OpenAPI spec:

/paths
/components
  /schemas
  /requestBodies
  /parameters
base.yaml

The following file naming conventions allow easy splitting and joining of component files, as well as processing by documentation and testing tools.

Base File

Contains openapi, info, etc. Example:

base.yaml

Must contain 'components' with empty objects for each of 'schemas', 'requestBodies', and 'parameters'.

Path File

A file containing an OpenAPI path object, where the key has / replaced with -. Example:

projects-{projectId}-applications-{applicationId}.yaml

Parameter File

A file containing a single OpenAPI parameters object, which is the parameter name. Example:

projectId.yaml

Request Body File

A file containing a single requestBody object, which is the request body name. Example:

ProjectDocumentCreateBody.yaml

Schema File

A file containing a single schemas object, which is the schema name. Example:

ThngDocument.yaml