From 70f6893afecc98596c1b0494cb2d5f28b5af7ac7 Mon Sep 17 00:00:00 2001 From: Richard Webb Date: Mon, 15 Dec 2025 22:02:21 +0000 Subject: [PATCH] When processing the body of a request with an unsupported media type, and there is no OperationId defined, print the path in the error instead --- src/SwaggerProvider.DesignTime/v3/OperationCompiler.fs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/SwaggerProvider.DesignTime/v3/OperationCompiler.fs b/src/SwaggerProvider.DesignTime/v3/OperationCompiler.fs index 0d586c8..524e7a1 100644 --- a/src/SwaggerProvider.DesignTime/v3/OperationCompiler.fs +++ b/src/SwaggerProvider.DesignTime/v3/OperationCompiler.fs @@ -120,7 +120,14 @@ type OperationCompiler(schema: OpenApiDocument, defCompiler: DefinitionCompiler, formatAndParam NoData defSchema | _ -> let keys = operation.RequestBody.Content.Keys |> String.concat ";" - failwithf $"Operation '%s{operation.OperationId}' does not contain supported media types [%A{keys}]" + + let operationId = + if String.IsNullOrWhiteSpace(operation.OperationId) then + $"%s{path}/%A{opTy}" + else + operation.OperationId + + failwithf $"Operation '%s{operationId}' does not contain supported media types [%A{keys}]" let payloadTy = bodyFormatAndParam |> Option.map fst |> Option.defaultValue NoData