3.3.0 • Published 2 months ago
@digitalroute/bagger v3.3.0
🎒 Bagger
A joi-compatible tool for building Swagger (Open API 3) documents. It enables developers to use the same joi schemas for validation and documentation, ensuring that API documentation never becomes stale.
Features
- 🔨 Builder pattern: Dead simple api to create complex Swagger documents.
- ✨ joi compatibility: Enables developers to use the same schemas for validation and documentation. Embedded Joi is now exposed by default.
- 🔎 Intellisense: Really nice intellisense suggestions, and TypeScript definitions.
- 🔒 Type safety: Bagger always produces 100% valid Swagger documents. If you use TypeScript the compiler will enforce correctness in most cases, and otherwise Bagger will validate during compilation.
Usage
// Import as a classic javascript
const { bagger } = require('@digitalroute/bagger');
// OR
// Import the default instances ESModule / Typescript
import { bagger } from '@digitalroute/bagger';
Example
import { bagger, joi } from '@digitalroute/bagger';
bagger.configure({
title: 'Bagger API',
version: 'v1',
description: 'Provides resources for building swagger documents'
});
bagger
.addRequest('/bags', 'get')
.addTag('bags')
.addTag('build')
.addResponse(
bagger
.response(200)
.description('Successfully fetched all bags')
.content(
'application/json',
joi
.array()
.items(joi.string())
.example([['handbag', 'backpack', 'purse']])
)
);
const swaggerDefinition = bagger.compile();
Documentation
3.3.0
2 months ago
3.2.0
2 years ago
3.1.3
2 years ago
3.1.2
2 years ago
3.1.1
2 years ago
3.1.0
2 years ago
3.0.1
4 years ago
3.0.0
4 years ago
2.4.7
5 years ago
2.4.6
5 years ago
2.4.5
5 years ago
2.4.4
5 years ago
2.4.3
5 years ago
2.4.2
5 years ago
2.4.1
5 years ago
2.4.0
5 years ago
2.3.0
5 years ago
2.2.0
5 years ago
2.1.2
5 years ago
2.1.1
5 years ago
2.1.0
5 years ago
2.0.0
5 years ago
1.3.0
5 years ago
1.2.0
5 years ago
1.1.0
5 years ago
1.0.0
5 years ago
0.1.1
5 years ago
0.0.1
5 years ago