@airtasker/spot
Advanced tools
Comparing version 1.6.0 to 1.7.0
@@ -30,2 +30,3 @@ import { Type, TypeDef } from "./types"; | ||
description?: string; | ||
summary?: string; | ||
tags: string[]; | ||
@@ -32,0 +33,0 @@ method: HttpMethod; |
@@ -78,2 +78,3 @@ "use strict"; | ||
description: endpoint.description, | ||
summary: endpoint.summary, | ||
operationId: endpoint.name, | ||
@@ -80,0 +81,0 @@ parameters: endpointRequest && |
@@ -71,2 +71,3 @@ "use strict"; | ||
description: endpoint.description, | ||
summary: endpoint.summary, | ||
operationId: endpoint.name, | ||
@@ -73,0 +74,0 @@ parameters: endpointRequest && |
@@ -13,3 +13,3 @@ "use strict"; | ||
function parseEndpoint(klass, typeTable, lociTable) { | ||
var _a, _b; | ||
var _a; | ||
const decorator = klass.getDecoratorOrThrow("endpoint"); | ||
@@ -32,3 +32,7 @@ const decoratorConfig = parser_helpers_1.getDecoratorConfigOrThrow(decorator); | ||
// Handle jsdoc | ||
const description = (_a = parser_helpers_1.getJsDoc(klass)) === null || _a === void 0 ? void 0 : _a.getDescription().trim(); | ||
const jsDocNode = parser_helpers_1.getJsDoc(klass); | ||
const description = jsDocNode === null || jsDocNode === void 0 ? void 0 : jsDocNode.getDescription().trim(); | ||
// Handle summary | ||
const summaryNode = jsDocNode === null || jsDocNode === void 0 ? void 0 : jsDocNode.getTags().find(tag => tag.getTagName() === "summary"); | ||
const summary = summaryNode === null || summaryNode === void 0 ? void 0 : summaryNode.getComment(); | ||
// Handle draft | ||
@@ -64,3 +68,3 @@ const draft = klass.getDecorator("draft") !== undefined; | ||
const pathParamsInPath = getDynamicPathComponents(path); | ||
const pathParamsInRequest = (_b = request === null || request === void 0 ? void 0 : request.pathParams.map(pathParam => pathParam.name)) !== null && _b !== void 0 ? _b : []; | ||
const pathParamsInRequest = (_a = request === null || request === void 0 ? void 0 : request.pathParams.map(pathParam => pathParam.name)) !== null && _a !== void 0 ? _a : []; | ||
const exclusivePathParamsInPath = pathParamsInPath.filter(pathParam => !pathParamsInRequest.includes(pathParam)); | ||
@@ -87,2 +91,3 @@ const exclusivePathParamsInRequest = pathParamsInRequest.filter(pathParam => !pathParamsInPath.includes(pathParam)); | ||
description, | ||
summary, | ||
tags, | ||
@@ -89,0 +94,0 @@ method, |
@@ -1,1 +0,1 @@ | ||
{"version":"1.6.0","commands":{"checksum":{"id":"checksum","description":"Generate a checksum for a Spot contract","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot checksum api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]},"docs":{"id":"docs","description":"Preview Spot contract as OpenAPI3 documentation. The documentation server will start on http://localhost:8080.","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot docs api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"port":{"name":"port","type":"option","char":"p","description":"Documentation server port","default":8080}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]},"generate":{"id":"generate","description":"Runs a generator on an API. Used to produce client libraries, server boilerplates and well-known API contract formats such as OpenAPI.","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot generate --contract api.ts --language yaml --generator openapi3 --out output/"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"contract":{"name":"contract","type":"option","char":"c","description":"Path to a TypeScript Contract definition","required":true},"language":{"name":"language","type":"option","char":"l","description":"Language to generate"},"generator":{"name":"generator","type":"option","char":"g","description":"Generator to run"},"out":{"name":"out","type":"option","char":"o","description":"Directory in which to output generated files"}},"args":[]},"init":{"id":"init","description":"Generates the boilerplate for an API.","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot init\nGenerated the following files:\n- api.ts\n- tsconfig.json\n- package.json\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"lint":{"id":"lint","description":"Lint a Spot contract","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot lint api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]},"mock":{"id":"mock","description":"Run a mock server based on a Spot contract","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot mock api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"proxyBaseUrl":{"name":"proxyBaseUrl","type":"option","description":"If set, the server will act as a proxy and fetch data from the given remote server instead of mocking it"},"port":{"name":"port","type":"option","char":"p","description":"Port on which to run the mock server","required":true,"default":3010},"pathPrefix":{"name":"pathPrefix","type":"option","description":"Prefix to prepend to each endpoint path"}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]},"validate":{"id":"validate","description":"Validate a Spot contract","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot validate api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]},"validation-server":{"id":"validation-server","description":"Start the spot contract validation server","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot validation-server api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"port":{"name":"port","type":"option","char":"p","description":"The port where application will be available","default":5907}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]}}} | ||
{"version":"1.7.0","commands":{"checksum":{"id":"checksum","description":"Generate a checksum for a Spot contract","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot checksum api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]},"docs":{"id":"docs","description":"Preview Spot contract as OpenAPI3 documentation. The documentation server will start on http://localhost:8080.","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot docs api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"port":{"name":"port","type":"option","char":"p","description":"Documentation server port","default":8080}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]},"generate":{"id":"generate","description":"Runs a generator on an API. Used to produce client libraries, server boilerplates and well-known API contract formats such as OpenAPI.","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot generate --contract api.ts --language yaml --generator openapi3 --out output/"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"contract":{"name":"contract","type":"option","char":"c","description":"Path to a TypeScript Contract definition","required":true},"language":{"name":"language","type":"option","char":"l","description":"Language to generate"},"generator":{"name":"generator","type":"option","char":"g","description":"Generator to run"},"out":{"name":"out","type":"option","char":"o","description":"Directory in which to output generated files"}},"args":[]},"init":{"id":"init","description":"Generates the boilerplate for an API.","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot init\nGenerated the following files:\n- api.ts\n- tsconfig.json\n- package.json\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"lint":{"id":"lint","description":"Lint a Spot contract","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot lint api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]},"mock":{"id":"mock","description":"Run a mock server based on a Spot contract","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot mock api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"proxyBaseUrl":{"name":"proxyBaseUrl","type":"option","description":"If set, the server will act as a proxy and fetch data from the given remote server instead of mocking it"},"port":{"name":"port","type":"option","char":"p","description":"Port on which to run the mock server","required":true,"default":3010},"pathPrefix":{"name":"pathPrefix","type":"option","description":"Prefix to prepend to each endpoint path"}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]},"validate":{"id":"validate","description":"Validate a Spot contract","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot validate api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]},"validation-server":{"id":"validation-server","description":"Start the spot contract validation server","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot validation-server api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"port":{"name":"port","type":"option","char":"p","description":"The port where application will be available","default":5907}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]}}} |
{ | ||
"name": "@airtasker/spot", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"author": "Francois Wouts, Leslie Fung", | ||
@@ -5,0 +5,0 @@ "bin": { |
@@ -172,3 +172,3 @@ # Spot | ||
_See code: [build/cli/src/commands/checksum.js](https://github.com/airtasker/spot/blob/v1.6.0/build/cli/src/commands/checksum.js)_ | ||
_See code: [build/cli/src/commands/checksum.js](https://github.com/airtasker/spot/blob/v1.7.0/build/cli/src/commands/checksum.js)_ | ||
@@ -194,3 +194,3 @@ ## `spot docs SPOT_CONTRACT` | ||
_See code: [build/cli/src/commands/docs.js](https://github.com/airtasker/spot/blob/v1.6.0/build/cli/src/commands/docs.js)_ | ||
_See code: [build/cli/src/commands/docs.js](https://github.com/airtasker/spot/blob/v1.7.0/build/cli/src/commands/docs.js)_ | ||
@@ -216,3 +216,3 @@ ## `spot generate` | ||
_See code: [build/cli/src/commands/generate.js](https://github.com/airtasker/spot/blob/v1.6.0/build/cli/src/commands/generate.js)_ | ||
_See code: [build/cli/src/commands/generate.js](https://github.com/airtasker/spot/blob/v1.7.0/build/cli/src/commands/generate.js)_ | ||
@@ -255,3 +255,3 @@ ## `spot help [COMMAND]` | ||
_See code: [build/cli/src/commands/init.js](https://github.com/airtasker/spot/blob/v1.6.0/build/cli/src/commands/init.js)_ | ||
_See code: [build/cli/src/commands/init.js](https://github.com/airtasker/spot/blob/v1.7.0/build/cli/src/commands/init.js)_ | ||
@@ -276,3 +276,3 @@ ## `spot lint SPOT_CONTRACT` | ||
_See code: [build/cli/src/commands/lint.js](https://github.com/airtasker/spot/blob/v1.6.0/build/cli/src/commands/lint.js)_ | ||
_See code: [build/cli/src/commands/lint.js](https://github.com/airtasker/spot/blob/v1.7.0/build/cli/src/commands/lint.js)_ | ||
@@ -302,3 +302,3 @@ ## `spot mock SPOT_CONTRACT` | ||
_See code: [build/cli/src/commands/mock.js](https://github.com/airtasker/spot/blob/v1.6.0/build/cli/src/commands/mock.js)_ | ||
_See code: [build/cli/src/commands/mock.js](https://github.com/airtasker/spot/blob/v1.7.0/build/cli/src/commands/mock.js)_ | ||
@@ -323,3 +323,3 @@ ## `spot validate SPOT_CONTRACT` | ||
_See code: [build/cli/src/commands/validate.js](https://github.com/airtasker/spot/blob/v1.6.0/build/cli/src/commands/validate.js)_ | ||
_See code: [build/cli/src/commands/validate.js](https://github.com/airtasker/spot/blob/v1.7.0/build/cli/src/commands/validate.js)_ | ||
@@ -345,3 +345,3 @@ ## `spot validation-server SPOT_CONTRACT` | ||
_See code: [build/cli/src/commands/validation-server.js](https://github.com/airtasker/spot/blob/v1.6.0/build/cli/src/commands/validation-server.js)_ | ||
_See code: [build/cli/src/commands/validation-server.js](https://github.com/airtasker/spot/blob/v1.7.0/build/cli/src/commands/validation-server.js)_ | ||
<!-- commandsstop --> |
1709873
14090