private static string PropertyValueGenerator( OpenApiParameter parameter, IDictionary <string, OpenApiSchema> componentsSchemas, bool useForBadRequest, string?customValue) { // Match on OpenApiSchemaExtensions->GetDataType return(parameter.Schema.GetDataType() switch { "double" => ValueTypeTestPropertiesHelper.Number(parameter.Name, parameter.Schema, useForBadRequest), "long" => ValueTypeTestPropertiesHelper.Number(parameter.Name, parameter.Schema, useForBadRequest), "int" => ValueTypeTestPropertiesHelper.Number(parameter.Name, parameter.Schema, useForBadRequest), "bool" => ValueTypeTestPropertiesHelper.CreateValueBool(useForBadRequest), "string" => ValueTypeTestPropertiesHelper.CreateValueString(parameter.Name, parameter.Schema, parameter.In, useForBadRequest, 0, customValue), "DateTimeOffset" => ValueTypeTestPropertiesHelper.CreateValueDateTimeOffset(useForBadRequest), "Guid" => ValueTypeTestPropertiesHelper.CreateValueGuid(useForBadRequest), "Uri" => ValueTypeTestPropertiesHelper.CreateValueUri(useForBadRequest), "Email" => ValueTypeTestPropertiesHelper.CreateValueEmail(useForBadRequest), "Array" when parameter.In == ParameterLocation.Query => ValueTypeTestPropertiesHelper.CreateValueArray(parameter.Name, parameter.Schema.Items, parameter.In, useForBadRequest, 3), _ => PropertyValueGeneratorTypeResolver(parameter, componentsSchemas, useForBadRequest) });
public static string PropertyValueGenerator( KeyValuePair <string, OpenApiSchema> schema, IDictionary <string, OpenApiSchema> componentsSchemas, bool useForBadRequest, int itemNumber, string?customValue) { var name = schema.Key.EnsureFirstCharacterToUpper(); // Match on OpenApiSchemaExtensions->GetDataType return(schema.Value.GetDataType() switch { "double" => ValueTypeTestPropertiesHelper.Number(name, schema.Value, useForBadRequest), "long" => ValueTypeTestPropertiesHelper.Number(name, schema.Value, useForBadRequest), "int" => ValueTypeTestPropertiesHelper.Number(name, schema.Value, useForBadRequest), "bool" => ValueTypeTestPropertiesHelper.CreateValueBool(useForBadRequest), "string" => ValueTypeTestPropertiesHelper.CreateValueString(name, schema.Value, null, useForBadRequest, itemNumber, customValue), "DateTimeOffset" => ValueTypeTestPropertiesHelper.CreateValueDateTimeOffset(useForBadRequest), "Guid" => ValueTypeTestPropertiesHelper.CreateValueGuid(useForBadRequest, itemNumber), "Uri" => ValueTypeTestPropertiesHelper.CreateValueUri(useForBadRequest), "Email" => ValueTypeTestPropertiesHelper.CreateValueEmail(useForBadRequest), _ => PropertyValueGeneratorTypeResolver(schema, componentsSchemas, useForBadRequest) });