@typespec/http
Advanced tools
Comparing version 0.44.0-dev.3 to 0.44.0-dev.4
@@ -38,5 +38,2 @@ declare const httpLib: import("@typespec/compiler").TypeSpecLibrary<{ | ||
}; | ||
"duplicate-response": { | ||
readonly default: import("@typespec/compiler").CallableMessage<["contentType", "statusCode"]>; | ||
}; | ||
"content-type-ignored": { | ||
@@ -67,3 +64,3 @@ readonly default: "`Content-Type` header ignored because there is no body."; | ||
}, Record<string, any>>; | ||
declare const reportDiagnostic: <C extends "http-verb-duplicate" | "http-verb-wrong-type" | "missing-path-param" | "optional-path-param" | "missing-server-param" | "duplicate-body" | "duplicate-route-decorator" | "operation-param-duplicate-type" | "duplicate-operation" | "status-code-invalid" | "content-type-string" | "duplicate-response" | "content-type-ignored" | "no-routes" | "invalid-type-for-auth" | "shared-inconsistency" | "write-visibility-not-supported" | "multipart-model" | "header-format-required" | "query-format-required", M extends keyof { | ||
declare const reportDiagnostic: <C extends "http-verb-duplicate" | "http-verb-wrong-type" | "missing-path-param" | "optional-path-param" | "missing-server-param" | "duplicate-body" | "duplicate-route-decorator" | "operation-param-duplicate-type" | "duplicate-operation" | "status-code-invalid" | "content-type-string" | "content-type-ignored" | "no-routes" | "invalid-type-for-auth" | "shared-inconsistency" | "write-visibility-not-supported" | "multipart-model" | "header-format-required" | "query-format-required", M extends keyof { | ||
"http-verb-duplicate": { | ||
@@ -105,5 +102,2 @@ readonly default: import("@typespec/compiler").CallableMessage<["entityName"]>; | ||
}; | ||
"duplicate-response": { | ||
readonly default: import("@typespec/compiler").CallableMessage<["contentType", "statusCode"]>; | ||
}; | ||
"content-type-ignored": { | ||
@@ -170,5 +164,2 @@ readonly default: "`Content-Type` header ignored because there is no body."; | ||
}; | ||
"duplicate-response": { | ||
readonly default: import("@typespec/compiler").CallableMessage<["contentType", "statusCode"]>; | ||
}; | ||
"content-type-ignored": { | ||
@@ -198,3 +189,3 @@ readonly default: "`Content-Type` header ignored because there is no body."; | ||
}; | ||
}, C, M>) => void, createDiagnostic: <C extends "http-verb-duplicate" | "http-verb-wrong-type" | "missing-path-param" | "optional-path-param" | "missing-server-param" | "duplicate-body" | "duplicate-route-decorator" | "operation-param-duplicate-type" | "duplicate-operation" | "status-code-invalid" | "content-type-string" | "duplicate-response" | "content-type-ignored" | "no-routes" | "invalid-type-for-auth" | "shared-inconsistency" | "write-visibility-not-supported" | "multipart-model" | "header-format-required" | "query-format-required", M extends keyof { | ||
}, C, M>) => void, createDiagnostic: <C extends "http-verb-duplicate" | "http-verb-wrong-type" | "missing-path-param" | "optional-path-param" | "missing-server-param" | "duplicate-body" | "duplicate-route-decorator" | "operation-param-duplicate-type" | "duplicate-operation" | "status-code-invalid" | "content-type-string" | "content-type-ignored" | "no-routes" | "invalid-type-for-auth" | "shared-inconsistency" | "write-visibility-not-supported" | "multipart-model" | "header-format-required" | "query-format-required", M extends keyof { | ||
"http-verb-duplicate": { | ||
@@ -236,5 +227,2 @@ readonly default: import("@typespec/compiler").CallableMessage<["entityName"]>; | ||
}; | ||
"duplicate-response": { | ||
readonly default: import("@typespec/compiler").CallableMessage<["contentType", "statusCode"]>; | ||
}; | ||
"content-type-ignored": { | ||
@@ -301,5 +289,2 @@ readonly default: "`Content-Type` header ignored because there is no body."; | ||
}; | ||
"duplicate-response": { | ||
readonly default: import("@typespec/compiler").CallableMessage<["contentType", "statusCode"]>; | ||
}; | ||
"content-type-ignored": { | ||
@@ -306,0 +291,0 @@ readonly default: "`Content-Type` header ignored because there is no body."; |
@@ -74,8 +74,2 @@ import { createTypeSpecLibrary, paramMessage } from "@typespec/compiler"; | ||
}, | ||
"duplicate-response": { | ||
severity: "error", | ||
messages: { | ||
default: paramMessage `Multiple return types for content type ${"contentType"} and status code ${"statusCode"}`, | ||
}, | ||
}, | ||
"content-type-ignored": { | ||
@@ -82,0 +76,0 @@ severity: "warning", |
@@ -65,12 +65,2 @@ import { createDiagnosticCollector, getDoc, isArrayModelType, isErrorModel, isNullType, isVoidType, walkPropertiesInherited, } from "@typespec/compiler"; | ||
}; | ||
// check for duplicates | ||
for (const contentType of contentTypes) { | ||
if (response.responses.find((x) => { var _a; return (_a = x.body) === null || _a === void 0 ? void 0 : _a.contentTypes.includes(contentType); })) { | ||
diagnostics.add(createDiagnostic({ | ||
code: "duplicate-response", | ||
format: { statusCode: statusCode.toString(), contentType }, | ||
target: responseType, | ||
})); | ||
} | ||
} | ||
if (bodyType !== undefined) { | ||
@@ -77,0 +67,0 @@ response.responses.push({ body: { contentTypes: contentTypes, type: bodyType }, headers }); |
{ | ||
"name": "@typespec/http", | ||
"version": "0.44.0-dev.3", | ||
"version": "0.44.0-dev.4", | ||
"author": "Microsoft Corporation", | ||
@@ -5,0 +5,0 @@ "description": "TypeSpec HTTP protocol binding", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
208860
2598