The following error is printed when trying to generate code from the attached swagger.
# yarn run oats oats/hyphen.yaml > hyphen.ts
(node:47395) UnhandledPromiseRejectionWarning: SyntaxError: Property or signature expected. (109:3)
107 |
108 | query?: {
> 109 | stuff-filter?: string;
| ^
110 | };
111 |
112 |
at t (/go/src/github.com/influxdata/ui/node_modules/prettier/parser-typescript.js:1:285)
at Object.parse (/go/src/github.com/influxdata/ui/node_modules/prettier/parser-typescript.js:14:180461)
at Object.parse (/go/src/github.com/influxdata/ui/node_modules/prettier/index.js:9739:19)
at coreFormat (/go/src/github.com/influxdata/ui/node_modules/prettier/index.js:13252:23)
at format (/go/src/github.com/influxdata/ui/node_modules/prettier/index.js:13510:73)
at formatWithCursor (/go/src/github.com/influxdata/ui/node_modules/prettier/index.js:13526:12)
at /go/src/github.com/influxdata/ui/node_modules/prettier/index.js:44207:15
at Object.format (/go/src/github.com/influxdata/ui/node_modules/prettier/index.js:44226:12)
at generate (/go/src/github.com/influxdata/ui/node_modules/@influxdata/oats/dist/generate.js:235:31)
at async Command.<anonymous> (/go/src/github.com/influxdata/ui/node_modules/@influxdata/oats/bin/oats:7:18)
(node:47395) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:47395) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
oats/hyphen.yaml
openapi: "3.0.0"
info:
title: Stuff service
version: 0.0.0
servers:
- url: /api/v2
paths:
/stuff:
get:
operationId: getStuff
parameters:
- $ref: "#/components/parameters/StuffFilter"
responses:
'204':
$ref: "#/components/responses/NoContent"
components:
parameters:
StuffFilter:
in: query
name: stuff-filter
required: false
description: stuff to return
schema:
type: string
responses:
NoContent:
description: No content
Word on the street is that something like this works fine, maybe if the names are quoted to avoid this error:
const foo = {
'stuff-filter': 'some filter'
}
The following error is printed when trying to generate code from the attached swagger.
oats/hyphen.yaml
Word on the street is that something like this works fine, maybe if the names are quoted to avoid this error: