diff --git a/src/Microsoft.OpenApi.OData.Reader/Operation/OperationHandler.cs b/src/Microsoft.OpenApi.OData.Reader/Operation/OperationHandler.cs index 2a81b1f2..3d775efe 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Operation/OperationHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Operation/OperationHandler.cs @@ -1,4 +1,4 @@ -// ------------------------------------------------------------ +// ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. // ------------------------------------------------------------ @@ -186,11 +186,21 @@ protected static void AppendCustomParameters(OpenApiOperation operation, IList(); diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EdmFunctionImportOperationHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EdmFunctionImportOperationHandlerTests.cs index ff7e82af..2af99e69 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EdmFunctionImportOperationHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EdmFunctionImportOperationHandlerTests.cs @@ -173,7 +173,31 @@ public void OperationRestrictionsTermWorksToCreateOperationForEdmFunctionImport( - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -262,6 +286,49 @@ public void OperationRestrictionsTermWorksToCreateOperationForEdmFunctionImport( } } ".ChangeLineBreaks(), json); + + // Assert with no DocumentationURL value + Assert.Contains(@" + { + ""name"": ""myhead2"", + ""in"": ""header"", + ""description"": ""This is the description for myhead2."", + ""schema"": { + ""type"": ""string"" + } + } +".ChangeLineBreaks(), json); + + // Assert with no Description value + Assert.Contains(@" + { + ""name"": ""myhead3"", + ""in"": ""header"", + ""description"": ""Documentation URL: https://foo.bar.com/myhead3"", + ""schema"": { + ""type"": ""string"" + } + } +".ChangeLineBreaks(), json); + + // Assert with both DocumentationURL and Description values + Assert.Contains(@" + { + ""name"": ""myhead4"", + ""in"": ""header"", + ""description"": ""This is the description for myhead4. Documentation URL: https://foo.bar.com/myhead4"", + ""schema"": { + ""type"": ""string"" + }, + ""examples"": { + ""example-1"": { + ""description"": ""The sample description."", + ""value"": ""sample"" + } + } + } +".ChangeLineBreaks(), json); + } else { @@ -269,4 +336,4 @@ public void OperationRestrictionsTermWorksToCreateOperationForEdmFunctionImport( } } } -} +} \ No newline at end of file