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-api-design-systems-yaml

v0.99.2

Published

Parser adapter for parsing YAML documents into API Design Systems namespace.

Downloads

1,509,435

Readme

@swagger-api/apidom-parser-adapter-api-design-systems-yaml

@swagger-api/apidom-parser-adapter-api-design-systems-yaml is a parser adapter for API Design Systems specification versions defined in YAML format.

Supported versions:

  • 2021-05-07

Under the hood this adapter uses @swagger-api/apidom-parser-adapter-yaml-1-2 to parse a source string into generic ApiDOM in base ApiDOM namespace which is then refracted with API Design Systems 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-api-design-systems-yaml

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.aai.apidesignsystems;version=2021-05-07',
  'application/vnd.aai.apidesignsystems+yaml;version=2021-05-07'
]

detect

Detection is based on a regular expression matching required API Design Systems specification symbols in YAML format.

namespace

This adapter exposes an instance of API Design Systems 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 API Design Systems 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-api-design-systems-json';

// detecting
await detect('version: "2021-05-07"'); // => true
await detect('test'); // => false

// parsing
const parseResult = await parse('version: "2021-05-07"', { 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 apiDesignSystemsYamlAdapter from '@swagger-api/apidom-parser-adapter-api-design-systems-yaml';

const parser = new ApiDOMParser();

parser.use(apiDesignSystemsYamlAdapter);

const parseResult = await parser.parse('version: "2021-05-07"', {
  mediaType: apiDesignSystemsYamlAdapter.mediaTypes.latest('json')
});