JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q52859F
  • License ISC

a nodejs library for parsing smartapi specifications

Package Exports

  • smartapi-parser

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (smartapi-parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

smartapi-parser

Build Status Coverage Status

A NodeJS library for parsing SmartAPI specifications

Install

$ npm install smartapi-parser

Usage

The package requires SmartAPI specification in JSON format as its input. You can use fs or API fetch libraries such as node-fetch, axios to load a SmartAPI file from local or remote desitiniations.

const parser = require('smartapi-parser');
// need to install node-fetch libary first using npm i node-fetch
const fetch = require('node-fetch');

fetch('https://smart-api.info/api/metadata/81955d376a10505c1c69cd06dbda3047')
    .then(response => response.json())
    .then(spec => {
        let api = new parser(spec);
        console.log(api.metadata);
    });
    
    // // {
    // 	"title": "SEMMED Gene API",
    // 	"tags": ["disease", "annotation", "query", "translator", "biothings", "semmed"],
    // 	"url": "https://biothings.ncats.io/semmedgene",
    // 	"operations": [
    // 		"query_operation": ...,
    // 		"association": ...,
    // 		"response_mapping": ...,
    // 		"id": ...
    // 	]
    // // }