Skip to content

Commit 0534cbd

Browse files
committed
Extract enum, support UnionType, Suuport response header and more (lukeautry#141)
- Support Query array type - Support custom response header (lukeautry#89) - Support tsoa config yaml format (lukeautry#133) - Support generate swagger yaml format - Support string, number and boolan UnionType (lukeautry#5) - Support AnyKeyword (lukeautry#114) - update route schema and update type - Change swagger enum inline type to enum definitions - Add new rule for tslint - Fix set status not work lukeautry#94 - Fix validate - Set query array collectionFormat, default to multi - Create file for Circle CI
1 parent c483936 commit 0534cbd

File tree

85 files changed

+6359
-6825
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+6359
-6825
lines changed

README.MD

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@
2323

2424
## How it works
2525

26+
## Installation
27+
28+
```sh
29+
npm install tsoa --save
30+
// OR
31+
npm install lukeautry/tsoa#[VERSION]
32+
```
33+
2634
### Create Controllers
2735

2836
```typescript
@@ -398,12 +406,6 @@ If you have a project that utilized this functionality, you can configure the in
398406

399407
Now that you have a swagger spec (swagger.json), you can use all kinds of amazing tools that [generate documentation, client SDKs, and more](http://swagger.io/).
400408

401-
## Installation
402-
403-
```
404-
npm install tsoa --save
405-
```
406-
407409
## Command Line Interface
408410

409411
For information on the configuration object (tsoa.json), check out the following:

circle.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
machine:
2+
pre:
3+
- mkdir ~/.yarn-cache
4+
node:
5+
version: 7.9
6+
environment:
7+
DEBIAN_FRONTEND: noninteractive
8+
PATH: "${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin"
9+
10+
dependencies:
11+
cache_directories:
12+
- ~/.yarn-cache
13+
pre:
14+
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
15+
override:
16+
- yarn install
17+
test:
18+
override:
19+
- yarn test
20+
21+
deployment:
22+
npm:
23+
tag: /v[0-9]+(\.[0-9]+)*/
24+
commands:
25+
- npm publish

hapi-tsoa.json

Lines changed: 0 additions & 51 deletions
This file was deleted.

hapi-tsoa.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
swagger:
3+
outputDirectory: "./dist"
4+
entryFile: "./tests/fixtures/hapi/server.ts"
5+
host: localhost:3000
6+
version: '1.0'
7+
name: tsoa app
8+
description: |
9+
line 1
10+
line 2
11+
license: MIT
12+
basePath: "/v1"
13+
securityDefinitions:
14+
api_key:
15+
type: apiKey
16+
name: access_token
17+
in: query
18+
tsoa_auth:
19+
type: oauth2
20+
authorizationUrl: http://swagger.io/api/oauth/dialog
21+
flow: implicit
22+
scopes:
23+
write:pets: modify things
24+
read:pets: read things
25+
spec:
26+
api_key:
27+
type: apiKey
28+
name: api_key
29+
in: header
30+
tsoa_auth:
31+
type: oauth2
32+
authorizationUrl: http://swagger.io/api/oauth/dialog
33+
flow: implicit
34+
scopes:
35+
write:pets: modify things
36+
read:pets: read things
37+
routes:
38+
basePath: "/v1"
39+
entryFile: "./tests/fixtures/hapi/server.ts"
40+
routesDir: "./tests/fixtures/hapi"
41+
middleware: hapi
42+
authenticationModule: "./tests/fixtures/hapi/authentication.ts"

inversify-tsoa.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"swagger": {
33
"outputDirectory": "./dist",
4-
"entryFile": "./tests/fixtures/express/server.ts",
4+
"entryFile": "./tests/fixtures/inversify/server.ts",
55
"host": "localhost:3000",
66
"version": "1.0",
77
"name": "tsoa app",

koa-tsoa.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"swagger": {
33
"outputDirectory": "./dist",
4-
"entryFile": "./tests/fixtures/server.ts",
4+
"entryFile": "./tests/fixtures/koa/server.ts",
55
"host": "localhost:3000",
66
"version": "1.0",
77
"name": "tsoa app",

package.json

Lines changed: 44 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@
1414
],
1515
"scripts": {
1616
"start": "tsc -w",
17-
"build": "npm run clean && tsc && npm run copy-templates",
17+
"build": "npm run clean && npm run tsc && npm run copy-templates && npm run copy-types",
18+
"copy-types": "copyfiles -u 1 ./src/*.d.ts ./dist",
1819
"copy-templates": "copyfiles -u 1 ./src/routeGeneration/templates/**/* ./dist",
19-
"clean": "rimraf dist && rimraf test/fixtures/routes.ts",
20-
"lint": "tslint --exclude=./node_modules/** ./src/**/*.ts ./tests/**/*.ts",
20+
"clean": "rimraf dist && rimraf tests/fixtures/*/routes.ts",
21+
"lint": "tslint --exclude ./node_modules/** ./src/**/*.ts ./tests/**/*.ts",
2122
"format": "tsfmt -r",
2223
"prepublish": "npm run build",
23-
"deploy": "npm version patch && npm publish",
24-
"postversion": "git push origin master",
24+
"deploy": "npm version patch -m \"Release v%s\" && npm publish",
25+
"postversion": "git push origin master && git push --follow-tags",
2526
"routes-gen": "node ./dist/cli.js routes",
2627
"swagger-gen": "node ./dist/cli.js swagger",
27-
"routes-gen:hapi": "node ./dist/cli.js routes --configuration=hapi-tsoa.json",
28+
"routes-gen:hapi": "node ./dist/cli.js routes --configuration=hapi-tsoa.yaml",
2829
"routes-gen:koa": "node ./dist/cli.js routes --configuration=koa-tsoa.json",
2930
"routes-gen:custom": "node ./dist/cli.js routes --configuration=custom-tsoa.json",
3031
"routes-gen:inversify": "node ./dist/cli.js routes --configuration=inversify-tsoa.json",
@@ -35,56 +36,56 @@
3536
"author": "Luke Autry <lukeautry@gmail.com> (http://www.lukeautry.com)",
3637
"license": "MIT",
3738
"dependencies": {
38-
"handlebars": "^4.0.6",
39-
"handlebars-helpers": "^0.8.0",
40-
"lodash": "^4.17.4",
39+
"handlebars": "^4.0.10",
40+
"handlebars-helpers": "^0.9.5",
41+
"lodash.indexof": "^4.0.5",
42+
"lodash.map": "^4.6.0",
4143
"merge": "^1.2.0",
42-
"mkdirp": "^0.5.1",
43-
"moment": "^2.17.1",
44-
"pretty-error": "^2.1.0",
45-
"tslint": "4.4.2",
46-
"typescript": "^2.4.1",
47-
"typescript-formatter": "^5.1.0",
48-
"validator": "^7.0.0",
49-
"yargs": "^6.6.0"
44+
"moment": "^2.18.1",
45+
"typescript": "^2.3.4",
46+
"typescript-formatter": "^5.2.0",
47+
"validator": "^8.0.0",
48+
"yamljs": "^0.3.0",
49+
"yargs": "^8.0.2"
5050
},
5151
"devDependencies": {
52-
"@types/body-parser": "^0.0.34",
53-
"@types/chai": "^3.4.35",
54-
"@types/express": "^4.0.35",
55-
"@types/handlebars": "^4.0.31",
56-
"@types/hapi": "^16.0.0",
52+
"@types/body-parser": "^1.16.4",
53+
"@types/chai": "^3.5.2",
54+
"@types/express": "^4.0.36",
55+
"@types/handlebars": "^4.0.35",
56+
"@types/hapi": "^16.1.7",
5757
"@types/koa": "^2.0.38",
5858
"@types/koa-bodyparser": "^3.0.23",
59-
"@types/koa-router": "^7.0.21",
59+
"@types/koa-router": "^7.0.22",
6060
"@types/method-override": "^0.0.29",
61-
"@types/mime": "^0.0.29",
61+
"@types/mime": "^1.3.1",
6262
"@types/minimatch": "^2.0.29",
63-
"@types/mkdirp": "^0.3.29",
64-
"@types/mocha": "^2.2.39",
65-
"@types/node": "^7.0.5",
63+
"@types/mocha": "^2.2.41",
64+
"@types/node": "^8.0.17",
6665
"@types/serve-static": "^1.7.31",
67-
"@types/superagent": "^2.0.36",
68-
"@types/supertest": "^2.0.0",
69-
"@types/validator": "^6.2.0",
70-
"@types/yargs": "^6.6.0",
71-
"body-parser": "^1.16.1",
72-
"chai": "^3.5.0",
66+
"@types/superagent": "^2.3.1",
67+
"@types/supertest": "^2.0.2",
68+
"@types/validator": "^6.2.1",
69+
"@types/yamljs": "^0.2.30",
70+
"@types/yargs": "^8.0.1",
71+
"body-parser": "^1.17.2",
72+
"chai": "^4.1.0",
7373
"copyfiles": "^1.2.0",
74-
"cross-env": "^3.2.4",
74+
"cross-env": "^5.0.1",
7575
"express": "^4.15.3",
7676
"express-serve-static-core": "^0.1.1",
77-
"hapi": "^16.1.0",
78-
"inversify": "^3.1.0",
79-
"koa": "^2.0.1",
80-
"koa-bodyparser": "^3.2.0",
81-
"koa-router": "^7.0.1",
82-
"method-override": "^2.3.7",
83-
"mocha": "^3.2.0",
77+
"hapi": "^16.5.0",
78+
"inversify": "^4.3.0",
79+
"koa": "^2.3.0",
80+
"koa-bodyparser": "^4.2.0",
81+
"koa-router": "^7.2.1",
82+
"method-override": "^2.3.9",
83+
"mocha": "^3.4.2",
8484
"reflect-metadata": "^0.1.10",
8585
"rimraf": "^2.6.1",
86-
"supertest": "^2.0.1",
87-
"ts-node": "^3.1.0"
86+
"supertest": "^3.0.0",
87+
"ts-node": "^3.3.0",
88+
"tslint": "^5.5.0"
8889
},
8990
"repository": {
9091
"type": "git",

src/ambient.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)