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

@swagger-api/apidom-parser-adapter-workflows-json-1

v0.99.2

Published

Parser adapter for parsing JSON documents into Workflows 1.x.y namespace.

Downloads

1,079,931

Readme

@swagger-api/apidom-parser-adapter-workflows-json-1

@swagger-api/apidom-parser-adapter-workflows-json-1-0 is a parser adapter for the Workflows 1.x.x specification in JSON format. Under the hood this adapter uses apidom-parser-adapter-json to parse a source string into generic ApiDOM in base ApiDOM namespace which is then refracted with Workflows 1.x.y Refractors.

Installation

After prerequisites for installing this package are satisfied, you can install it via npm CLI by running the following command:

 $ npm install @swagger-api/apidom-parser-adapter-workflows-json-1

Parser adapter API

This parser adapter is fully compatible with parser adapter interface required by @swagger-api/apidom-parser and implements all required properties.

mediaTypes

Defines list of media types that this parser adapter recognizes.

[
  'application/vnd.oai.workflows;version=1.0.0',
  'application/vnd.oai.workflows+json;version=1.0.0',
]

detect

Detection is based on a regular expression matching required Workflows 1.0.0 specification symbols in JSON format.

namespace

This adapter exposes an instance of Workflows 1.x.y ApiDOM namespace.

parse

parse function consumes various options as a second argument. Here is a list of these options:

Option | Type | Default | Description --- | --- | --- | --- specObj | Object | Specification Object | This specification object drives the JSON AST transformation to Workflows 1.x.y ApiDOM namespace. sourceMap | Boolean | false | Indicate whether to generate source maps. refractorOpts | Object | {} | Refractor options are passed to refractors during refracting phase.

All unrecognized arbitrary options will be ignored.

Usage

This parser adapter can be used directly or indirectly via @swagger-api/apidom-parser.

Direct usage

During direct usage you don't need to provide mediaType as the parse function is already pre-bound with supported media types.

import { parse, detect } from '@swagger-api/apidom-parser-adapter-workflows-json-1';

// detecting
await detect('{"workflowsSpec": "1.0.0"}'); // => true
await detect('test'); // => false

// parsing
const parseResult = await parse('{"workflowsSpec": "1.0.0"}', { sourceMap: true });

Indirect usage

You can omit the mediaType option here, but please read Word on detect vs mediaTypes before you do so.

import ApiDOMParser from '@swagger-api/apidom-parser';
import * as workflowsJsonAdapter from '@swagger-api/apidom-parser-adapter-workflows-json-1';

const parser = new ApiDOMParser();

parser.use(workflowsJsonAdapter);

const parseResult = await parser.parse('{"workflowsSpec": "1.0.0"}', { mediaType: workflowsJsonAdapter.mediaTypes.latest('json') });