typera-openapi
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -63,2 +63,3 @@ "use strict"; | ||
const description = getRouteDescription(ctx, symbol); | ||
const summary = getRouteSummary(ctx, symbol); | ||
const routeInput = getRouteInput(ctx, symbol); | ||
@@ -82,3 +83,3 @@ if (!routeInput) | ||
{ | ||
[method]: Object.assign(Object.assign(Object.assign(Object.assign({}, (description ? { description } : undefined)), (parameters.length > 0 ? { parameters } : undefined)), operationRequestBody(requestBody)), { responses }), | ||
[method]: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (summary ? { summary } : undefined)), (description ? { description } : undefined)), (parameters.length > 0 ? { parameters } : undefined)), operationRequestBody(requestBody)), { responses }), | ||
}, | ||
@@ -91,2 +92,7 @@ ]; | ||
.join(''); | ||
const getRouteSummary = (ctx, symbol) => symbol | ||
.getJsDocTags() | ||
.filter((tag) => tag.name === 'summary') | ||
.map((tag) => tag.text) | ||
.filter(utils_1.isDefined)[0]; | ||
const operationRequestBody = (contentSchema) => { | ||
@@ -93,0 +99,0 @@ if (!contentSchema) |
{ | ||
"name": "typera-openapi", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Generate OpenAPI spec from typera routes", | ||
"main": "index.js", | ||
"repository": "https://github.com/akheron/typera-openapi", | ||
@@ -12,2 +11,3 @@ "author": "Petri Lehtinen <petri@digip.org>", | ||
], | ||
"main": "dist/index.js", | ||
"typings": "./dist/index.d.ts", | ||
@@ -14,0 +14,0 @@ "bin": { |
@@ -25,2 +25,4 @@ # typera-openapi - typera to OpenAPI generator | ||
* | ||
* @summary You can also set a short summary | ||
* | ||
* @response 200 Success response description. | ||
@@ -93,3 +95,14 @@ * @response 400 Another description for a response. This one | ||
## Releasing | ||
``` | ||
$ yarn version --new-version <major|minor|patch> | ||
$ yarn publish | ||
$ git push origin main --tags | ||
``` | ||
Open https://github.com/akheron/typera-openapi/releases, edit the draft release, | ||
select the newest version tag, adjust the description as needed. | ||
[openapi v3]: https://swagger.io/specification/ | ||
[typera]: https://github.com/akheron/typera |
29155
589
107