@oada/media-types
TypeScript icon, indicating that this package has built-in type declarations

4.0.0 • Public • Published

@OADA/media-types

This package is a library for resolving media types to their corresponding OADA schema(s).

Installation

yarn add @oada/media-types

Usage

The library takes a string, Request, or Response and returns an array of schema $ids. If it cannot determine a corresponding schema, the array will be empty.

import mediaType2schema from '@oada/media-types';

// ['https://formats.openag.io/oada/bookmarks/v1.schema.json']
const schema = mediaType2schema('application/vnd.oada.bookmarks.1+json');

// Or when dealing with http requests (e.g., in express)
app.use((req) => {
  const schema = mediaType2schema(req);
});

Dependencies (2)

Dev Dependencies (3)

Package Sidebar

Install

npm i @oada/media-types

Weekly Downloads

38

Version

4.0.0

License

MIT

Unpacked Size

9.71 kB

Total Files

12

Last publish

Collaborators

  • sanoel
  • serviopalacios
  • aultac
  • awlayton
  • oadao
  • tarakawa
  • cyrusbowman
  • abalmos