Skip to content

[F] createDiagnostic

function createDiagnostic<C, M>(diag): Diagnostic

Type Parameters

Type Parameter
C extends | "client-name" | "client-service" | "unknown-client-format" | "incorrect-client-format" | "union-null" | "union-circular" | "union-unsupported" | "use-enum-instead" | "access" | "invalid-usage" | "invalid-encode" | "conflicting-multipart-model-usage" | "discriminator-not-constant" | "discriminator-not-string" | "wrong-client-decorator" | "encoding-multipart-bytes" | "unsupported-kind" | "multiple-services" | "server-param-not-path" | "unexpected-http-param-type" | "multiple-response-types" | "no-corresponding-method-param" | "unsupported-protocol" | "no-emitter-name" | "unsupported-generic-decorator-arg-type" | "empty-client-name" | "override-method-parameters-mismatch" | "duplicate-client-name" | "example-loading" | "duplicate-example-file" | "example-value-no-mapping" | "flatten-polymorphism" | "conflict-access-override" | "conflict-usage-override" | "duplicate-decorator" | "empty-client-namespace" | "unexpected-pageable-operation-return-type" | "invalid-alternate-source-type" | "invalid-initialized-by" | "api-version-not-string"
M extends string | number | symbol

Parameters

ParameterType
diagDiagnosticReport<{ access: { default: “Access value must be “public” or “internal”.”; }; api-version-not-string: { default: "Api version must be a string or a string enum"; }; client-name: { default: CallableMessage<["name"]>; }; client-service: { default: CallableMessage<["name"]>; }; conflict-access-override: { default: "@access override conflicts with the access calculated from operation or other @access override."; }; conflict-usage-override: { default: "@usage override conflicts with the usage calculated from operation or other @usage override."; }; conflicting-multipart-model-usage: { default: "Invalid encoding"; wrongType: CallableMessage<["modelName", "modelName", "modelName"]>; }; discriminator-not-constant: { default: CallableMessage<["discriminator"]>; }; discriminator-not-string: { default: CallableMessage<["discriminator", "discriminatorValue"]>; }; duplicate-client-name: { default: CallableMessage<["name", "scope"]>; nonDecorator: CallableMessage<["name", "scope"]>; }; duplicate-decorator: { default: CallableMessage<["decoratorName"]>; }; duplicate-example-file: { default: CallableMessage<["filename", "title", "operationId"]>; }; empty-client-name: { default: "Cannot pass an empty value to the @clientName decorator"; }; empty-client-namespace: { default: "Cannot pass an empty value to the @clientNamespace decorator"; }; encoding-multipart-bytes: { default: "Encoding should not be applied to bytes content in a multipart request. This is semi-incompatible with how multipart works in HTTP."; }; example-loading: { default: CallableMessage<["filename", "error"]>; noDirectory: CallableMessage<["directory"]>; noOperationId: CallableMessage<["filename"]>; }; example-value-no-mapping: { default: CallableMessage<["relativePath", "value"]>; }; flatten-polymorphism: { default: "Cannot flatten property of polymorphic type."; }; incorrect-client-format: { default: CallableMessage<["format", "expectedTargetTypes"]>; }; invalid-alternate-source-type: { default: CallableMessage<["typeName"]>; }; invalid-encode: { default: "Invalid encoding"; wrongType: CallableMessage<["encoding", "type"]>; }; invalid-initialized-by: { default: CallableMessage<["message"]>; }; invalid-usage: { default: “Usage value must be 2 (“input”) or 4 (“output”).”; }; multiple-response-types: { default: CallableMessage<["operation", "response"]>; }; multiple-services: { default: CallableMessage<["service"]>; }; no-corresponding-method-param: { default: CallableMessage<["paramName", "methodName", "paramName", "paramName"]>; }; no-emitter-name: { default: "Can not find name for your emitter, please check your emitter name."; }; override-method-parameters-mismatch: { default: CallableMessage<["methodName", "originalParameters", "overrideParameters"]>; }; server-param-not-path: { default: CallableMessage<["templateArgumentName", "templateArgumentType"]>; }; unexpected-http-param-type: { default: CallableMessage<["paramName", "expectedType", "actualType"]>; }; unexpected-pageable-operation-return-type: { default: "Operation is pageable but does not return a correct type."; }; union-circular: { default: "Cannot have a union containing self."; }; union-null: { default: "Cannot have a union containing only null types."; }; union-unsupported: { default: "Unions cannot be emitted by our language generators unless all options are literals of the same type."; null: "Unions containing multiple model types cannot be emitted unless the union is between one model type and 'null'."; }; unknown-client-format: { default: CallableMessage<["format", "knownValues"]>; }; unsupported-generic-decorator-arg-type: { default: CallableMessage<["decoratorName"]>; }; unsupported-kind: { default: CallableMessage<["kind"]>; }; unsupported-protocol: { default: "Currently we only support HTTP and HTTPS protocols"; }; use-enum-instead: { default: "Use enum instead of union of string or number literals. Falling back to the literal type."; }; wrong-client-decorator: { default: "@client or @operationGroup should decorate namespace or interface in client.tsp"; }; }, C, M>

Returns

Diagnostic