Skip to content

Commit

Permalink
Handling within jsonEndpoints and endpointTags.
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinTail committed Dec 31, 2024
1 parent 7adb6a5 commit 2673359
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ import { Routing } from "./routing";
import { OnEndpoint, walkRouting } from "./routing-walker";
import { HandlingRules } from "./schema-walker";
import { zodToTs } from "./zts";
import { ZTSContext, printNode, addJsDocComment } from "./zts-helpers";
import {
ZTSContext,
printNode,
addJsDocComment,
makePropertyIdentifier,
} from "./zts-helpers";
import type Prettier from "prettier";

type IOKind = "input" | "response" | ResponseVariant | "encoded";
Expand Down Expand Up @@ -284,13 +289,16 @@ export class Integration {
if (isJson) {
// "get /v1/user/retrieve": true
jsonEndpoints.push(
f.createPropertyAssignment(propName, f.createTrue()),
f.createPropertyAssignment(
makePropertyIdentifier(propName),
f.createTrue(),
),
);
}
// "get /v1/user/retrieve": ["users"]
endpointTags.push(
f.createPropertyAssignment(
propName,
makePropertyIdentifier(propName),
f.createArrayLiteralExpression(
tags.map((tag) => f.createStringLiteral(tag)),
),
Expand Down

0 comments on commit 2673359

Please sign in to comment.