Skip to content

Commit 64f12df

Browse files
committed
include route params
1 parent 51f1785 commit 64f12df

File tree

5 files changed

+37
-21
lines changed

5 files changed

+37
-21
lines changed

flight-recorder-generator/flight-recorder-json-generator.js

Lines changed: 14 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flight-recorder-generator/flight-recorder-json-generator.ts

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,15 @@ export class FlightRecorderJsonGenerator {
1414
this.specification.endpoints.forEach(api => {
1515
const pathPrefix = path.join(f, api.name);
1616
const body =this.createRequestResponse(api.typeMapping.request);
17-
const args = api.queryStringParameters.reduce((o, p) => ({...o, [p.name]: p.type}), {});
18-
// @ts-ignore
19-
args.body = body;
17+
let args = api.queryStringParameters.reduce((o, p) => ({...o, [p.name]: p.type}), {});
18+
args = api.url.paths
19+
.flatMap(p=>p.parts)
20+
.reduce((o, p) => ({...o, [p.name]: p.type}), args);
21+
// tslint:disable-next-line:curly
22+
if (Object.keys(body).length > 0) {
23+
// @ts-ignore
24+
args.body = body;
25+
}
2026

2127
const request = {
2228
api: api.name,
@@ -25,7 +31,10 @@ export class FlightRecorderJsonGenerator {
2531
fs.writeFileSync(pathPrefix + "_request.json", stringify(request, {space:2}));
2632
const response = {
2733
api: api.name,
28-
headers: {},
34+
headers: {
35+
"content-length": "string",
36+
"content-type": "application/json; charset=UTF-8"
37+
},
2938
payload: {
3039
body: this.createRequestResponse(api.typeMapping.response)
3140

@@ -55,6 +64,7 @@ export class FlightRecorderJsonGenerator {
5564

5665
private static createValueType(typeName) {
5766
switch (typeName) {
67+
case "Time" : return "__time__";
5868
case "Uri" : return "__uri__";
5969
case "Date" : return "__date__";
6070
case "TimeSpan" : return "__duration__";
@@ -81,11 +91,12 @@ export class FlightRecorderJsonGenerator {
8191
}
8292

8393
private static createEnumSchema(enumType: Domain.Enum) {
84-
return {
85-
type: "string",
86-
description: enumType.flags ? "flags" : null,
87-
enum: enumType.members.map(e => e.name)
88-
};
94+
return "enum";
95+
// return {
96+
// type: "string",
97+
// description: enumType.flags ? "flags" : null,
98+
// enum: enumType.members.map(e => e.name)
99+
// };
89100
}
90101

91102
private lookupType(typeName) {

flight-recorder-generator/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"compilerOptions": {
3-
"target": "es6",
3+
"target": "es2019",
44
"module": "commonjs",
55
"esModuleInterop": true,
66
"moduleResolution": "node",

specification/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"compilerOptions": {
3-
"target": "es6",
3+
"target": "es2019",
44
"module": "commonjs",
55
"moduleResolution": "node",
66
"esModuleInterop": true,

swagger-generator/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"compilerOptions": {
3-
"target": "es6",
3+
"target": "es2019",
44
"module": "commonjs",
55
"moduleResolution": "node",
66
"esModuleInterop": true,

0 commit comments

Comments
 (0)