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

@avocode/octopus-schema

v2.2.2

Published

The file `openapi.json` describes the Octopus document format in the OpenAPI v3.1 RC format. "Octopus" in this context refers to the JSON representation of a single design file artboard content.

Downloads

12

Readme

Octopus Schema

The file openapi.json describes the Octopus document format in the OpenAPI v3.1 RC format. "Octopus" in this context refers to the JSON representation of a single design file artboard content.

The specification includes a definition for a fake GET / endpoint which returns the OctopusDocument root schema. This allows the linter to properly detect unused schema components.

Versioning

  • The described Octopus format minor version is specified in openapi.json#/info/version.
  • The version of this package MUST reflect the minor version of Octopus format described.
  • The patch version component reflects the iteration of the schema for the specific Octopus format minor version. Design file format-specific patch versions are not reflected in this specification. Any changes made to the specification based on format-specific octopus patches simply lead to a sequential increase of the patch version component of this package.

Usage

This repository is released to NPM as @avocode/octopus-schema.

yarn add --exact --dev @avocode/octopus-schema

TypeScript

  1. The main module of the library is the TypeScript type.
import { Octopus } from '@avocode/octopus-schema'

function processOctopus(data: Octopus.OctopusDocument) {
  if (data['layer']) {
    data['layers'].forEach((layerData) => {
      processLayer(layerData)
    })
  }
}

function processLayer(layerData: Octopus.Layer) {
  console.log(layerData)
}

OpenAPI

  1. Copy the OpenAPI file from the library to your build artifacts during your build step.
cp $(node -e 'console.log(require.resolve("@avocode/octopus-schema/openapi.json"))') ./octopus.json
  1. Reference the schemas from the octopus.json file.
{
  "info": {},
  "components": {
    "OctopusDocument": "./octopus.json#/components/schemas/OctopusDocument"
  }
}

How Is This Specification Used in Avocode

  • [x] The Open Design API specification includes this Octopus format specification.
  • [ ] The internal Octopus libraries and workers should use types from this package.

Development

  • The openapi.json file is edited by hand.
  • TypeScript type file is auto-generated from the openapi.json specification via openapi-typescript which can be run as yarn build:ts.
  • The repository is linted via Prettier which can be run as yarn lint:prettier (or as yarn lint:prettier -w for auto-fix).
  • The OpenAPI specification (openapi.json) is validated via Spectral which can be run as yarn validate:openapi.

Release Process

yarn publish
  • The command asks for the version bump.
    • The major and minor version components must reflect the Octopus format version described by the release. The patch version component is arbitrary. This is automatically checked.

Issues

  • The openapi.json#/openapi version field states the version of 3.0.2 instead of 3.1.x which allows the Spectral linter to process the file. Support for OpenAPI v3.1 is not currently included in the linter. (The feature from v3.1 which is important for us is the ability to specify siblings of $ref types. This allows us to reuse types while overriding their descriptions.)