From daafde42f07f58a8c669044fb27a2966fd51b91e Mon Sep 17 00:00:00 2001
From: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
Date: Thu, 7 Nov 2024 15:18:29 +0000
Subject: [PATCH] .Net: Rename OpenAPI model classes (#9595)
### Motivation, Context and Description
The public OpenAPI model classes that have "operation" in their name
were renamed to align with the other classes that do not have the word
in their name.
Additionally, the `RestApiPayloadProperty.Type`,
`RestApiParameter.Type`, and `RestApiParameter.ArrayItemType` were made
internal to simplify the update to OpenAPI.NET v2, where their types
have been changed.
---
.../OpenApiFunctionExecutionParameters.cs | 20 +-
.../Extensions/RestApiOperationExtensions.cs | 48 ++--
.../Functions.OpenApi/HttpContentFactory.cs | 2 +-
...Response.cs => RestApiExpectedResponse.cs} | 8 +-
.../Model/RestApiOperation.cs | 40 +--
...rationParameter.cs => RestApiParameter.cs} | 20 +-
...ocation.cs => RestApiParameterLocation.cs} | 4 +-
...meterStyle.cs => RestApiParameterStyle.cs} | 4 +-
...iOperationPayload.cs => RestApiPayload.cs} | 10 +-
...dProperty.cs => RestApiPayloadProperty.cs} | 16 +-
.../Model/RestApiSecurityScheme.cs | 2 +-
...ApiOperationServer.cs => RestApiServer.cs} | 12 +-
...erVariable.cs => RestApiServerVariable.cs} | 8 +-
.../Model/RestApiSpecification.cs | 2 +-
.../OpenApi/OpenApiDocumentParser.cs | 46 ++--
.../OpenApiKernelPluginFactory.cs | 6 +-
.../RestApiOperationRunner.cs | 6 +-
.../FormStyleParameterSerializer.cs | 18 +-
.../PipeDelimitedStyleParameterSerializer.cs | 18 +-
.../SimpleStyleParameterSerializer.cs | 18 +-
.../SpaceDelimitedStyleParameterSerializer.cs | 18 +-
.../RestApiOperationExtensionsTests.cs | 32 +--
.../OpenApi/OpenApiDocumentParserV20Tests.cs | 22 +-
.../OpenApi/OpenApiDocumentParserV30Tests.cs | 22 +-
.../OpenApi/OpenApiDocumentParserV31Tests.cs | 20 +-
.../OpenApi/RestApiOperationRunnerTests.cs | 252 +++++++++---------
.../OpenApi/RestApiOperationTests.cs | 158 +++++------
.../FormStyleParametersSerializerTests.cs | 36 +--
...DelimitedStyleParametersSerializerTests.cs | 20 +-
.../SimpleStyleParametersSerializerTests.cs | 10 +-
...DelimitedStyleParametersSerializerTests.cs | 20 +-
31 files changed, 460 insertions(+), 458 deletions(-)
rename dotnet/src/Functions/Functions.OpenApi/Model/{RestApiOperationExpectedResponse.cs => RestApiExpectedResponse.cs} (76%)
rename dotnet/src/Functions/Functions.OpenApi/Model/{RestApiOperationParameter.cs => RestApiParameter.cs} (87%)
rename dotnet/src/Functions/Functions.OpenApi/Model/{RestApiOperationParameterLocation.cs => RestApiParameterLocation.cs} (86%)
rename dotnet/src/Functions/Functions.OpenApi/Model/{RestApiOperationParameterStyle.cs => RestApiParameterStyle.cs} (90%)
rename dotnet/src/Functions/Functions.OpenApi/Model/{RestApiOperationPayload.cs => RestApiPayload.cs} (72%)
rename dotnet/src/Functions/Functions.OpenApi/Model/{RestApiOperationPayloadProperty.cs => RestApiPayloadProperty.cs} (84%)
rename dotnet/src/Functions/Functions.OpenApi/Model/{RestApiOperationServer.cs => RestApiServer.cs} (78%)
rename dotnet/src/Functions/Functions.OpenApi/Model/{RestApiOperationServerVariable.cs => RestApiServerVariable.cs} (85%)
diff --git a/dotnet/src/Functions/Functions.OpenApi/Extensions/OpenApiFunctionExecutionParameters.cs b/dotnet/src/Functions/Functions.OpenApi/Extensions/OpenApiFunctionExecutionParameters.cs
index 9673411bcbbb..f5a6ee3519bb 100644
--- a/dotnet/src/Functions/Functions.OpenApi/Extensions/OpenApiFunctionExecutionParameters.cs
+++ b/dotnet/src/Functions/Functions.OpenApi/Extensions/OpenApiFunctionExecutionParameters.cs
@@ -23,13 +23,13 @@ public class OpenApiFunctionExecutionParameters
public AuthenticateRequestAsyncCallback? AuthCallback { get; set; }
///
- /// Override for REST API operation server url.
+ /// Override for REST API server url.
///
public Uri? ServerUrlOverride { get; set; }
///
- /// Flag indicating whether to ignore non-compliant errors or not.
- /// If set to true, the operation execution will not throw exceptions for non-compliant documents.
+ /// Flag indicating whether to ignore non-compliant errors of the OpenAPI document or not.
+ /// If set to true, the execution will not throw exceptions for non-compliant documents.
/// Please note that enabling this option may result in incomplete or inaccurate execution results.
///
public bool IgnoreNonCompliantErrors { get; set; }
@@ -40,8 +40,8 @@ public class OpenApiFunctionExecutionParameters
public string UserAgent { get; set; }
///
- /// Determines whether the operation payload is constructed dynamically based on operation payload metadata.
- /// If false, the operation payload must be provided via the 'payload' context variable.
+ /// Determines whether the REST API operation payload is constructed dynamically based on payload metadata.
+ /// If false, the payload must be provided via the 'payload' argument.
///
public bool EnableDynamicPayload { get; set; }
@@ -75,13 +75,13 @@ public class OpenApiFunctionExecutionParameters
///
/// The HttpClient to use for sending HTTP requests.
/// The callback for adding authentication data to HTTP requests.
- /// The override for the REST API operation server URL.
+ /// The override for the REST API server URL.
/// Optional user agent header value.
- /// A flag indicating whether to ignore non-compliant errors or not
- /// If set to true, the operation execution will not throw exceptions for non-compliant documents.
+ /// A flag indicating whether to ignore non-compliant errors of the OpenAPI document or not
+ /// If set to true, the execution will not throw exceptions for non-compliant documents.
/// Please note that enabling this option may result in incomplete or inaccurate execution results.
- /// Determines whether the operation payload is constructed dynamically based on operation payload metadata.
- /// If false, the operation payload must be provided via the 'payload' context variable.
+ /// Determines whether the REST API operation payload is constructed dynamically based on payload metadata.
+ /// If false, the REST API payload must be provided via the 'payload' argument.
/// Determines whether payload parameter names are augmented with namespaces.
/// Namespaces prevent naming conflicts by adding the parent parameter name as a prefix, separated by dots.
/// Optional list of operations not to import, e.g. in case they are not supported
diff --git a/dotnet/src/Functions/Functions.OpenApi/Extensions/RestApiOperationExtensions.cs b/dotnet/src/Functions/Functions.OpenApi/Extensions/RestApiOperationExtensions.cs
index 280300162db4..b16c37b372b1 100644
--- a/dotnet/src/Functions/Functions.OpenApi/Extensions/RestApiOperationExtensions.cs
+++ b/dotnet/src/Functions/Functions.OpenApi/Extensions/RestApiOperationExtensions.cs
@@ -25,12 +25,12 @@ internal static partial class RestApiOperationExtensions
/// the parameters 'sender.email' and 'receiver.mail' will be correctly resolved from arguments with the same names.
///
/// The list of parameters.
- public static IReadOnlyList GetParameters(
+ public static IReadOnlyList GetParameters(
this RestApiOperation operation,
bool addPayloadParamsFromMetadata = true,
bool enablePayloadNamespacing = false)
{
- var parameters = new List(operation.Parameters);
+ var parameters = new List(operation.Parameters);
// Add payload parameters
if (operation.Payload is not null)
@@ -55,7 +55,7 @@ public static IReadOnlyList GetParameters(
/// The default return parameter metadata, if any.
public static KernelReturnParameterMetadata? GetDefaultReturnParameter(this RestApiOperation operation, string[]? preferredResponses = null)
{
- RestApiOperationExpectedResponse? restOperationResponse = GetDefaultResponse(operation.Responses, preferredResponses ??= s_preferredResponses);
+ RestApiExpectedResponse? restOperationResponse = GetDefaultResponse(operation.Responses, preferredResponses ??= s_preferredResponses);
var returnParameter =
restOperationResponse is not null ? new KernelReturnParameterMetadata { Description = restOperationResponse.Description, Schema = restOperationResponse.Schema } : null;
@@ -64,12 +64,12 @@ public static IReadOnlyList GetParameters(
}
///
- /// Retrieves the default response for a given REST API operation.
+ /// Retrieves the default response.
///
- /// The REST API operation responses to parse.
+ /// Possible REST API responses.
/// The preferred response codes to use when selecting the default response.
/// The default response, if any.
- private static RestApiOperationExpectedResponse? GetDefaultResponse(IReadOnlyDictionary responses, string[] preferredResponses)
+ private static RestApiExpectedResponse? GetDefaultResponse(IReadOnlyDictionary responses, string[] preferredResponses)
{
foreach (var code in preferredResponses)
{
@@ -90,8 +90,8 @@ public static IReadOnlyList GetParameters(
/// Flag indicating whether to include parameters from metadata.
/// If false or not specified, the 'payload' and 'content-type' parameters are added instead.
/// Flag indicating whether to namespace payload parameter names.
- /// A list of representing the payload parameters.
- private static List GetPayloadParameters(RestApiOperation operation, bool useParametersFromMetadata, bool enableNamespacing)
+ /// A list of representing the payload parameters.
+ private static List GetPayloadParameters(RestApiOperation operation, bool useParametersFromMetadata, bool enableNamespacing)
{
if (useParametersFromMetadata)
{
@@ -122,15 +122,15 @@ private static List GetPayloadParameters(RestApiOpera
///
/// The REST API operation.
/// The 'content-type' artificial parameter.
- private static RestApiOperationParameter CreateContentTypeArtificialParameter(RestApiOperation operation)
+ private static RestApiParameter CreateContentTypeArtificialParameter(RestApiOperation operation)
{
- return new RestApiOperationParameter(
+ return new RestApiParameter(
RestApiOperation.ContentTypeArgumentName,
"string",
isRequired: false,
expand: false,
- RestApiOperationParameterLocation.Body,
- RestApiOperationParameterStyle.Simple,
+ RestApiParameterLocation.Body,
+ RestApiParameterStyle.Simple,
description: "Content type of REST API request body.");
}
@@ -139,31 +139,31 @@ private static RestApiOperationParameter CreateContentTypeArtificialParameter(Re
///
/// The REST API operation.
/// The 'payload' artificial parameter.
- private static RestApiOperationParameter CreatePayloadArtificialParameter(RestApiOperation operation)
+ private static RestApiParameter CreatePayloadArtificialParameter(RestApiOperation operation)
{
- return new RestApiOperationParameter(
+ return new RestApiParameter(
RestApiOperation.PayloadArgumentName,
operation.Payload?.MediaType == MediaTypeTextPlain ? "string" : "object",
isRequired: true,
expand: false,
- RestApiOperationParameterLocation.Body,
- RestApiOperationParameterStyle.Simple,
+ RestApiParameterLocation.Body,
+ RestApiParameterStyle.Simple,
description: operation.Payload?.Description ?? "REST API request body.",
schema: operation.Payload?.Schema);
}
///
- /// Retrieves parameters from REST API operation payload metadata.
+ /// Retrieves parameters from REST API payload metadata.
///
- /// The REST API operation payload properties.
+ /// The REST API payload properties.
/// Determines whether property names are augmented with namespaces.
/// Namespaces are created by prefixing property names with their root property names.
///
/// The root property name.
/// The list of payload parameters.
- private static List GetParametersFromPayloadMetadata(IReadOnlyList properties, bool enableNamespacing = false, string? rootPropertyName = null)
+ private static List GetParametersFromPayloadMetadata(IReadOnlyList properties, bool enableNamespacing = false, string? rootPropertyName = null)
{
- var parameters = new List();
+ var parameters = new List();
foreach (var property in properties)
{
@@ -171,13 +171,13 @@ private static List GetParametersFromPayloadMetadata(
if (!property.Properties.Any())
{
- parameters.Add(new RestApiOperationParameter(
+ parameters.Add(new RestApiParameter(
name: parameterName,
type: property.Type,
isRequired: property.IsRequired,
expand: false,
- location: RestApiOperationParameterLocation.Body,
- style: RestApiOperationParameterStyle.Simple,
+ location: RestApiParameterLocation.Body,
+ style: RestApiParameterStyle.Simple,
defaultValue: property.DefaultValue,
description: property.Description,
format: property.Format,
@@ -197,7 +197,7 @@ private static List GetParametersFromPayloadMetadata(
/// The root property name to be used for constructing the full property name.
/// Determines whether to add namespace to property name or not.
/// The property name.
- private static string GetPropertyName(RestApiOperationPayloadProperty property, string? rootPropertyName, bool enableNamespacing = false)
+ private static string GetPropertyName(RestApiPayloadProperty property, string? rootPropertyName, bool enableNamespacing = false)
{
if (enableNamespacing)
{
diff --git a/dotnet/src/Functions/Functions.OpenApi/HttpContentFactory.cs b/dotnet/src/Functions/Functions.OpenApi/HttpContentFactory.cs
index d7d270cdaea3..c3ebf9251e0a 100644
--- a/dotnet/src/Functions/Functions.OpenApi/HttpContentFactory.cs
+++ b/dotnet/src/Functions/Functions.OpenApi/HttpContentFactory.cs
@@ -11,4 +11,4 @@ namespace Microsoft.SemanticKernel.Plugins.OpenApi;
/// The operation payload metadata.
/// The operation arguments.
/// The object and HttpContent representing the operation payload.
-internal delegate (object? Payload, HttpContent Content) HttpContentFactory(RestApiOperationPayload? payload, IDictionary arguments);
+internal delegate (object? Payload, HttpContent Content) HttpContentFactory(RestApiPayload? payload, IDictionary arguments);
diff --git a/dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationExpectedResponse.cs b/dotnet/src/Functions/Functions.OpenApi/Model/RestApiExpectedResponse.cs
similarity index 76%
rename from dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationExpectedResponse.cs
rename to dotnet/src/Functions/Functions.OpenApi/Model/RestApiExpectedResponse.cs
index 176a78803cdf..e09a539573fb 100644
--- a/dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationExpectedResponse.cs
+++ b/dotnet/src/Functions/Functions.OpenApi/Model/RestApiExpectedResponse.cs
@@ -5,10 +5,10 @@
namespace Microsoft.SemanticKernel.Plugins.OpenApi;
///
-/// The REST API operation response.
+/// REST API response.
///
[Experimental("SKEXP0040")]
-public sealed class RestApiOperationExpectedResponse
+public sealed class RestApiExpectedResponse
{
///
/// Gets the description of the response.
@@ -26,12 +26,12 @@ public sealed class RestApiOperationExpectedResponse
public KernelJsonSchema? Schema { get; }
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The description of the response.
/// The media type of the response.
/// The schema against which the response body should be validated.
- internal RestApiOperationExpectedResponse(string description, string mediaType, KernelJsonSchema? schema = null)
+ internal RestApiExpectedResponse(string description, string mediaType, KernelJsonSchema? schema = null)
{
this.Description = description;
this.MediaType = mediaType;
diff --git a/dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperation.cs b/dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperation.cs
index f2257e1b932a..ba0ca0b46006 100644
--- a/dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperation.cs
+++ b/dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperation.cs
@@ -54,7 +54,7 @@ public sealed class RestApiOperation
///
/// The server.
///
- public IReadOnlyList Servers { get; }
+ public IReadOnlyList Servers { get; }
///
/// The security requirements.
@@ -64,17 +64,17 @@ public sealed class RestApiOperation
///
/// The operation parameters.
///
- public IReadOnlyList Parameters { get; }
+ public IReadOnlyList Parameters { get; }
///
/// The list of possible operation responses.
///
- public IReadOnlyDictionary Responses { get; }
+ public IReadOnlyDictionary Responses { get; }
///
/// The operation payload.
///
- public RestApiOperationPayload? Payload { get; }
+ public RestApiPayload? Payload { get; }
///
/// Additional unstructured metadata about the operation.
@@ -95,14 +95,14 @@ public sealed class RestApiOperation
/// The operation payload.
internal RestApiOperation(
string? id,
- IReadOnlyList servers,
+ IReadOnlyList servers,
string path,
HttpMethod method,
string? description,
- IReadOnlyList parameters,
- IReadOnlyDictionary responses,
+ IReadOnlyList parameters,
+ IReadOnlyDictionary responses,
IReadOnlyList securityRequirements,
- RestApiOperationPayload? payload = null)
+ RestApiPayload? payload = null)
{
this.Id = id;
this.Servers = servers;
@@ -113,6 +113,8 @@ internal RestApiOperation(
this.Responses = responses;
this.SecurityRequirements = securityRequirements;
this.Payload = payload;
+ this.Responses = responses ?? new Dictionary();
+ this.SecurityRequirements = securityRequirements;
}
///
@@ -140,7 +142,7 @@ internal IDictionary BuildHeaders(IDictionary a
{
var headers = new Dictionary();
- var parameters = this.Parameters.Where(p => p.Location == RestApiOperationParameterLocation.Header);
+ var parameters = this.Parameters.Where(p => p.Location == RestApiParameterLocation.Header);
foreach (var parameter in parameters)
{
@@ -156,7 +158,7 @@ internal IDictionary BuildHeaders(IDictionary a
continue;
}
- var parameterStyle = parameter.Style ?? RestApiOperationParameterStyle.Simple;
+ var parameterStyle = parameter.Style ?? RestApiParameterStyle.Simple;
if (!s_parameterSerializers.TryGetValue(parameterStyle, out var serializer))
{
@@ -181,7 +183,7 @@ internal string BuildQueryString(IDictionary arguments)
{
var segments = new List();
- var parameters = this.Parameters.Where(p => p.Location == RestApiOperationParameterLocation.Query);
+ var parameters = this.Parameters.Where(p => p.Location == RestApiParameterLocation.Query);
foreach (var parameter in parameters)
{
@@ -197,7 +199,7 @@ internal string BuildQueryString(IDictionary arguments)
continue;
}
- var parameterStyle = parameter.Style ?? RestApiOperationParameterStyle.Form;
+ var parameterStyle = parameter.Style ?? RestApiParameterStyle.Form;
if (!s_parameterSerializers.TryGetValue(parameterStyle, out var serializer))
{
@@ -223,7 +225,7 @@ internal string BuildQueryString(IDictionary arguments)
/// The path.
private string BuildPath(string pathTemplate, IDictionary arguments)
{
- var parameters = this.Parameters.Where(p => p.Location == RestApiOperationParameterLocation.Path);
+ var parameters = this.Parameters.Where(p => p.Location == RestApiParameterLocation.Path);
foreach (var parameter in parameters)
{
@@ -239,7 +241,7 @@ private string BuildPath(string pathTemplate, IDictionary argum
continue;
}
- var parameterStyle = parameter.Style ?? RestApiOperationParameterStyle.Simple;
+ var parameterStyle = parameter.Style ?? RestApiParameterStyle.Simple;
if (!s_parameterSerializers.TryGetValue(parameterStyle, out var serializer))
{
@@ -307,12 +309,12 @@ private Uri GetServerUrl(Uri? serverUrlOverride, Uri? apiHostUrl, IDictionary> s_parameterSerializers = new()
+ private static readonly Dictionary> s_parameterSerializers = new()
{
- { RestApiOperationParameterStyle.Simple, SimpleStyleParameterSerializer.Serialize },
- { RestApiOperationParameterStyle.Form, FormStyleParameterSerializer.Serialize },
- { RestApiOperationParameterStyle.SpaceDelimited, SpaceDelimitedStyleParameterSerializer.Serialize },
- { RestApiOperationParameterStyle.PipeDelimited, PipeDelimitedStyleParameterSerializer.Serialize }
+ { RestApiParameterStyle.Simple, SimpleStyleParameterSerializer.Serialize },
+ { RestApiParameterStyle.Form, FormStyleParameterSerializer.Serialize },
+ { RestApiParameterStyle.SpaceDelimited, SpaceDelimitedStyleParameterSerializer.Serialize },
+ { RestApiParameterStyle.PipeDelimited, PipeDelimitedStyleParameterSerializer.Serialize }
};
# endregion
diff --git a/dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationParameter.cs b/dotnet/src/Functions/Functions.OpenApi/Model/RestApiParameter.cs
similarity index 87%
rename from dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationParameter.cs
rename to dotnet/src/Functions/Functions.OpenApi/Model/RestApiParameter.cs
index 712948ad6ca9..d000f699f68c 100644
--- a/dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationParameter.cs
+++ b/dotnet/src/Functions/Functions.OpenApi/Model/RestApiParameter.cs
@@ -5,10 +5,10 @@
namespace Microsoft.SemanticKernel.Plugins.OpenApi;
///
-/// The REST API operation parameter.
+/// REST API parameter.
///
[Experimental("SKEXP0040")]
-public sealed class RestApiOperationParameter
+public sealed class RestApiParameter
{
///
/// The parameter name.
@@ -23,7 +23,7 @@ public sealed class RestApiOperationParameter
///
/// The parameter type - string, integer, number, boolean, array and object.
///
- public string Type { get; }
+ internal string Type { get; }
///
/// The parameter type modifier that refines the generic parameter type to a more specific one.
@@ -44,17 +44,17 @@ public sealed class RestApiOperationParameter
///
/// The parameter location.
///
- public RestApiOperationParameterLocation Location { get; }
+ public RestApiParameterLocation Location { get; }
///
/// The parameter style - defines how multiple values are delimited.
///
- public RestApiOperationParameterStyle? Style { get; }
+ public RestApiParameterStyle? Style { get; }
///
/// Type of array item for parameters of "array" type.
///
- public string? ArrayItemType { get; }
+ internal string? ArrayItemType { get; }
///
/// The default value.
@@ -72,7 +72,7 @@ public sealed class RestApiOperationParameter
public KernelJsonSchema? Schema { get; }
///
- /// Creates an instance of a class.
+ /// Creates an instance of a class.
///
/// The parameter name.
/// The parameter type.
@@ -86,13 +86,13 @@ public sealed class RestApiOperationParameter
/// The parameter type modifier that refines the generic parameter type to a more specific one.
/// More details can be found at https://swagger.io/docs/specification/data-models/data-types
/// The parameter schema.
- internal RestApiOperationParameter(
+ internal RestApiParameter(
string name,
string type,
bool isRequired,
bool expand,
- RestApiOperationParameterLocation location,
- RestApiOperationParameterStyle? style = null,
+ RestApiParameterLocation location,
+ RestApiParameterStyle? style = null,
string? arrayItemType = null,
object? defaultValue = null,
string? description = null,
diff --git a/dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationParameterLocation.cs b/dotnet/src/Functions/Functions.OpenApi/Model/RestApiParameterLocation.cs
similarity index 86%
rename from dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationParameterLocation.cs
rename to dotnet/src/Functions/Functions.OpenApi/Model/RestApiParameterLocation.cs
index 3785033961dd..f28aeb9e1a45 100644
--- a/dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationParameterLocation.cs
+++ b/dotnet/src/Functions/Functions.OpenApi/Model/RestApiParameterLocation.cs
@@ -5,10 +5,10 @@
namespace Microsoft.SemanticKernel.Plugins.OpenApi;
///
-/// The REST API operation parameter location.
+/// REST API parameter location.
///
[Experimental("SKEXP0040")]
-public enum RestApiOperationParameterLocation
+public enum RestApiParameterLocation
{
///
/// Query parameter.
diff --git a/dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationParameterStyle.cs b/dotnet/src/Functions/Functions.OpenApi/Model/RestApiParameterStyle.cs
similarity index 90%
rename from dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationParameterStyle.cs
rename to dotnet/src/Functions/Functions.OpenApi/Model/RestApiParameterStyle.cs
index 09171e8f3a73..7ba16905d718 100644
--- a/dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationParameterStyle.cs
+++ b/dotnet/src/Functions/Functions.OpenApi/Model/RestApiParameterStyle.cs
@@ -5,10 +5,10 @@
namespace Microsoft.SemanticKernel.Plugins.OpenApi;
///
-/// The REST API operation parameter style.
+/// REST API parameter style.
///
[Experimental("SKEXP0040")]
-public enum RestApiOperationParameterStyle
+public enum RestApiParameterStyle
{
///
/// Path-style parameters.
diff --git a/dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationPayload.cs b/dotnet/src/Functions/Functions.OpenApi/Model/RestApiPayload.cs
similarity index 72%
rename from dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationPayload.cs
rename to dotnet/src/Functions/Functions.OpenApi/Model/RestApiPayload.cs
index acfb1703f912..212877964865 100644
--- a/dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationPayload.cs
+++ b/dotnet/src/Functions/Functions.OpenApi/Model/RestApiPayload.cs
@@ -6,10 +6,10 @@
namespace Microsoft.SemanticKernel.Plugins.OpenApi;
///
-/// The REST API operation payload.
+/// REST API payload.
///
[Experimental("SKEXP0040")]
-public sealed class RestApiOperationPayload
+public sealed class RestApiPayload
{
///
/// The payload MediaType.
@@ -24,7 +24,7 @@ public sealed class RestApiOperationPayload
///
/// The payload properties.
///
- public IReadOnlyList Properties { get; }
+ public IReadOnlyList Properties { get; }
///
/// The schema of the parameter.
@@ -32,13 +32,13 @@ public sealed class RestApiOperationPayload
public KernelJsonSchema? Schema { get; }
///
- /// Creates an instance of a class.
+ /// Creates an instance of a class.
///
/// The media type.
/// The properties.
/// The description.
/// The JSON Schema.
- internal RestApiOperationPayload(string mediaType, IReadOnlyList properties, string? description = null, KernelJsonSchema? schema = null)
+ internal RestApiPayload(string mediaType, IReadOnlyList properties, string? description = null, KernelJsonSchema? schema = null)
{
this.MediaType = mediaType;
this.Properties = properties;
diff --git a/dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationPayloadProperty.cs b/dotnet/src/Functions/Functions.OpenApi/Model/RestApiPayloadProperty.cs
similarity index 84%
rename from dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationPayloadProperty.cs
rename to dotnet/src/Functions/Functions.OpenApi/Model/RestApiPayloadProperty.cs
index 4aade01a636b..5967aaa6d272 100644
--- a/dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationPayloadProperty.cs
+++ b/dotnet/src/Functions/Functions.OpenApi/Model/RestApiPayloadProperty.cs
@@ -6,10 +6,10 @@
namespace Microsoft.SemanticKernel.Plugins.OpenApi;
///
-/// The REST API operation payload property.
+/// REST API payload property.
///
[Experimental("SKEXP0040")]
-public sealed class RestApiOperationPayloadProperty
+public sealed class RestApiPayloadProperty
{
///
/// The property name.
@@ -19,7 +19,7 @@ public sealed class RestApiOperationPayloadProperty
///
/// The property type.
///
- public string Type { get; }
+ internal string Type { get; }
///
/// The property type modifier that refines the generic parameter type to a more specific one.
@@ -40,7 +40,7 @@ public sealed class RestApiOperationPayloadProperty
///
/// The properties.
///
- public IReadOnlyList Properties { get; }
+ public IReadOnlyList Properties { get; }
///
/// The schema of the parameter.
@@ -53,7 +53,7 @@ public sealed class RestApiOperationPayloadProperty
public object? DefaultValue { get; }
///
- /// Creates an instance of a class.
+ /// Creates an instance of a class.
///
/// The name of the property.
/// The type of the property.
@@ -64,12 +64,12 @@ public sealed class RestApiOperationPayloadProperty
/// More details can be found at https://swagger.io/docs/specification/data-models/data-types
/// The schema of the payload property.
/// The default value of the property.
- /// Returns a new instance of the class.
- internal RestApiOperationPayloadProperty(
+ /// Returns a new instance of the class.
+ internal RestApiPayloadProperty(
string name,
string type,
bool isRequired,
- IReadOnlyList properties,
+ IReadOnlyList properties,
string? description = null,
string? format = null,
KernelJsonSchema? schema = null,
diff --git a/dotnet/src/Functions/Functions.OpenApi/Model/RestApiSecurityScheme.cs b/dotnet/src/Functions/Functions.OpenApi/Model/RestApiSecurityScheme.cs
index 87d7dc458c73..70c785a17642 100644
--- a/dotnet/src/Functions/Functions.OpenApi/Model/RestApiSecurityScheme.cs
+++ b/dotnet/src/Functions/Functions.OpenApi/Model/RestApiSecurityScheme.cs
@@ -29,7 +29,7 @@ public sealed class RestApiSecurityScheme
///
/// REQUIRED. The location of the API key. Valid values are "query", "header" or "cookie".
///
- public RestApiOperationParameterLocation In { get; init; }
+ public RestApiParameterLocation In { get; init; }
///
/// REQUIRED. The name of the HTTP Authorization scheme to be used
diff --git a/dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationServer.cs b/dotnet/src/Functions/Functions.OpenApi/Model/RestApiServer.cs
similarity index 78%
rename from dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationServer.cs
rename to dotnet/src/Functions/Functions.OpenApi/Model/RestApiServer.cs
index 16bba0f0de27..7113ac24862e 100644
--- a/dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationServer.cs
+++ b/dotnet/src/Functions/Functions.OpenApi/Model/RestApiServer.cs
@@ -6,10 +6,10 @@
namespace Microsoft.SemanticKernel.Plugins.OpenApi;
///
-/// REST API Operation Server.
+/// REST API server.
///
[Experimental("SKEXP0040")]
-public sealed class RestApiOperationServer
+public sealed class RestApiServer
{
///
/// A URL to the target host. This URL supports Server Variables and MAY be relative,
@@ -23,18 +23,18 @@ public sealed class RestApiOperationServer
///
/// A map between a variable name and its value. The value is used for substitution in the server's URL template.
///
- public IDictionary Variables { get; }
+ public IDictionary Variables { get; }
///
- /// Construct a new object.
+ /// Construct a new object.
///
/// URL to the target host
/// Substitution variables for the server's URL template
#pragma warning disable CA1054 // URI-like parameters should not be strings
- internal RestApiOperationServer(string? url = null, IDictionary? variables = null)
+ internal RestApiServer(string? url = null, IDictionary? variables = null)
#pragma warning restore CA1054 // URI-like parameters should not be strings
{
this.Url = string.IsNullOrEmpty(url) ? null : url;
- this.Variables = variables ?? new Dictionary();
+ this.Variables = variables ?? new Dictionary();
}
}
diff --git a/dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationServerVariable.cs b/dotnet/src/Functions/Functions.OpenApi/Model/RestApiServerVariable.cs
similarity index 85%
rename from dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationServerVariable.cs
rename to dotnet/src/Functions/Functions.OpenApi/Model/RestApiServerVariable.cs
index fcbc7a1b1cef..79916f3ea3b8 100644
--- a/dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationServerVariable.cs
+++ b/dotnet/src/Functions/Functions.OpenApi/Model/RestApiServerVariable.cs
@@ -7,10 +7,10 @@
namespace Microsoft.SemanticKernel.Plugins.OpenApi;
///
-/// REST API Operation Server Variable.
+/// REST API server variable.
///
[Experimental("SKEXP0040")]
-public sealed class RestApiOperationServerVariable
+public sealed class RestApiServerVariable
{
///
/// An optional description for the server variable. CommonMark syntax MAY be used for rich text representation.
@@ -29,12 +29,12 @@ public sealed class RestApiOperationServerVariable
public IReadOnlyList? Enum { get; }
///
- /// Construct a new object.
+ /// Construct a new object.
///
/// The default value to use for substitution.
/// An optional description for the server variable.
/// An enumeration of string values to be used if the substitution options are from a limited set.
- internal RestApiOperationServerVariable(string defaultValue, string? description = null, List? enumValues = null)
+ internal RestApiServerVariable(string defaultValue, string? description = null, List? enumValues = null)
{
this.Default = defaultValue;
this.Description = description;
diff --git a/dotnet/src/Functions/Functions.OpenApi/Model/RestApiSpecification.cs b/dotnet/src/Functions/Functions.OpenApi/Model/RestApiSpecification.cs
index 870f47c662d9..b86661aa7512 100644
--- a/dotnet/src/Functions/Functions.OpenApi/Model/RestApiSpecification.cs
+++ b/dotnet/src/Functions/Functions.OpenApi/Model/RestApiSpecification.cs
@@ -5,7 +5,7 @@
namespace Microsoft.SemanticKernel.Plugins.OpenApi;
///
-/// The REST API specification.
+/// REST API specification.
///
internal sealed class RestApiSpecification
{
diff --git a/dotnet/src/Functions/Functions.OpenApi/OpenApi/OpenApiDocumentParser.cs b/dotnet/src/Functions/Functions.OpenApi/OpenApi/OpenApiDocumentParser.cs
index c0c3b3b206ee..0f0da229afa5 100644
--- a/dotnet/src/Functions/Functions.OpenApi/OpenApi/OpenApiDocumentParser.cs
+++ b/dotnet/src/Functions/Functions.OpenApi/OpenApi/OpenApiDocumentParser.cs
@@ -217,16 +217,16 @@ internal static List CreateRestApiOperations(OpenApiDocument d
}
///
- /// Build a list of objects from the given list of objects.
+ /// Build a list of objects from the given list of objects.
///
/// Represents servers which hosts the REST API.
- private static List CreateRestApiOperationServers(IList servers)
+ private static List CreateRestApiOperationServers(IList servers)
{
- var result = new List(servers.Count);
+ var result = new List(servers.Count);
foreach (var server in servers)
{
- var variables = server.Variables.ToDictionary(item => item.Key, item => new RestApiOperationServerVariable(item.Value.Default, item.Value.Description, item.Value.Enum));
+ var variables = server.Variables.ToDictionary(item => item.Key, item => new RestApiServerVariable(item.Value.Default, item.Value.Description, item.Value.Enum));
result.Add(new(server?.Url, variables));
}
@@ -263,7 +263,7 @@ private static RestApiSecurityScheme CreateRestApiSecurityScheme(OpenApiSecurity
SecuritySchemeType = securityScheme.Type.ToString(),
Description = securityScheme.Description,
Name = securityScheme.Name,
- In = (RestApiOperationParameterLocation)Enum.Parse(typeof(RestApiOperationParameterLocation), securityScheme.In.ToString()!),
+ In = (RestApiParameterLocation)Enum.Parse(typeof(RestApiParameterLocation), securityScheme.In.ToString()!),
Scheme = securityScheme.Scheme,
BearerFormat = securityScheme.BearerFormat,
Flows = CreateRestApiOAuthFlows(securityScheme.Flows),
@@ -304,7 +304,7 @@ private static RestApiSecurityScheme CreateRestApiSecurityScheme(OpenApiSecurity
///
/// Build a list of objects from the given objects.
///
- /// The REST API operation security
+ /// The REST API security.
internal static List CreateRestApiOperationSecurityRequirements(IList? security)
{
var operationRequirements = new List();
@@ -374,14 +374,14 @@ internal static List CreateRestApiOperationSecurityR
}
///
- /// Creates REST API operation parameters.
+ /// Creates REST API parameters.
///
/// The operation id.
/// The OpenAPI parameters.
/// The parameters.
- private static List CreateRestApiOperationParameters(string operationId, IList parameters)
+ private static List CreateRestApiOperationParameters(string operationId, IList parameters)
{
- var result = new List();
+ var result = new List();
foreach (var parameter in parameters)
{
@@ -395,13 +395,13 @@ private static List CreateRestApiOperationParameters(
throw new KernelException($"Parameter style of {parameter.Name} parameter of {operationId} operation is undefined.");
}
- var restParameter = new RestApiOperationParameter(
+ var restParameter = new RestApiParameter(
parameter.Name,
parameter.Schema.Type,
parameter.Required,
parameter.Explode,
- (RestApiOperationParameterLocation)Enum.Parse(typeof(RestApiOperationParameterLocation), parameter.In.ToString()!),
- (RestApiOperationParameterStyle)Enum.Parse(typeof(RestApiOperationParameterStyle), parameter.Style.ToString()!),
+ (RestApiParameterLocation)Enum.Parse(typeof(RestApiParameterLocation), parameter.In.ToString()!),
+ (RestApiParameterStyle)Enum.Parse(typeof(RestApiParameterStyle), parameter.Style.ToString()!),
parameter.Schema.Items?.Type,
GetParameterValue(parameter.Schema.Default, "parameter", parameter.Name),
parameter.Description,
@@ -416,12 +416,12 @@ private static List CreateRestApiOperationParameters(
}
///
- /// Creates REST API operation payload.
+ /// Creates REST API payload.
///
/// The operation id.
/// The OpenAPI request body.
- /// The REST API operation payload.
- private static RestApiOperationPayload? CreateRestApiOperationPayload(string operationId, OpenApiRequestBody requestBody)
+ /// The REST API payload.
+ private static RestApiPayload? CreateRestApiOperationPayload(string operationId, OpenApiRequestBody requestBody)
{
if (requestBody?.Content is null)
{
@@ -433,10 +433,10 @@ private static List CreateRestApiOperationParameters(
var payloadProperties = GetPayloadProperties(operationId, mediaTypeMetadata.Schema);
- return new RestApiOperationPayload(mediaType, payloadProperties, requestBody.Description, mediaTypeMetadata?.Schema?.ToJsonSchema());
+ return new RestApiPayload(mediaType, payloadProperties, requestBody.Description, mediaTypeMetadata?.Schema?.ToJsonSchema());
}
- private static IEnumerable<(string, RestApiOperationExpectedResponse)> CreateRestApiOperationExpectedResponses(OpenApiResponses responses)
+ private static IEnumerable<(string, RestApiExpectedResponse)> CreateRestApiOperationExpectedResponses(OpenApiResponses responses)
{
foreach (var response in responses)
{
@@ -446,19 +446,19 @@ private static List CreateRestApiOperationParameters(
var matchingSchema = response.Value.Content[mediaType].Schema;
var description = response.Value.Description ?? matchingSchema?.Description ?? string.Empty;
- yield return (response.Key, new RestApiOperationExpectedResponse(description, mediaType, matchingSchema?.ToJsonSchema()));
+ yield return (response.Key, new RestApiExpectedResponse(description, mediaType, matchingSchema?.ToJsonSchema()));
}
}
}
///
- /// Returns REST API operation payload properties.
+ /// Returns REST API payload properties.
///
/// The operation id.
/// An OpenAPI document schema representing request body properties.
/// Current level in OpenAPI schema.
- /// The REST API operation payload properties.
- private static List GetPayloadProperties(string operationId, OpenApiSchema? schema, int level = 0)
+ /// The REST API payload properties.
+ private static List GetPayloadProperties(string operationId, OpenApiSchema? schema, int level = 0)
{
if (schema is null)
{
@@ -470,7 +470,7 @@ private static List GetPayloadProperties(string
throw new KernelException($"Max level {PayloadPropertiesHierarchyMaxDepth} of traversing payload properties of {operationId} operation is exceeded.");
}
- var result = new List();
+ var result = new List();
foreach (var propertyPair in schema.Properties)
{
@@ -478,7 +478,7 @@ private static List GetPayloadProperties(string
var propertySchema = propertyPair.Value;
- var property = new RestApiOperationPayloadProperty(
+ var property = new RestApiPayloadProperty(
propertyName,
propertySchema.Type,
schema.Required.Contains(propertyName),
diff --git a/dotnet/src/Functions/Functions.OpenApi/OpenApiKernelPluginFactory.cs b/dotnet/src/Functions/Functions.OpenApi/OpenApiKernelPluginFactory.cs
index 113016c2f8a0..38d50fb6e450 100644
--- a/dotnet/src/Functions/Functions.OpenApi/OpenApiKernelPluginFactory.cs
+++ b/dotnet/src/Functions/Functions.OpenApi/OpenApiKernelPluginFactory.cs
@@ -196,7 +196,7 @@ internal static KernelFunction CreateRestApiFunction(
Uri? documentUri = null,
ILoggerFactory? loggerFactory = null)
{
- IReadOnlyList restOperationParameters = operation.GetParameters(
+ IReadOnlyList restOperationParameters = operation.GetParameters(
executionParameters?.EnableDynamicPayload ?? true,
executionParameters?.EnablePayloadNamespacing ?? false
);
@@ -385,9 +385,9 @@ private static string ConvertOperationIdToValidFunctionName(string operationId,
///
/// Converts the parameter type to a C# object.
///
- /// The REST API operation parameter.
+ /// The REST API parameter.
///
- private static Type? ConvertParameterDataType(RestApiOperationParameter parameter)
+ private static Type? ConvertParameterDataType(RestApiParameter parameter)
{
return parameter.Type switch
{
diff --git a/dotnet/src/Functions/Functions.OpenApi/RestApiOperationRunner.cs b/dotnet/src/Functions/Functions.OpenApi/RestApiOperationRunner.cs
index 6eee666b4e7f..95109a6f787e 100644
--- a/dotnet/src/Functions/Functions.OpenApi/RestApiOperationRunner.cs
+++ b/dotnet/src/Functions/Functions.OpenApi/RestApiOperationRunner.cs
@@ -343,7 +343,7 @@ private async Task ReadContentAndCreateOperationRespon
/// The payload meta-data.
/// The payload arguments.
/// The JSON payload the corresponding HttpContent.
- private (object? Payload, HttpContent Content) BuildJsonPayload(RestApiOperationPayload? payloadMetadata, IDictionary arguments)
+ private (object? Payload, HttpContent Content) BuildJsonPayload(RestApiPayload? payloadMetadata, IDictionary arguments)
{
// Build operation payload dynamically
if (this._enableDynamicPayload)
@@ -374,7 +374,7 @@ private async Task ReadContentAndCreateOperationRespon
/// The arguments.
/// The namespace to add to the property name.
/// The JSON object.
- private JsonObject BuildJsonObject(IReadOnlyList properties, IDictionary arguments, string? propertyNamespace = null)
+ private JsonObject BuildJsonObject(IReadOnlyList properties, IDictionary arguments, string? propertyNamespace = null)
{
var result = new JsonObject();
@@ -436,7 +436,7 @@ private JsonObject BuildJsonObject(IReadOnlyListThe payload meta-data.
/// The payload arguments.
/// The text payload and corresponding HttpContent.
- private (object? Payload, HttpContent Content) BuildPlainTextPayload(RestApiOperationPayload? payloadMetadata, IDictionary arguments)
+ private (object? Payload, HttpContent Content) BuildPlainTextPayload(RestApiPayload? payloadMetadata, IDictionary arguments)
{
if (!arguments.TryGetValue(RestApiOperation.PayloadArgumentName, out object? argument) || argument is not string payload)
{
diff --git a/dotnet/src/Functions/Functions.OpenApi/Serialization/FormStyleParameterSerializer.cs b/dotnet/src/Functions/Functions.OpenApi/Serialization/FormStyleParameterSerializer.cs
index 917f94750a29..da296260e60a 100644
--- a/dotnet/src/Functions/Functions.OpenApi/Serialization/FormStyleParameterSerializer.cs
+++ b/dotnet/src/Functions/Functions.OpenApi/Serialization/FormStyleParameterSerializer.cs
@@ -7,27 +7,27 @@
namespace Microsoft.SemanticKernel.Plugins.OpenApi;
///
-/// Serializes REST API operation parameter of the 'Form' style.
+/// Serializes REST API parameter of the 'Form' style.
///
internal static class FormStyleParameterSerializer
{
///
- /// Serializes a REST API operation `Form` style parameter.
+ /// Serializes a REST API `Form` style parameter.
///
- /// The REST API operation parameter to serialize.
+ /// The REST API parameter to serialize.
/// The parameter argument.
/// The serialized parameter.
- public static string Serialize(RestApiOperationParameter parameter, JsonNode argument)
+ public static string Serialize(RestApiParameter parameter, JsonNode argument)
{
const string ArrayType = "array";
Verify.NotNull(parameter);
Verify.NotNull(argument);
- var style = parameter.Style ?? RestApiOperationParameterStyle.Form;
- if (style != RestApiOperationParameterStyle.Form)
+ var style = parameter.Style ?? RestApiParameterStyle.Form;
+ if (style != RestApiParameterStyle.Form)
{
- throw new NotSupportedException($"Unsupported Rest API operation parameter style '{parameter.Style}' for parameter '{parameter.Name}'");
+ throw new NotSupportedException($"Unsupported Rest API parameter style '{parameter.Style}' for parameter '{parameter.Name}'");
}
// Handling parameters of array type.
@@ -49,10 +49,10 @@ public static string Serialize(RestApiOperationParameter parameter, JsonNode arg
///
/// Serializes an array-type parameter.
///
- /// The REST API operation parameter to serialize.
+ /// The REST API parameter to serialize.
/// The argument value.
/// The serialized parameter string.
- private static string SerializeArrayParameter(RestApiOperationParameter parameter, JsonNode argument)
+ private static string SerializeArrayParameter(RestApiParameter parameter, JsonNode argument)
{
if (argument is not JsonArray array)
{
diff --git a/dotnet/src/Functions/Functions.OpenApi/Serialization/PipeDelimitedStyleParameterSerializer.cs b/dotnet/src/Functions/Functions.OpenApi/Serialization/PipeDelimitedStyleParameterSerializer.cs
index 3ee0d9c7e79a..7a19dcf100c0 100644
--- a/dotnet/src/Functions/Functions.OpenApi/Serialization/PipeDelimitedStyleParameterSerializer.cs
+++ b/dotnet/src/Functions/Functions.OpenApi/Serialization/PipeDelimitedStyleParameterSerializer.cs
@@ -6,31 +6,31 @@
namespace Microsoft.SemanticKernel.Plugins.OpenApi;
///
-/// Serializes REST API operation parameter of the 'PipeDelimited' style.
+/// Serializes REST API parameter of the 'PipeDelimited' style.
///
internal static class PipeDelimitedStyleParameterSerializer
{
///
- /// Serializes a REST API operation `PipeDelimited` style parameter.
+ /// Serializes a REST API `PipeDelimited` style parameter.
///
- /// The REST API operation parameter to serialize.
+ /// The REST API parameter to serialize.
/// The parameter argument.
/// The serialized parameter.
- public static string Serialize(RestApiOperationParameter parameter, JsonNode argument)
+ public static string Serialize(RestApiParameter parameter, JsonNode argument)
{
const string ArrayType = "array";
Verify.NotNull(parameter);
Verify.NotNull(argument);
- if (parameter.Style != RestApiOperationParameterStyle.PipeDelimited)
+ if (parameter.Style != RestApiParameterStyle.PipeDelimited)
{
- throw new NotSupportedException($"Unsupported Rest API operation parameter style '{parameter.Style}' for parameter '{parameter.Name}'");
+ throw new NotSupportedException($"Unsupported Rest API parameter style '{parameter.Style}' for parameter '{parameter.Name}'");
}
if (parameter.Type != ArrayType)
{
- throw new NotSupportedException($"Unsupported Rest API operation parameter type '{parameter.Type}' for parameter '{parameter.Name}'");
+ throw new NotSupportedException($"Unsupported Rest API parameter type '{parameter.Type}' for parameter '{parameter.Name}'");
}
return SerializeArrayParameter(parameter, argument);
@@ -39,10 +39,10 @@ public static string Serialize(RestApiOperationParameter parameter, JsonNode arg
///
/// Serializes an array-type parameter.
///
- /// The REST API operation parameter to serialize.
+ /// The REST API parameter to serialize.
/// The argument value.
/// The serialized parameter string.
- private static string SerializeArrayParameter(RestApiOperationParameter parameter, JsonNode argument)
+ private static string SerializeArrayParameter(RestApiParameter parameter, JsonNode argument)
{
if (argument is not JsonArray array)
{
diff --git a/dotnet/src/Functions/Functions.OpenApi/Serialization/SimpleStyleParameterSerializer.cs b/dotnet/src/Functions/Functions.OpenApi/Serialization/SimpleStyleParameterSerializer.cs
index 9104ed9635dc..3a653c1b900e 100644
--- a/dotnet/src/Functions/Functions.OpenApi/Serialization/SimpleStyleParameterSerializer.cs
+++ b/dotnet/src/Functions/Functions.OpenApi/Serialization/SimpleStyleParameterSerializer.cs
@@ -6,27 +6,27 @@
namespace Microsoft.SemanticKernel.Plugins.OpenApi;
///
-/// Serializes REST API operation parameter of the 'Simple' style.
+/// Serializes REST API parameter of the 'Simple' style.
///
internal static class SimpleStyleParameterSerializer
{
///
- /// Serializes a REST API operation `Simple` style parameter.
+ /// Serializes a REST API `Simple` style parameter.
///
- /// The REST API operation parameter to serialize.
+ /// The REST API parameter to serialize.
/// The parameter argument.
/// The serialized parameter.
- public static string Serialize(RestApiOperationParameter parameter, JsonNode argument)
+ public static string Serialize(RestApiParameter parameter, JsonNode argument)
{
const string ArrayType = "array";
Verify.NotNull(parameter);
Verify.NotNull(argument);
- var style = parameter.Style ?? RestApiOperationParameterStyle.Simple;
- if (style != RestApiOperationParameterStyle.Simple)
+ var style = parameter.Style ?? RestApiParameterStyle.Simple;
+ if (style != RestApiParameterStyle.Simple)
{
- throw new NotSupportedException($"Unsupported Rest API operation parameter style '{parameter.Style}' for parameter '{parameter.Name}'");
+ throw new NotSupportedException($"Unsupported Rest API parameter style '{parameter.Style}' for parameter '{parameter.Name}'");
}
// Serializing parameters of array type.
@@ -48,10 +48,10 @@ public static string Serialize(RestApiOperationParameter parameter, JsonNode arg
///
/// Serializes an array-type parameter.
///
- /// The REST API operation parameter to serialize.
+ /// The REST API parameter to serialize.
/// The argument value.
/// The serialized parameter string.
- private static string SerializeArrayParameter(RestApiOperationParameter parameter, object argument)
+ private static string SerializeArrayParameter(RestApiParameter parameter, object argument)
{
if (argument is not JsonArray array)
{
diff --git a/dotnet/src/Functions/Functions.OpenApi/Serialization/SpaceDelimitedStyleParameterSerializer.cs b/dotnet/src/Functions/Functions.OpenApi/Serialization/SpaceDelimitedStyleParameterSerializer.cs
index f42911ab0536..ec7f5f16ec99 100644
--- a/dotnet/src/Functions/Functions.OpenApi/Serialization/SpaceDelimitedStyleParameterSerializer.cs
+++ b/dotnet/src/Functions/Functions.OpenApi/Serialization/SpaceDelimitedStyleParameterSerializer.cs
@@ -6,30 +6,30 @@
namespace Microsoft.SemanticKernel.Plugins.OpenApi;
///
-/// Serializes REST API operation parameter of the 'SpaceDelimited' style.
+/// Serializes REST API parameter of the 'SpaceDelimited' style.
///
internal static class SpaceDelimitedStyleParameterSerializer
{
///
- /// Serializes a REST API operation `SpaceDelimited` style parameter.
+ /// Serializes a REST API `SpaceDelimited` style parameter.
///
- /// The REST API operation parameter to serialize.
+ /// The REST API parameter to serialize.
/// The parameter argument.
/// The serialized parameter.
- public static string Serialize(RestApiOperationParameter parameter, JsonNode argument)
+ public static string Serialize(RestApiParameter parameter, JsonNode argument)
{
const string ArrayType = "array";
Verify.NotNull(parameter);
- if (parameter.Style != RestApiOperationParameterStyle.SpaceDelimited)
+ if (parameter.Style != RestApiParameterStyle.SpaceDelimited)
{
- throw new NotSupportedException($"Unsupported Rest API operation parameter style '{parameter.Style}' for parameter '{parameter.Name}'");
+ throw new NotSupportedException($"Unsupported Rest API parameter style '{parameter.Style}' for parameter '{parameter.Name}'");
}
if (parameter.Type != ArrayType)
{
- throw new NotSupportedException($"Unsupported Rest API operation parameter type '{parameter.Type}' for parameter '{parameter.Name}'");
+ throw new NotSupportedException($"Unsupported Rest API parameter type '{parameter.Type}' for parameter '{parameter.Name}'");
}
return SerializeArrayParameter(parameter, argument);
@@ -38,10 +38,10 @@ public static string Serialize(RestApiOperationParameter parameter, JsonNode arg
///
/// Serializes an array-type parameter.
///
- /// The REST API operation parameter to serialize.
+ /// The REST API parameter to serialize.
/// The argument value.
/// The serialized parameter string.
- private static string SerializeArrayParameter(RestApiOperationParameter parameter, JsonNode argument)
+ private static string SerializeArrayParameter(RestApiParameter parameter, JsonNode argument)
{
if (argument is not JsonArray array)
{
diff --git a/dotnet/src/Functions/Functions.UnitTests/OpenApi/Extensions/RestApiOperationExtensionsTests.cs b/dotnet/src/Functions/Functions.UnitTests/OpenApi/Extensions/RestApiOperationExtensionsTests.cs
index 4e59601167f5..e9ceb0ab6d94 100644
--- a/dotnet/src/Functions/Functions.UnitTests/OpenApi/Extensions/RestApiOperationExtensionsTests.cs
+++ b/dotnet/src/Functions/Functions.UnitTests/OpenApi/Extensions/RestApiOperationExtensionsTests.cs
@@ -231,10 +231,10 @@ public void ItShouldAddNamespaceToParametersDeclaredInPayloadMetadata(string met
public void ItShouldSetAlternativeNameToParametersForPutAndPostOperation(string method)
{
//Arrange
- var latitude = new RestApiOperationPayloadProperty("location.latitude", "number", false, []);
- var place = new RestApiOperationPayloadProperty("place", "string", true, []);
+ var latitude = new RestApiPayloadProperty("location.latitude", "number", false, []);
+ var place = new RestApiPayloadProperty("place", "string", true, []);
- var payload = new RestApiOperationPayload("application/json", [place, latitude]);
+ var payload = new RestApiPayload("application/json", [place, latitude]);
var operation = CreateTestOperation(method, payload);
@@ -253,7 +253,7 @@ public void ItShouldSetAlternativeNameToParametersForPutAndPostOperation(string
Assert.Equal("location_latitude", personNameProp.AlternativeName);
}
- private static RestApiOperation CreateTestOperation(string method, RestApiOperationPayload? payload = null, Uri? url = null)
+ private static RestApiOperation CreateTestOperation(string method, RestApiPayload? payload = null, Uri? url = null)
{
return new RestApiOperation(
id: "fake-id",
@@ -262,66 +262,66 @@ private static RestApiOperation CreateTestOperation(string method, RestApiOperat
method: new HttpMethod(method),
description: "fake-description",
parameters: [],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: [],
payload: payload);
}
- private static RestApiOperationPayload CreateTestJsonPayload()
+ private static RestApiPayload CreateTestJsonPayload()
{
- var name = new RestApiOperationPayloadProperty(
+ var name = new RestApiPayloadProperty(
name: "name",
type: "string",
isRequired: true,
properties: [],
description: "The name.");
- var leader = new RestApiOperationPayloadProperty(
+ var leader = new RestApiPayloadProperty(
name: "leader",
type: "string",
isRequired: true,
properties: [],
description: "The leader.");
- var landmarks = new RestApiOperationPayloadProperty(
+ var landmarks = new RestApiPayloadProperty(
name: "landmarks",
type: "array",
isRequired: false,
properties: [],
description: "The landmarks.");
- var location = new RestApiOperationPayloadProperty(
+ var location = new RestApiPayloadProperty(
name: "location",
type: "object",
isRequired: true,
properties: [landmarks],
description: "The location.");
- var rulingCouncil = new RestApiOperationPayloadProperty(
+ var rulingCouncil = new RestApiPayloadProperty(
name: "rulingCouncil",
type: "object",
isRequired: true,
properties: [leader],
description: "The ruling council.");
- var population = new RestApiOperationPayloadProperty(
+ var population = new RestApiPayloadProperty(
name: "population",
type: "integer",
isRequired: true,
properties: [],
description: "The population.");
- var hasMagicWards = new RestApiOperationPayloadProperty(
+ var hasMagicWards = new RestApiPayloadProperty(
name: "hasMagicWards",
type: "boolean",
isRequired: false,
properties: []);
- return new RestApiOperationPayload("application/json", [name, location, rulingCouncil, population, hasMagicWards]);
+ return new RestApiPayload("application/json", [name, location, rulingCouncil, population, hasMagicWards]);
}
- private static RestApiOperationPayload CreateTestTextPayload()
+ private static RestApiPayload CreateTestTextPayload()
{
- return new RestApiOperationPayload("text/plain", []);
+ return new RestApiPayload("text/plain", []);
}
}
diff --git a/dotnet/src/Functions/Functions.UnitTests/OpenApi/OpenApiDocumentParserV20Tests.cs b/dotnet/src/Functions/Functions.UnitTests/OpenApi/OpenApiDocumentParserV20Tests.cs
index 3337d0e39eb4..099ab02042f9 100644
--- a/dotnet/src/Functions/Functions.UnitTests/OpenApi/OpenApiDocumentParserV20Tests.cs
+++ b/dotnet/src/Functions/Functions.UnitTests/OpenApi/OpenApiDocumentParserV20Tests.cs
@@ -123,14 +123,14 @@ public async Task ItCanParsePutOperationMetadataSuccessfullyAsync()
var pathParameter = parameters.Single(p => p.Name == "secret-name"); //'secret-name' path parameter.
Assert.True(pathParameter.IsRequired);
- Assert.Equal(RestApiOperationParameterLocation.Path, pathParameter.Location);
+ Assert.Equal(RestApiParameterLocation.Path, pathParameter.Location);
Assert.Null(pathParameter.DefaultValue);
Assert.NotNull(pathParameter.Schema);
Assert.Equal("string", pathParameter.Schema.RootElement.GetProperty("type").GetString());
var apiVersionParameter = parameters.Single(p => p.Name == "api-version"); //'api-version' query string parameter.
Assert.True(apiVersionParameter.IsRequired);
- Assert.Equal(RestApiOperationParameterLocation.Query, apiVersionParameter.Location);
+ Assert.Equal(RestApiParameterLocation.Query, apiVersionParameter.Location);
Assert.Equal("7.0", apiVersionParameter.DefaultValue);
Assert.NotNull(apiVersionParameter.Schema);
Assert.Equal("string", apiVersionParameter.Schema.RootElement.GetProperty("type").GetString());
@@ -138,7 +138,7 @@ public async Task ItCanParsePutOperationMetadataSuccessfullyAsync()
var payloadParameter = parameters.Single(p => p.Name == "payload"); //'payload' artificial parameter.
Assert.True(payloadParameter.IsRequired);
- Assert.Equal(RestApiOperationParameterLocation.Body, payloadParameter.Location);
+ Assert.Equal(RestApiParameterLocation.Body, payloadParameter.Location);
Assert.Null(payloadParameter.DefaultValue);
Assert.Equal("REST API request body.", payloadParameter.Description);
Assert.NotNull(payloadParameter.Schema);
@@ -146,7 +146,7 @@ public async Task ItCanParsePutOperationMetadataSuccessfullyAsync()
var contentTypeParameter = parameters.Single(p => p.Name == "content-type"); //'content-type' artificial parameter.
Assert.False(contentTypeParameter.IsRequired);
- Assert.Equal(RestApiOperationParameterLocation.Body, contentTypeParameter.Location);
+ Assert.Equal(RestApiParameterLocation.Body, contentTypeParameter.Location);
Assert.Null(contentTypeParameter.DefaultValue);
Assert.Equal("Content type of REST API request body.", contentTypeParameter.Description);
Assert.Null(contentTypeParameter.Schema);
@@ -174,7 +174,7 @@ public async Task ItCanExtractSimpleTypeHeaderParameterMetadataSuccessfullyAsync
var restApi = await this._sut.ParseAsync(this._openApiDocument);
//Assert string header parameter metadata
- var accept = GetParameterMetadata(restApi.Operations, "SetSecret", RestApiOperationParameterLocation.Header, "Accept");
+ var accept = GetParameterMetadata(restApi.Operations, "SetSecret", RestApiParameterLocation.Header, "Accept");
Assert.Equal("string", accept.Type);
Assert.Equal("application/json", accept.DefaultValue);
@@ -182,7 +182,7 @@ public async Task ItCanExtractSimpleTypeHeaderParameterMetadataSuccessfullyAsync
Assert.False(accept.IsRequired);
//Assert integer header parameter metadata
- var apiVersion = GetParameterMetadata(restApi.Operations, "SetSecret", RestApiOperationParameterLocation.Header, "X-API-Version");
+ var apiVersion = GetParameterMetadata(restApi.Operations, "SetSecret", RestApiParameterLocation.Header, "X-API-Version");
Assert.Equal("integer", apiVersion.Type);
Assert.Equal(10, apiVersion.DefaultValue);
@@ -197,12 +197,12 @@ public async Task ItCanExtractCsvStyleHeaderParameterMetadataSuccessfullyAsync()
var restApi = await this._sut.ParseAsync(this._openApiDocument);
//Assert header parameters metadata
- var acceptParameter = GetParameterMetadata(restApi.Operations, "SetSecret", RestApiOperationParameterLocation.Header, "X-Operation-Csv-Ids");
+ var acceptParameter = GetParameterMetadata(restApi.Operations, "SetSecret", RestApiParameterLocation.Header, "X-Operation-Csv-Ids");
Assert.Null(acceptParameter.DefaultValue);
Assert.False(acceptParameter.IsRequired);
Assert.Equal("array", acceptParameter.Type);
- Assert.Equal(RestApiOperationParameterStyle.Simple, acceptParameter.Style);
+ Assert.Equal(RestApiParameterStyle.Simple, acceptParameter.Style);
Assert.Equal("The comma separated list of operation ids.", acceptParameter.Description);
Assert.Equal("string", acceptParameter.ArrayItemType);
}
@@ -218,7 +218,7 @@ public async Task ItCanExtractHeadersSuccessfullyAsync()
var operation = restApi.Operations.Single(o => o.Id == "SetSecret");
- var headerParameters = operation.Parameters.Where(p => p.Location == RestApiOperationParameterLocation.Header);
+ var headerParameters = operation.Parameters.Where(p => p.Location == RestApiParameterLocation.Header);
Assert.NotNull(headerParameters);
Assert.Equal(3, headerParameters.Count());
@@ -414,8 +414,8 @@ public async Task ItCanParsePropertiesOfObjectDataTypeAsync()
Assert.Null(property.Format);
}
- private static RestApiOperationParameter GetParameterMetadata(IList operations, string operationId,
- RestApiOperationParameterLocation location, string name)
+ private static RestApiParameter GetParameterMetadata(IList operations, string operationId,
+ RestApiParameterLocation location, string name)
{
Assert.True(operations.Any());
diff --git a/dotnet/src/Functions/Functions.UnitTests/OpenApi/OpenApiDocumentParserV30Tests.cs b/dotnet/src/Functions/Functions.UnitTests/OpenApi/OpenApiDocumentParserV30Tests.cs
index fe013906944a..1a98185b68ab 100644
--- a/dotnet/src/Functions/Functions.UnitTests/OpenApi/OpenApiDocumentParserV30Tests.cs
+++ b/dotnet/src/Functions/Functions.UnitTests/OpenApi/OpenApiDocumentParserV30Tests.cs
@@ -124,14 +124,14 @@ public async Task ItCanParsePutOperationMetadataSuccessfullyAsync()
var pathParameter = parameters.Single(p => p.Name == "secret-name"); //'secret-name' path parameter.
Assert.True(pathParameter.IsRequired);
- Assert.Equal(RestApiOperationParameterLocation.Path, pathParameter.Location);
+ Assert.Equal(RestApiParameterLocation.Path, pathParameter.Location);
Assert.Null(pathParameter.DefaultValue);
Assert.NotNull(pathParameter.Schema);
Assert.Equal("string", pathParameter.Schema.RootElement.GetProperty("type").GetString());
var apiVersionParameter = parameters.Single(p => p.Name == "api-version"); //'api-version' query string parameter.
Assert.True(apiVersionParameter.IsRequired);
- Assert.Equal(RestApiOperationParameterLocation.Query, apiVersionParameter.Location);
+ Assert.Equal(RestApiParameterLocation.Query, apiVersionParameter.Location);
Assert.Equal("7.0", apiVersionParameter.DefaultValue);
Assert.NotNull(apiVersionParameter.Schema);
Assert.Equal("string", apiVersionParameter.Schema.RootElement.GetProperty("type").GetString());
@@ -139,7 +139,7 @@ public async Task ItCanParsePutOperationMetadataSuccessfullyAsync()
var payloadParameter = parameters.Single(p => p.Name == "payload"); //'payload' artificial parameter.
Assert.True(payloadParameter.IsRequired);
- Assert.Equal(RestApiOperationParameterLocation.Body, payloadParameter.Location);
+ Assert.Equal(RestApiParameterLocation.Body, payloadParameter.Location);
Assert.Null(payloadParameter.DefaultValue);
Assert.Equal("REST API request body.", payloadParameter.Description);
Assert.NotNull(payloadParameter.Schema);
@@ -147,7 +147,7 @@ public async Task ItCanParsePutOperationMetadataSuccessfullyAsync()
var contentTypeParameter = parameters.Single(p => p.Name == "content-type"); //'content-type' artificial parameter.
Assert.False(contentTypeParameter.IsRequired);
- Assert.Equal(RestApiOperationParameterLocation.Body, contentTypeParameter.Location);
+ Assert.Equal(RestApiParameterLocation.Body, contentTypeParameter.Location);
Assert.Null(contentTypeParameter.DefaultValue);
Assert.Equal("Content type of REST API request body.", contentTypeParameter.Description);
Assert.Null(contentTypeParameter.Schema);
@@ -160,7 +160,7 @@ public async Task ItCanExtractSimpleTypeHeaderParameterMetadataSuccessfullyAsync
var restApi = await this._sut.ParseAsync(this._openApiDocument);
//Assert string header parameter metadata
- var accept = GetParameterMetadata(restApi.Operations, "SetSecret", RestApiOperationParameterLocation.Header, "Accept");
+ var accept = GetParameterMetadata(restApi.Operations, "SetSecret", RestApiParameterLocation.Header, "Accept");
Assert.Equal("string", accept.Type);
Assert.Equal("application/json", accept.DefaultValue);
@@ -168,7 +168,7 @@ public async Task ItCanExtractSimpleTypeHeaderParameterMetadataSuccessfullyAsync
Assert.False(accept.IsRequired);
//Assert integer header parameter metadata
- var apiVersion = GetParameterMetadata(restApi.Operations, "SetSecret", RestApiOperationParameterLocation.Header, "X-API-Version");
+ var apiVersion = GetParameterMetadata(restApi.Operations, "SetSecret", RestApiParameterLocation.Header, "X-API-Version");
Assert.Equal("integer", apiVersion.Type);
Assert.Equal(10, apiVersion.DefaultValue);
@@ -198,12 +198,12 @@ public async Task ItCanExtractCsvStyleHeaderParameterMetadataSuccessfullyAsync()
var restApi = await this._sut.ParseAsync(this._openApiDocument);
//Assert header parameters metadata
- var acceptParameter = GetParameterMetadata(restApi.Operations, "SetSecret", RestApiOperationParameterLocation.Header, "X-Operation-Csv-Ids");
+ var acceptParameter = GetParameterMetadata(restApi.Operations, "SetSecret", RestApiParameterLocation.Header, "X-Operation-Csv-Ids");
Assert.Null(acceptParameter.DefaultValue);
Assert.False(acceptParameter.IsRequired);
Assert.Equal("array", acceptParameter.Type);
- Assert.Equal(RestApiOperationParameterStyle.Simple, acceptParameter.Style);
+ Assert.Equal(RestApiParameterStyle.Simple, acceptParameter.Style);
Assert.Equal("The comma separated list of operation ids.", acceptParameter.Description);
Assert.Equal("string", acceptParameter.ArrayItemType);
}
@@ -219,7 +219,7 @@ public async Task ItCanExtractHeadersSuccessfullyAsync()
var operation = restApi.Operations.Single(o => o.Id == "SetSecret");
- var headerParameters = operation.Parameters.Where(p => p.Location == RestApiOperationParameterLocation.Header);
+ var headerParameters = operation.Parameters.Where(p => p.Location == RestApiParameterLocation.Header);
Assert.NotNull(headerParameters);
Assert.Equal(3, headerParameters.Count());
@@ -515,8 +515,8 @@ private static MemoryStream ModifyOpenApiDocument(Stream openApiDocument, Action
return stream;
}
- private static RestApiOperationParameter GetParameterMetadata(IList operations, string operationId,
- RestApiOperationParameterLocation location, string name)
+ private static RestApiParameter GetParameterMetadata(IList operations, string operationId,
+ RestApiParameterLocation location, string name)
{
Assert.True(operations.Any());
diff --git a/dotnet/src/Functions/Functions.UnitTests/OpenApi/OpenApiDocumentParserV31Tests.cs b/dotnet/src/Functions/Functions.UnitTests/OpenApi/OpenApiDocumentParserV31Tests.cs
index d43a8a1cbba7..79f3d8330694 100644
--- a/dotnet/src/Functions/Functions.UnitTests/OpenApi/OpenApiDocumentParserV31Tests.cs
+++ b/dotnet/src/Functions/Functions.UnitTests/OpenApi/OpenApiDocumentParserV31Tests.cs
@@ -124,14 +124,14 @@ public async Task ItCanParsePutOperationMetadataSuccessfullyAsync()
var pathParameter = parameters.Single(p => p.Name == "secret-name"); //'secret-name' path parameter.
Assert.True(pathParameter.IsRequired);
- Assert.Equal(RestApiOperationParameterLocation.Path, pathParameter.Location);
+ Assert.Equal(RestApiParameterLocation.Path, pathParameter.Location);
Assert.Null(pathParameter.DefaultValue);
Assert.NotNull(pathParameter.Schema);
Assert.Equal("string", pathParameter.Schema.RootElement.GetProperty("type").GetString());
var apiVersionParameter = parameters.Single(p => p.Name == "api-version"); //'api-version' query string parameter.
Assert.True(apiVersionParameter.IsRequired);
- Assert.Equal(RestApiOperationParameterLocation.Query, apiVersionParameter.Location);
+ Assert.Equal(RestApiParameterLocation.Query, apiVersionParameter.Location);
Assert.Equal("7.0", apiVersionParameter.DefaultValue);
Assert.NotNull(apiVersionParameter.Schema);
Assert.Equal("string", apiVersionParameter.Schema.RootElement.GetProperty("type").GetString());
@@ -139,7 +139,7 @@ public async Task ItCanParsePutOperationMetadataSuccessfullyAsync()
var payloadParameter = parameters.Single(p => p.Name == "payload"); //'payload' artificial parameter.
Assert.True(payloadParameter.IsRequired);
- Assert.Equal(RestApiOperationParameterLocation.Body, payloadParameter.Location);
+ Assert.Equal(RestApiParameterLocation.Body, payloadParameter.Location);
Assert.Null(payloadParameter.DefaultValue);
Assert.Equal("REST API request body.", payloadParameter.Description);
Assert.NotNull(payloadParameter.Schema);
@@ -147,7 +147,7 @@ public async Task ItCanParsePutOperationMetadataSuccessfullyAsync()
var contentTypeParameter = parameters.Single(p => p.Name == "content-type"); //'content-type' artificial parameter.
Assert.False(contentTypeParameter.IsRequired);
- Assert.Equal(RestApiOperationParameterLocation.Body, contentTypeParameter.Location);
+ Assert.Equal(RestApiParameterLocation.Body, contentTypeParameter.Location);
Assert.Null(contentTypeParameter.DefaultValue);
Assert.Equal("Content type of REST API request body.", contentTypeParameter.Description);
Assert.Null(contentTypeParameter.Schema);
@@ -175,7 +175,7 @@ public async Task ItCanExtractSimpleTypeHeaderParameterMetadataSuccessfullyAsync
var restApi = await this._sut.ParseAsync(this._openApiDocument);
//Assert string header parameter metadata
- var accept = GetParameterMetadata(restApi.Operations, "SetSecret", RestApiOperationParameterLocation.Header, "Accept");
+ var accept = GetParameterMetadata(restApi.Operations, "SetSecret", RestApiParameterLocation.Header, "Accept");
Assert.Equal("string", accept.Type);
Assert.Equal("application/json", accept.DefaultValue);
@@ -183,7 +183,7 @@ public async Task ItCanExtractSimpleTypeHeaderParameterMetadataSuccessfullyAsync
Assert.False(accept.IsRequired);
//Assert integer header parameter metadata
- var apiVersion = GetParameterMetadata(restApi.Operations, "SetSecret", RestApiOperationParameterLocation.Header, "X-API-Version");
+ var apiVersion = GetParameterMetadata(restApi.Operations, "SetSecret", RestApiParameterLocation.Header, "X-API-Version");
Assert.Equal("integer", apiVersion.Type);
Assert.Equal(10, apiVersion.DefaultValue);
@@ -198,12 +198,12 @@ public async Task ItCanExtractCsvStyleHeaderParameterMetadataSuccessfullyAsync()
var restApi = await this._sut.ParseAsync(this._openApiDocument);
//Assert header parameters metadata
- var acceptParameter = GetParameterMetadata(restApi.Operations, "SetSecret", RestApiOperationParameterLocation.Header, "X-Operation-Csv-Ids");
+ var acceptParameter = GetParameterMetadata(restApi.Operations, "SetSecret", RestApiParameterLocation.Header, "X-Operation-Csv-Ids");
Assert.Null(acceptParameter.DefaultValue);
Assert.False(acceptParameter.IsRequired);
Assert.Equal("array", acceptParameter.Type);
- Assert.Equal(RestApiOperationParameterStyle.Simple, acceptParameter.Style);
+ Assert.Equal(RestApiParameterStyle.Simple, acceptParameter.Style);
Assert.Equal("The comma separated list of operation ids.", acceptParameter.Description);
Assert.Equal("string", acceptParameter.ArrayItemType);
}
@@ -219,7 +219,7 @@ public async Task ItCanExtractHeadersSuccessfullyAsync()
var operation = restApi.Operations.Single(o => o.Id == "SetSecret");
- var headerParameters = operation.Parameters.Where(p => p.Location == RestApiOperationParameterLocation.Header);
+ var headerParameters = operation.Parameters.Where(p => p.Location == RestApiParameterLocation.Header);
Assert.NotNull(headerParameters);
Assert.Equal(3, headerParameters.Count());
@@ -497,7 +497,7 @@ private static MemoryStream ModifyOpenApiDocument(Stream openApiDocument, Action
return stream;
}
- private static RestApiOperationParameter GetParameterMetadata(IList operations, string operationId, RestApiOperationParameterLocation location, string name)
+ private static RestApiParameter GetParameterMetadata(IList operations, string operationId, RestApiParameterLocation location, string name)
{
Assert.True(operations.Any());
diff --git a/dotnet/src/Functions/Functions.UnitTests/OpenApi/RestApiOperationRunnerTests.cs b/dotnet/src/Functions/Functions.UnitTests/OpenApi/RestApiOperationRunnerTests.cs
index 40bffc580478..b319b419481e 100644
--- a/dotnet/src/Functions/Functions.UnitTests/OpenApi/RestApiOperationRunnerTests.cs
+++ b/dotnet/src/Functions/Functions.UnitTests/OpenApi/RestApiOperationRunnerTests.cs
@@ -66,12 +66,12 @@ public async Task ItCanRunCreateAndUpdateOperationsWithJsonPayloadSuccessfullyAs
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: httpMethod,
description: "fake-description",
parameters: [],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: []
);
@@ -145,12 +145,12 @@ public async Task ItCanRunCreateAndUpdateOperationsWithPlainTextPayloadSuccessfu
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: httpMethod,
description: "fake-description",
parameters: [],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: []
);
@@ -194,30 +194,30 @@ public async Task ItCanRunCreateAndUpdateOperationsWithPlainTextPayloadSuccessfu
public async Task ItShouldAddHeadersToHttpRequestAsync()
{
// Arrange
- var parameters = new List
+ var parameters = new List
{
- new(name: "X-HS-1", type: "string", isRequired: true, expand: false, location: RestApiOperationParameterLocation.Header, style: RestApiOperationParameterStyle.Simple),
- new(name: "X-HA-1", type: "array", isRequired: true, expand: false, location: RestApiOperationParameterLocation.Header, style: RestApiOperationParameterStyle.Simple),
- new(name: "X-HA-2", type: "array", isRequired: true, expand: false, location: RestApiOperationParameterLocation.Header, style: RestApiOperationParameterStyle.Simple),
- new(name: "X-HB-1", type: "boolean", isRequired: true, expand: false, location: RestApiOperationParameterLocation.Header, style: RestApiOperationParameterStyle.Simple),
- new(name: "X-HB-2", type: "boolean", isRequired: true, expand: false, location: RestApiOperationParameterLocation.Header, style: RestApiOperationParameterStyle.Simple),
- new(name: "X-HI-1", type: "integer", isRequired: true, expand: false, location: RestApiOperationParameterLocation.Header, style: RestApiOperationParameterStyle.Simple),
- new(name: "X-HI-2", type: "integer", isRequired: true, expand: false, location: RestApiOperationParameterLocation.Header, style: RestApiOperationParameterStyle.Simple),
- new(name: "X-HN-1", type: "number", isRequired: true, expand: false, location: RestApiOperationParameterLocation.Header, style: RestApiOperationParameterStyle.Simple),
- new(name: "X-HN-2", type: "number", isRequired: true, expand: false, location: RestApiOperationParameterLocation.Header, style: RestApiOperationParameterStyle.Simple),
- new(name: "X-HD-1", type: "string", isRequired: true, expand: false, location: RestApiOperationParameterLocation.Header, style: RestApiOperationParameterStyle.Simple),
- new(name: "X-HD-2", type: "string", isRequired: true, expand: false, location: RestApiOperationParameterLocation.Header, style: RestApiOperationParameterStyle.Simple),
- new(name: "X-HD-3", type: "string", isRequired: true, expand: false, location: RestApiOperationParameterLocation.Header, style: RestApiOperationParameterStyle.Simple),
+ new(name: "X-HS-1", type: "string", isRequired: true, expand: false, location: RestApiParameterLocation.Header, style: RestApiParameterStyle.Simple),
+ new(name: "X-HA-1", type: "array", isRequired: true, expand: false, location: RestApiParameterLocation.Header, style: RestApiParameterStyle.Simple),
+ new(name: "X-HA-2", type: "array", isRequired: true, expand: false, location: RestApiParameterLocation.Header, style: RestApiParameterStyle.Simple),
+ new(name: "X-HB-1", type: "boolean", isRequired: true, expand: false, location: RestApiParameterLocation.Header, style: RestApiParameterStyle.Simple),
+ new(name: "X-HB-2", type: "boolean", isRequired: true, expand: false, location: RestApiParameterLocation.Header, style: RestApiParameterStyle.Simple),
+ new(name: "X-HI-1", type: "integer", isRequired: true, expand: false, location: RestApiParameterLocation.Header, style: RestApiParameterStyle.Simple),
+ new(name: "X-HI-2", type: "integer", isRequired: true, expand: false, location: RestApiParameterLocation.Header, style: RestApiParameterStyle.Simple),
+ new(name: "X-HN-1", type: "number", isRequired: true, expand: false, location: RestApiParameterLocation.Header, style: RestApiParameterStyle.Simple),
+ new(name: "X-HN-2", type: "number", isRequired: true, expand: false, location: RestApiParameterLocation.Header, style: RestApiParameterStyle.Simple),
+ new(name: "X-HD-1", type: "string", isRequired: true, expand: false, location: RestApiParameterLocation.Header, style: RestApiParameterStyle.Simple),
+ new(name: "X-HD-2", type: "string", isRequired: true, expand: false, location: RestApiParameterLocation.Header, style: RestApiParameterStyle.Simple),
+ new(name: "X-HD-3", type: "string", isRequired: true, expand: false, location: RestApiParameterLocation.Header, style: RestApiParameterStyle.Simple),
};
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Get,
description: "fake-description",
parameters: parameters,
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: []
);
@@ -266,25 +266,25 @@ public async Task ItShouldAddHeadersToHttpRequestAsync()
public async Task ItShouldAddUserAgentHeaderToHttpRequestIfConfiguredAsync()
{
// Arrange
- var parameters = new List
+ var parameters = new List
{
new(
name: "fake-header",
type: "string",
isRequired: true,
expand: false,
- location: RestApiOperationParameterLocation.Header,
- style: RestApiOperationParameterStyle.Simple)
+ location: RestApiParameterLocation.Header,
+ style: RestApiParameterStyle.Simple)
};
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Get,
description: "fake-description",
parameters: parameters,
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: []
);
@@ -313,7 +313,7 @@ public async Task ItShouldBuildJsonPayloadDynamicallyAsync()
// Arrange
this._httpMessageHandlerStub.ResponseToReturn.Content = new StringContent("fake-content", Encoding.UTF8, MediaTypeNames.Application.Json);
- List payloadProperties =
+ List payloadProperties =
[
new("name", "string", true, []),
new("attributes", "object", false,
@@ -322,16 +322,16 @@ public async Task ItShouldBuildJsonPayloadDynamicallyAsync()
])
];
- var payload = new RestApiOperationPayload(MediaTypeNames.Application.Json, payloadProperties);
+ var payload = new RestApiPayload(MediaTypeNames.Application.Json, payloadProperties);
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Post,
description: "fake-description",
parameters: [],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: [],
payload: payload
);
@@ -375,7 +375,7 @@ public async Task ItShouldBuildJsonPayloadDynamicallyUsingPayloadMetadataDataTyp
// Arrange
this._httpMessageHandlerStub.ResponseToReturn.Content = new StringContent("fake-content", Encoding.UTF8, MediaTypeNames.Application.Json);
- List payloadProperties =
+ List payloadProperties =
[
new("name", "string", true, []),
new("attributes", "object", false,
@@ -388,16 +388,16 @@ public async Task ItShouldBuildJsonPayloadDynamicallyUsingPayloadMetadataDataTyp
])
];
- var payload = new RestApiOperationPayload(MediaTypeNames.Application.Json, payloadProperties);
+ var payload = new RestApiPayload(MediaTypeNames.Application.Json, payloadProperties);
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Post,
description: "fake-description",
parameters: [],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: [],
payload: payload
);
@@ -462,7 +462,7 @@ public async Task ItShouldBuildJsonPayloadDynamicallyResolvingArgumentsByFullNam
// Arrange
this._httpMessageHandlerStub.ResponseToReturn.Content = new StringContent("fake-content", Encoding.UTF8, MediaTypeNames.Application.Json);
- List payloadProperties =
+ List payloadProperties =
[
new("upn", "string", true, []),
new("receiver", "object", false,
@@ -479,16 +479,16 @@ public async Task ItShouldBuildJsonPayloadDynamicallyResolvingArgumentsByFullNam
])
];
- var payload = new RestApiOperationPayload(MediaTypeNames.Application.Json, payloadProperties);
+ var payload = new RestApiPayload(MediaTypeNames.Application.Json, payloadProperties);
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Post,
description: "fake-description",
parameters: [],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: [],
payload: payload
);
@@ -555,12 +555,12 @@ public async Task ItShouldThrowExceptionIfPayloadMetadataDoesNotHaveContentTypeA
// Arrange
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Post,
description: "fake-description",
parameters: [],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: [],
payload: null
);
@@ -584,12 +584,12 @@ public async Task ItShouldThrowExceptionIfContentTypeArgumentIsNotProvidedAsync(
// Arrange
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Post,
description: "fake-description",
parameters: [],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: [],
payload: null
);
@@ -613,16 +613,16 @@ public async Task ItShouldUsePayloadArgumentForPlainTextContentTypeWhenBuildingP
// Arrange
this._httpMessageHandlerStub.ResponseToReturn.Content = new StringContent("fake-content", Encoding.UTF8, MediaTypeNames.Text.Plain);
- var payload = new RestApiOperationPayload(MediaTypeNames.Text.Plain, []);
+ var payload = new RestApiPayload(MediaTypeNames.Text.Plain, []);
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Post,
description: "fake-description",
parameters: [],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: [],
payload: payload
);
@@ -659,12 +659,12 @@ public async Task ItShouldUsePayloadAndContentTypeArgumentsIfDynamicPayloadBuild
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Post,
description: "fake-description",
parameters: [],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: [],
payload: null
);
@@ -698,21 +698,21 @@ public async Task ItShouldBuildJsonPayloadDynamicallyExcludingOptionalParameters
// Arrange
this._httpMessageHandlerStub.ResponseToReturn.Content = new StringContent("fake-content", Encoding.UTF8, MediaTypeNames.Application.Json);
- List payloadProperties =
+ List payloadProperties =
[
new("upn", "string", false, []),
];
- var payload = new RestApiOperationPayload(MediaTypeNames.Application.Json, payloadProperties);
+ var payload = new RestApiPayload(MediaTypeNames.Application.Json, payloadProperties);
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Post,
description: "fake-description",
parameters: [],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: [],
payload: payload
);
@@ -746,21 +746,21 @@ public async Task ItShouldBuildJsonPayloadDynamicallyIncludingOptionalParameters
// Arrange
this._httpMessageHandlerStub.ResponseToReturn.Content = new StringContent("fake-content", Encoding.UTF8, MediaTypeNames.Application.Json);
- List payloadProperties =
+ List payloadProperties =
[
new("upn", "string", false, []),
];
- var payload = new RestApiOperationPayload(MediaTypeNames.Application.Json, payloadProperties);
+ var payload = new RestApiPayload(MediaTypeNames.Application.Json, payloadProperties);
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Post,
description: "fake-description",
parameters: [],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: [],
payload: payload
);
@@ -794,30 +794,30 @@ public async Task ItShouldAddRequiredQueryStringParametersIfTheirArgumentsProvid
// Arrange
this._httpMessageHandlerStub.ResponseToReturn.Content = new StringContent("fake-content", Encoding.UTF8, MediaTypeNames.Application.Json);
- var firstParameter = new RestApiOperationParameter(
+ var firstParameter = new RestApiParameter(
"p1",
"string",
isRequired: true, //Marking the parameter as required
false,
- RestApiOperationParameterLocation.Query,
- RestApiOperationParameterStyle.Form);
+ RestApiParameterLocation.Query,
+ RestApiParameterStyle.Form);
- var secondParameter = new RestApiOperationParameter(
+ var secondParameter = new RestApiParameter(
"p2",
"integer",
isRequired: true, //Marking the parameter as required
false,
- RestApiOperationParameterLocation.Query,
- RestApiOperationParameterStyle.Form);
+ RestApiParameterLocation.Query,
+ RestApiParameterStyle.Form);
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Get,
description: "fake-description",
parameters: [firstParameter, secondParameter],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: []
);
@@ -843,30 +843,30 @@ public async Task ItShouldAddNotRequiredQueryStringParametersIfTheirArgumentsPro
// Arrange
this._httpMessageHandlerStub.ResponseToReturn.Content = new StringContent("fake-content", Encoding.UTF8, MediaTypeNames.Application.Json);
- var firstParameter = new RestApiOperationParameter(
+ var firstParameter = new RestApiParameter(
"p1",
"string",
isRequired: false, //Marking the parameter as not required
false,
- RestApiOperationParameterLocation.Query,
- RestApiOperationParameterStyle.Form);
+ RestApiParameterLocation.Query,
+ RestApiParameterStyle.Form);
- var secondParameter = new RestApiOperationParameter(
+ var secondParameter = new RestApiParameter(
"p2",
"string",
isRequired: false, //Marking the parameter as not required
false,
- RestApiOperationParameterLocation.Query,
- RestApiOperationParameterStyle.Form);
+ RestApiParameterLocation.Query,
+ RestApiParameterStyle.Form);
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Get,
description: "fake-description",
parameters: [firstParameter, secondParameter],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: []
);
@@ -892,30 +892,30 @@ public async Task ItShouldSkipNotRequiredQueryStringParametersIfNoArgumentsProvi
// Arrange
this._httpMessageHandlerStub.ResponseToReturn.Content = new StringContent("fake-content", Encoding.UTF8, MediaTypeNames.Application.Json);
- var firstParameter = new RestApiOperationParameter(
+ var firstParameter = new RestApiParameter(
"p1",
"string",
isRequired: false, //Marking the parameter as not required
false,
- RestApiOperationParameterLocation.Query,
- RestApiOperationParameterStyle.Form);
+ RestApiParameterLocation.Query,
+ RestApiParameterStyle.Form);
- var secondParameter = new RestApiOperationParameter(
+ var secondParameter = new RestApiParameter(
"p2",
"string",
isRequired: true, //Marking the parameter as required
false,
- RestApiOperationParameterLocation.Query,
- RestApiOperationParameterStyle.Form);
+ RestApiParameterLocation.Query,
+ RestApiParameterStyle.Form);
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Get,
description: "fake-description",
parameters: [firstParameter, secondParameter],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: []
);
@@ -940,22 +940,22 @@ public async Task ItShouldThrowExceptionIfNoArgumentProvidedForRequiredQueryStri
// Arrange
this._httpMessageHandlerStub.ResponseToReturn.Content = new StringContent("fake-content", Encoding.UTF8, MediaTypeNames.Application.Json);
- var parameter = new RestApiOperationParameter(
+ var parameter = new RestApiParameter(
"p1",
"string",
isRequired: true, //Marking the parameter as required
false,
- RestApiOperationParameterLocation.Query,
- RestApiOperationParameterStyle.Form);
+ RestApiParameterLocation.Query,
+ RestApiParameterStyle.Form);
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Get,
description: "fake-description",
parameters: [parameter],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: []
);
@@ -982,12 +982,12 @@ public async Task ItShouldReadContentAsStringSuccessfullyAsync(string contentTyp
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Post,
description: "fake-description",
parameters: [],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: []
);
@@ -1025,12 +1025,12 @@ public async Task ItShouldReadContentAsBytesSuccessfullyAsync(string contentType
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Post,
description: "fake-description",
parameters: [],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: []
);
@@ -1061,12 +1061,12 @@ public async Task ItShouldThrowExceptionForUnsupportedContentTypeAsync()
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Post,
description: "fake-description",
parameters: [],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: []
);
@@ -1092,7 +1092,7 @@ public async Task ItShouldReturnRequestUriAndContentAsync()
// Arrange
this._httpMessageHandlerStub.ResponseToReturn.Content = new StringContent("fake-content", Encoding.UTF8, MediaTypeNames.Application.Json);
- List payloadProperties =
+ List payloadProperties =
[
new("name", "string", true, []),
new("attributes", "object", false,
@@ -1101,16 +1101,16 @@ public async Task ItShouldReturnRequestUriAndContentAsync()
])
];
- var payload = new RestApiOperationPayload(MediaTypeNames.Application.Json, payloadProperties);
+ var payload = new RestApiPayload(MediaTypeNames.Application.Json, payloadProperties);
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Post,
description: "fake-description",
parameters: [],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: [],
payload: payload
);
@@ -1142,7 +1142,7 @@ public async Task ItShouldHandleNoContentAsync()
// Arrange
this._httpMessageHandlerStub!.ResponseToReturn = new HttpResponseMessage(System.Net.HttpStatusCode.NoContent);
- List payloadProperties =
+ List payloadProperties =
[
new("name", "string", true, []),
new("attributes", "object", false,
@@ -1151,16 +1151,16 @@ public async Task ItShouldHandleNoContentAsync()
])
];
- var payload = new RestApiOperationPayload(MediaTypeNames.Application.Json, payloadProperties);
+ var payload = new RestApiPayload(MediaTypeNames.Application.Json, payloadProperties);
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Post,
description: "fake-description",
parameters: [],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: [],
payload: payload
);
@@ -1192,7 +1192,7 @@ public async Task ItShouldSetHttpRequestMessageOptionsAsync()
// Arrange
this._httpMessageHandlerStub.ResponseToReturn.Content = new StringContent("fake-content", Encoding.UTF8, MediaTypeNames.Application.Json);
- List payloadProperties =
+ List payloadProperties =
[
new("name", "string", true, []),
new("attributes", "object", false,
@@ -1201,16 +1201,16 @@ public async Task ItShouldSetHttpRequestMessageOptionsAsync()
])
];
- var payload = new RestApiOperationPayload(MediaTypeNames.Application.Json, payloadProperties);
+ var payload = new RestApiPayload(MediaTypeNames.Application.Json, payloadProperties);
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Post,
description: "fake-description",
parameters: [],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: [],
payload: payload
);
@@ -1251,12 +1251,12 @@ public async Task ItShouldIncludeRequestDataWhenOperationCanceledExceptionIsThro
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Post,
description: "fake-description",
parameters: [],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: []
);
@@ -1282,12 +1282,12 @@ public async Task ItShouldUseCustomHttpResponseContentReaderAsync()
// Arrange
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Get,
description: "fake-description",
parameters: [],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: []
);
@@ -1317,12 +1317,12 @@ public async Task ItShouldUseDefaultHttpResponseContentReaderIfCustomDoesNotRetu
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Get,
description: "fake-description",
parameters: [],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: []
);
@@ -1350,12 +1350,12 @@ public async Task ItShouldDisposeContentStreamAndHttpResponseContentMessageAsync
// Arrange
var operation = new RestApiOperation(
id: "fake-id",
- servers: [new RestApiOperationServer("https://fake-random-test-host")],
+ servers: [new RestApiServer("https://fake-random-test-host")],
path: "fake-path",
method: HttpMethod.Get,
description: "fake-description",
parameters: [],
- responses: new Dictionary(),
+ responses: new Dictionary(),
securityRequirements: []
);
@@ -1393,38 +1393,38 @@ public IEnumerator