Socket
Socket
Sign inDemoInstall

jsonapi-typescript

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsonapi-typescript

TypeScript definitions for JSON-API


Version published
Weekly downloads
3.6K
decreased by-6.06%
Maintainers
1
Weekly downloads
 
Created
Source

JSONAPI-typescript

Build Status Version

TypeScript type information for compile-time validation of JSON:API documents. Supports TS 2.3 and above.

How to use this

  1. Install this package
npm install --save-dev jsonapi-typescript
  1. Import this module
import * as JSONAPI from 'jsonapi-typescript';
  1. check to see if json types are validated correctly
import * as JSONAPI from 'jsonapi-typescript';

// ✅ This should be OK
let doc: JSONAPI.Document = {
  data: {
    type: 'articles',
    id: '1'
  }
};

// ⛔️ This should NOT be OK ("result" is not a valid JSON:API top-level key)
let doc: JSONAPI.Document = {
  result: "Success!"
};

// ⛔️ This should NOT be OK ( empty Array is not a valid JSON:API document )
let doc: JSONAPI.Document = [];

© 2017 Mike North, All Rights Reserved.

Keywords

FAQs

Package last updated on 10 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc