Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@loopback/openapi-v3

Package Overview
Dependencies
Maintainers
10
Versions
179
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loopback/openapi-v3

Decorators that annotate LoopBack artifacts with OpenAPI v3 metadata and utilities that transform LoopBack metadata to OpenAPI v3 specifications

  • 10.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
33K
decreased by-2.49%
Maintainers
10
Weekly downloads
 
Created
Source

@loopback/openapi-v3

This package contains:

  • Decorators that describe LoopBack artifacts as OpenAPI 3.0.0 metadata.
  • Utilities that transfer LoopBack metadata to OpenAPI 3.0.0 specifications.

Overview

The package has functions described above for LoopBack controller classes. Decorators apply REST api mapping metadata to controller classes and their members. And utilities that inspect controller classes to build OpenAPI 3.0.0 specifications from REST API mapping metadata.

Functions for more artifacts will be added when we need.

Installation

npm install --save @loopback/openapi-v3

Basic use

Currently this package only has spec generator for controllers. It generates OpenAPI specifications for a given decorated controller class, including paths, components.schemas, and servers.

Here is an example of calling function getControllerSpec to generate the OpenAPI spec:

import {get, getControllerSpec} from '@loopback/openapi-v3';

class MyController {
  @get('/greet')
  greet() {
    return 'Hello world!';
  }
}

const myControllerSpec = getControllerSpec(MyController);

then the myControllerSpec will be:

{
  paths: {
    '/greet': {
      get: {
        'x-operation-name': 'greet'
      }
    }
  },
}

For details of how to apply controller decorators, please check http://loopback.io/doc/en/lb4/Decorators.html#route-decorators

See https://www.openapis.org/ and version 3.0.0 of OpenAPI Specification.

Contributions

Tests

Run npm test from the root folder.

Contributors

See all contributors.

License

MIT

Keywords

FAQs

Package last updated on 04 Mar 2024

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