Socket
Socket
Sign inDemoInstall

@tealina/doc-types

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @tealina/doc-types

API document type designed for transformation tools


Version published
Weekly downloads
9
increased by125%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

API document type designed for transformation tools

Pre-knowledge

There's a package call tealina, it offer some CLI commands make create API service more easier, one of the command is tealina gdoc, it generate a doc.json file.

Install

Should be add as dependencies, not devDependencies, because the DocKind is exported as const object

pnpm add @tealina/doc-types

yarn add @tealina/doc-types

bun add @tealina/doc-types

npm i @tealina/doc-types

Demo

//doc.json
{
  "apis": {
    "get": { // http method
      "health": { // endpoind
        "response": {// DocNode
          "kind": 4, // DocKind
          "id": 268 
        },
      }
    }
  },
  "entityRefs": {
    "268": {
      "name": "{ status: string; }",
      "props": [
        {
          "kind": 0,// DocKind
          "type": "string",
          "name": "status"
        }
      ]
    }
  }
}
Every DocNode has a kind property, it's easy to code with switch case.

import { DocNode, DocKind, EntityRef } from '@tealina/doc-types'

function tranform2span(docNode:DocNode){
  switch(docNode.kind){
    case DocKind.Primitive:
      return <span>{docNode.type}</span>
    ...
  }
}

Convention

The name of your package should have a clear name with tealina-doc prefix.

Keywords

FAQs

Last updated on 25 Nov 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc