@asyncapi/problem
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

AsyncAPI Problem

Library that implements the Problem interface. Reference https://www.rfc-editor.org/rfc/rfc7807.

Installation

npm install @asyncapi/problem
// OR
yarn add @asyncapi/problem

Examples

Simple example

import { Problem } from '@asyncapi/problem';

const problem = new Problem({ type: 'https://example.com/problem', title: 'Example problem' });
console.log(problem.get('type'));

// Output:
// https://example.com/problem

Mixin example

import { ProblemMixin } from '@asyncapi/problem';

class MyProblem extends ProblemMixin({ typePrefix: 'https://example.com' }) {}

const problem = new MyProblem({ type: 'problem', title: 'Example problem' });
console.log(problem.get('type'));

// Output:
// https://example.com/problem

Develop

  1. Write code and tests in the __tests__ folder.
  2. Make sure all tests pass by npm test command.
  3. Make sure code can be transformed to JS by npm run build command.
  4. Make sure code is well formatted and secure by npm run lint:fix command.

Contributing

Read CONTRIBUTING guide.

Readme

Keywords

none

Package Sidebar

Install

npm i @asyncapi/problem

Weekly Downloads

2

Version

1.0.0

License

Apache-2.0

Unpacked Size

42.8 kB

Total Files

33

Last publish

Collaborators

  • fmvilas
  • derberg
  • asyncapi-bot