@digitalroute/bagger
Advanced tools
Comparing version 0.0.1 to 0.1.1
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.x = 'foo'; | ||
var response_1 = require("./response"); | ||
var request_1 = require("./request"); | ||
__export(require("./compile")); | ||
function response(httpCode) { | ||
return new response_1.BaggerResponse(httpCode); | ||
} | ||
exports.response = response; | ||
function request() { | ||
return new request_1.BaggerRequest(); | ||
} | ||
exports.request = request; |
@@ -1,1 +0,5 @@ | ||
export declare const x: 'foo' | 'bar'; | ||
import { BaggerResponse } from './response'; | ||
import { BaggerRequest } from './request'; | ||
export * from './compile'; | ||
export declare function response(httpCode: number): BaggerResponse; | ||
export declare function request(): BaggerRequest; |
102
package.json
{ | ||
"name": "@digitalroute/bagger", | ||
"version": "0.0.1", | ||
"version": "0.1.1", | ||
"description": "", | ||
"main": "dist/bagger.js", | ||
"typings": "dist/types/bagger.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"main": "dist/bagger.umd.js", | ||
"module": "dist/bagger.es5.js", | ||
"typings": "dist/types/bagger.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"engines": { | ||
"node": ">=9.11.2" | ||
}, | ||
"scripts": { | ||
"test": "ava", | ||
"test:watch": "ava --watch", | ||
"tsc": "tsc" | ||
"commit": "git-cz", | ||
"eslint": "eslint -c .eslintrc.json 'lib/**/*.ts' 'test/**/*.ts'", | ||
"test": "jest --coverage", | ||
"test:watch": "jest --watch", | ||
"test:prod": "npm run lint && npm run test -- --no-cache", | ||
"semantic-release": "semantic-release", | ||
"prebuild": "rimraf dist", | ||
"build": "tsc --module commonjs && rollup -c rollup.config.ts", | ||
"prettier": "prettier --write \"*.{js,json,md,yml}\"" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/juliuscc/bagger.git" | ||
"url": "git+https://github.com/digitalroute/bagger.git" | ||
}, | ||
@@ -32,22 +42,72 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/juliuscc/bagger/issues" | ||
"url": "https://github.com/digitalroute/bagger/issues" | ||
}, | ||
"homepage": "https://github.com/juliuscc/bagger#readme", | ||
"homepage": "https://github.com/digitalroute/bagger#readme", | ||
"dependencies": { | ||
"@hapi/joi": ">=15.0.0" | ||
"@types/hapi__joi": "^15.0.3", | ||
"joi": "^14.3.1", | ||
"joi-to-swagger": "^3.2.0", | ||
"json-schema-to-openapi-schema": "^0.3.0", | ||
"openapi3-ts": "^1.3.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^2.2.0", | ||
"ts-node": "^8.3.0", | ||
"@hapi/joi": "^15.1.0", | ||
"@types/jest": "^24.0.17", | ||
"@typescript-eslint/eslint-plugin": "^1.13.0", | ||
"@typescript-eslint/parser": "^1.13.0", | ||
"commitizen": "^4.0.3", | ||
"cz-conventional-changelog": "^3.0.2", | ||
"eslint": "^6.1.0", | ||
"eslint-config-nodejs": "^2.0.0", | ||
"eslint-config-prettier": "^6.0.0", | ||
"eslint-plugin-import": "^2.18.2", | ||
"eslint-plugin-jest": "^22.15.1", | ||
"husky": "^3.0.3", | ||
"jest": "^24.8.0", | ||
"jest-config": "^24.8.0", | ||
"latest-version-or-tag": "^1.2.0", | ||
"lint-staged": "^9.2.1", | ||
"lodash.camelcase": "^4.3.0", | ||
"prettier": "^1.18.2", | ||
"rimraf": "^2.6.3", | ||
"rollup": "^0.67.0", | ||
"rollup-plugin-commonjs": "^9.1.8", | ||
"rollup-plugin-json": "^3.1.0", | ||
"rollup-plugin-node-resolve": "^3.4.0", | ||
"rollup-plugin-sourcemaps": "^0.4.2", | ||
"rollup-plugin-typescript2": "^0.22.1", | ||
"semantic-release": "^15.13.19", | ||
"ts-jest": "^24.0.2", | ||
"typescript": "^3.5.3" | ||
}, | ||
"ava": { | ||
"compileEnhancements": false, | ||
"extensions": [ | ||
"ts" | ||
"jest": { | ||
"transform": { | ||
".ts": "ts-jest" | ||
}, | ||
"testEnvironment": "node", | ||
"testRegex": ".*\\.test\\.(ts)$", | ||
"testPathIgnorePatterns": [ | ||
"/node_modules/", | ||
"/dist/" | ||
], | ||
"require": [ | ||
"ts-node/register" | ||
"collectCoverageFrom": [ | ||
"lib/*/**.{ts}" | ||
] | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
}, | ||
"lint-staged": { | ||
"*.{js,json,md,yml}": [ | ||
"prettier --write", | ||
"git add" | ||
] | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "cz-conventional-changelog" | ||
} | ||
} | ||
} |
@@ -1,1 +0,58 @@ | ||
# bagger | ||
# Bagger | ||
[![npm (scoped)](https://img.shields.io/npm/v/@digitalroute/bagger?style=flat-square)](https://www.npmjs.com/package/@digitalroute/bagger) | ||
[![npm](https://img.shields.io/npm/dm/@digitalroute/bagger)](https://www.npmjs.com/package/@digitalroute/bagger) | ||
[![CircleCI](https://img.shields.io/circleci/build/github/digitalroute/bagger/master?style=flat-square)](https://circleci.com/gh/digitalroute/workflows/bagger) | ||
[![license](https://img.shields.io/github/license/digitalroute/bagger.svg?style=flat-square)](https://github.com/digitalroute/bagger/blob/master/LICENSE) | ||
A joi-compatible tool for building swagger definitions. It enables developers 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 definitions. | ||
- ✨ **joi compatibility:** Enables developers to use the same schemas for validation and documentation. | ||
- 🔎 **Intellisense:** Really nice intellisense suggestions, and TypeScript definitions. | ||
## Table of Contents | ||
WIP | ||
## Example | ||
```js | ||
const bagger = require('bagger'); | ||
const joi = require('@hapi/joi'); | ||
const getBags = bagger | ||
.request() | ||
.method('get') | ||
.path('/bags') | ||
.tag('bags') | ||
.tag('build') | ||
.responses([ | ||
bagger | ||
.response(200) | ||
.description('Successfully fetched all bags') | ||
.content( | ||
'application/json', | ||
joi | ||
.array() | ||
.items(joi.string()) | ||
.example(['handbag', 'backpack']) | ||
) | ||
]); | ||
const swaggerConfig = { | ||
title: 'Bagger API', | ||
version: 'v1', | ||
description: 'Provides resources for building swagger definitions' | ||
}; | ||
const swaggerDefinition = bagger.compile(swaggerConfig, [getBags]); | ||
``` | ||
## Installation | ||
Install bagger using `npm`: | ||
`npm install bagger` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
37528
21
600
1
1
59
5
28
1
+ Added@types/hapi__joi@^15.0.3
+ Addedjoi@^14.3.1
+ Addedjoi-to-swagger@^3.2.0
+ Addedopenapi3-ts@^1.3.0
+ Added@cloudflare/json-schema-walker@0.1.1(transitive)
+ Added@types/hapi__joi@15.0.4(transitive)
+ Addedhoek@6.1.3(transitive)
+ Addedisemail@3.2.0(transitive)
+ Addedjoi@14.3.1(transitive)
+ Addedjoi-to-swagger@3.3.0(transitive)
+ Addedjson-schema-to-openapi-schema@0.3.0(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedopenapi3-ts@1.4.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedtopo@3.0.3(transitive)
- Removed@hapi/joi@>=15.0.0
- Removed@hapi/address@4.1.0(transitive)
- Removed@hapi/formula@2.0.0(transitive)
- Removed@hapi/hoek@9.3.0(transitive)
- Removed@hapi/joi@17.1.1(transitive)
- Removed@hapi/pinpoint@2.0.1(transitive)
- Removed@hapi/topo@5.1.0(transitive)