Skip to content

Commit

Permalink
remove dead (copy/pasted) code
Browse files Browse the repository at this point in the history
  • Loading branch information
pmcelhaney committed Apr 16, 2024
1 parent 60a6aea commit 11f5333
Showing 1 changed file with 1 addition and 29 deletions.
30 changes: 1 addition & 29 deletions src/typescript-generator/response-type-coder.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,6 @@ export class ResponseTypeCoder extends TypeCoder {
return super.names(this.requirement.data.$ref.split("/").at(-1));
}

typeForDefaultStatusCode(listedStatusCodes) {
const definedStatusCodes = listedStatusCodes.filter(
(key) => key !== "default",
);

if (definedStatusCodes.length === 0) {
return "[statusCode in HttpStatusCode]";
}

return `[statusCode in Exclude<HttpStatusCode, ${definedStatusCodes.join(
" | ",
)}>]`;
}

normalizeStatusCode(statusCode) {
if (statusCode === "default") {
return this.typeForDefaultStatusCode(Object.keys(this.requirement.data));
}

return statusCode;
}

buildContentObjectType(script, response) {
if (response.has("content")) {
return response.get("content").map((content, mediaType) => [
Expand Down Expand Up @@ -94,16 +72,10 @@ export class ResponseTypeCoder extends TypeCoder {
}

writeCode(script) {
const text = `{
return `{
headers: ${this.printHeaders(script, this.requirement)};
requiredHeaders: ${this.printRequiredHeaders(this.requirement)};
content: ${this.printContentObjectType(script, this.requirement)};
}`;

if (text.includes("HttpStatusCode")) {
script.importSharedType("HttpStatusCode");
}

return text;
}
}

0 comments on commit 11f5333

Please sign in to comment.