From 163c0609424f506db5bbd30c196b32eabc235e87 Mon Sep 17 00:00:00 2001 From: Admir Trakic Date: Sat, 8 Jun 2024 15:23:57 +0200 Subject: [PATCH] set useCollection to defaults --- .pre-commit-config.yaml | 2 +- Echo.OpenAPI.sln | 10 +++++----- Makefile | 5 ++++- config.yaml | 2 +- scripts/generate.sh | 2 +- .../Attributes/ValidateModelStateAttribute.cs | 2 +- .../Authentication/ApiAuthentication.cs | 2 +- src/Echo.OpenAPI/Controllers/DefaultApi.cs | 10 +++++----- src/Echo.OpenAPI/Converters/CustomEnumConverter.cs | 2 +- src/Echo.OpenAPI/Echo.OpenAPI.csproj | 2 +- src/Echo.OpenAPI/Filters/BasePathFilter.cs | 2 +- .../Filters/GeneratePathParamsValidationFilter.cs | 2 +- .../Formatters/InputFormatterStream.cs | 4 ++-- src/Echo.OpenAPI/Models/Message.cs | 14 +++++++------- src/Echo.OpenAPI/OpenApi/TypeExtensions.cs | 4 ++-- src/Echo.OpenAPI/Properties/launchSettings.json | 4 ++-- src/Echo.OpenAPI/Startup.cs | 4 ++-- 17 files changed, 38 insertions(+), 35 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 328e221..5449f98 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.6.0 hooks: - id: end-of-file-fixer - id: trailing-whitespace diff --git a/Echo.OpenAPI.sln b/Echo.OpenAPI.sln index 7b20975..8647ea5 100644 --- a/Echo.OpenAPI.sln +++ b/Echo.OpenAPI.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27428.2043 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Echo.OpenAPI", "src\Echo.OpenAPI\Echo.OpenAPI.csproj", "{28CA127C-200D-4F9B-8AF4-2B1D44D71727}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Echo.OpenAPI", "src\Echo.OpenAPI\Echo.OpenAPI.csproj", "{E6D4ED57-2B05-4501-B4B2-9AF40792B7BD}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {28CA127C-200D-4F9B-8AF4-2B1D44D71727}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {28CA127C-200D-4F9B-8AF4-2B1D44D71727}.Debug|Any CPU.Build.0 = Debug|Any CPU - {28CA127C-200D-4F9B-8AF4-2B1D44D71727}.Release|Any CPU.ActiveCfg = Release|Any CPU - {28CA127C-200D-4F9B-8AF4-2B1D44D71727}.Release|Any CPU.Build.0 = Release|Any CPU + {E6D4ED57-2B05-4501-B4B2-9AF40792B7BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E6D4ED57-2B05-4501-B4B2-9AF40792B7BD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E6D4ED57-2B05-4501-B4B2-9AF40792B7BD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E6D4ED57-2B05-4501-B4B2-9AF40792B7BD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Makefile b/Makefile index e7593c6..60fdb74 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,12 @@ -all: +all: generate dotnet restore dotnet build --configuration Release --no-restore dotnet test --no-restore --verbosity normal +generate: + ./scripts/generate.sh + HELP_ARGS ?= config-help -g aspnetcore help: ### make help HELP_ARGS=help diff --git a/config.yaml b/config.yaml index 6681418..ec53ac2 100644 --- a/config.yaml +++ b/config.yaml @@ -10,4 +10,4 @@ packageName: Echo.OpenAPI useDateTimeForDate: true # Deserialize array types to Collection instead of List. (Default: false) -useCollection: true +# useCollection: true diff --git a/scripts/generate.sh b/scripts/generate.sh index fe00f7b..0748cdd 100755 --- a/scripts/generate.sh +++ b/scripts/generate.sh @@ -19,4 +19,4 @@ docker run --rm -e CSHARP_POST_PROCESS_FILE=${CSHARP_POST_PROCESS_FILE} -v "${PW -o /local/"$out" dos2unix $(find . -type f -exec grep -I -q . {} \; -print) -pre-commit run -a +#pre-commit run -a diff --git a/src/Echo.OpenAPI/Attributes/ValidateModelStateAttribute.cs b/src/Echo.OpenAPI/Attributes/ValidateModelStateAttribute.cs index 45ee88a..7d9f938 100644 --- a/src/Echo.OpenAPI/Attributes/ValidateModelStateAttribute.cs +++ b/src/Echo.OpenAPI/Attributes/ValidateModelStateAttribute.cs @@ -4,7 +4,7 @@ * A simple API to store and retrieve messages. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ diff --git a/src/Echo.OpenAPI/Authentication/ApiAuthentication.cs b/src/Echo.OpenAPI/Authentication/ApiAuthentication.cs index 2ff69bb..2e84bcc 100644 --- a/src/Echo.OpenAPI/Authentication/ApiAuthentication.cs +++ b/src/Echo.OpenAPI/Authentication/ApiAuthentication.cs @@ -4,7 +4,7 @@ * A simple API to store and retrieve messages. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ diff --git a/src/Echo.OpenAPI/Controllers/DefaultApi.cs b/src/Echo.OpenAPI/Controllers/DefaultApi.cs index 9d8f10d..8c95cb0 100644 --- a/src/Echo.OpenAPI/Controllers/DefaultApi.cs +++ b/src/Echo.OpenAPI/Controllers/DefaultApi.cs @@ -4,7 +4,7 @@ * A simple API to store and retrieve messages. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,13 +21,13 @@ using Echo.OpenAPI.Models; namespace Echo.OpenAPI.Controllers -{ +{ /// - /// + /// /// [ApiController] public class DefaultApiController : ControllerBase - { + { /// /// Search messages /// @@ -45,7 +45,7 @@ public virtual IActionResult MessagesGet([FromQuery (Name = "query")]string quer // return StatusCode(200, default(List)); string exampleJson = null; exampleJson = "[ {\n \"id\" : 0,\n \"message\" : \"message\"\n}, {\n \"id\" : 0,\n \"message\" : \"message\"\n} ]"; - + var example = exampleJson != null ? JsonConvert.DeserializeObject>(exampleJson) : default(List); diff --git a/src/Echo.OpenAPI/Converters/CustomEnumConverter.cs b/src/Echo.OpenAPI/Converters/CustomEnumConverter.cs index cddc1e0..b7169fa 100644 --- a/src/Echo.OpenAPI/Converters/CustomEnumConverter.cs +++ b/src/Echo.OpenAPI/Converters/CustomEnumConverter.cs @@ -4,7 +4,7 @@ * A simple API to store and retrieve messages. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ diff --git a/src/Echo.OpenAPI/Echo.OpenAPI.csproj b/src/Echo.OpenAPI/Echo.OpenAPI.csproj index 771598a..7cd1e68 100644 --- a/src/Echo.OpenAPI/Echo.OpenAPI.csproj +++ b/src/Echo.OpenAPI/Echo.OpenAPI.csproj @@ -9,7 +9,7 @@ 1.0.0 Echo.OpenAPI Echo.OpenAPI - ca94f13f-76ed-41d9-9e2e-c217f7caf605 + 209e1ede-1abb-4c4e-9c7c-4a448b9b824f Linux ..\.. diff --git a/src/Echo.OpenAPI/Filters/BasePathFilter.cs b/src/Echo.OpenAPI/Filters/BasePathFilter.cs index ec7ce11..f9ae6b4 100644 --- a/src/Echo.OpenAPI/Filters/BasePathFilter.cs +++ b/src/Echo.OpenAPI/Filters/BasePathFilter.cs @@ -4,7 +4,7 @@ * A simple API to store and retrieve messages. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ diff --git a/src/Echo.OpenAPI/Filters/GeneratePathParamsValidationFilter.cs b/src/Echo.OpenAPI/Filters/GeneratePathParamsValidationFilter.cs index 02af433..de70cd5 100644 --- a/src/Echo.OpenAPI/Filters/GeneratePathParamsValidationFilter.cs +++ b/src/Echo.OpenAPI/Filters/GeneratePathParamsValidationFilter.cs @@ -4,7 +4,7 @@ * A simple API to store and retrieve messages. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ diff --git a/src/Echo.OpenAPI/Formatters/InputFormatterStream.cs b/src/Echo.OpenAPI/Formatters/InputFormatterStream.cs index b70fecf..396132b 100644 --- a/src/Echo.OpenAPI/Formatters/InputFormatterStream.cs +++ b/src/Echo.OpenAPI/Formatters/InputFormatterStream.cs @@ -4,7 +4,7 @@ * A simple API to store and retrieve messages. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ @@ -42,4 +42,4 @@ protected override bool CanReadType(Type type) return false; } } -} +} \ No newline at end of file diff --git a/src/Echo.OpenAPI/Models/Message.cs b/src/Echo.OpenAPI/Models/Message.cs index 96e3e75..1d59887 100644 --- a/src/Echo.OpenAPI/Models/Message.cs +++ b/src/Echo.OpenAPI/Models/Message.cs @@ -4,7 +4,7 @@ * A simple API to store and retrieve messages. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,9 +19,9 @@ using Echo.OpenAPI.Converters; namespace Echo.OpenAPI.Models -{ +{ /// - /// + /// /// [DataContract] public partial class Message : IEquatable @@ -85,12 +85,12 @@ public bool Equals(Message other) if (other is null) return false; if (ReferenceEquals(this, other)) return true; - return + return ( Id == other.Id || - + Id.Equals(other.Id) - ) && + ) && ( VarMessage == other.VarMessage || VarMessage != null && @@ -108,7 +108,7 @@ public override int GetHashCode() { var hashCode = 41; // Suitable nullity checks etc, of course :) - + hashCode = hashCode * 59 + Id.GetHashCode(); if (VarMessage != null) hashCode = hashCode * 59 + VarMessage.GetHashCode(); diff --git a/src/Echo.OpenAPI/OpenApi/TypeExtensions.cs b/src/Echo.OpenAPI/OpenApi/TypeExtensions.cs index 746f51f..fe2be08 100644 --- a/src/Echo.OpenAPI/OpenApi/TypeExtensions.cs +++ b/src/Echo.OpenAPI/OpenApi/TypeExtensions.cs @@ -4,7 +4,7 @@ * A simple API to store and retrieve messages. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ @@ -58,4 +58,4 @@ public static string FullNameSansTypeParameters(this Type type) return (chopIndex == -1) ? fullName : fullName.Substring(0, chopIndex); } } -} +} \ No newline at end of file diff --git a/src/Echo.OpenAPI/Properties/launchSettings.json b/src/Echo.OpenAPI/Properties/launchSettings.json index 2f1a414..d00ece7 100644 --- a/src/Echo.OpenAPI/Properties/launchSettings.json +++ b/src/Echo.OpenAPI/Properties/launchSettings.json @@ -1,8 +1,8 @@ { "$schema": "http://json.schemastore.org/launchsettings.json", "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, + "windowsAuthentication": false, + "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:61788", "sslPort": 44301 diff --git a/src/Echo.OpenAPI/Startup.cs b/src/Echo.OpenAPI/Startup.cs index 9af8c3c..26e3cfa 100644 --- a/src/Echo.OpenAPI/Startup.cs +++ b/src/Echo.OpenAPI/Startup.cs @@ -4,7 +4,7 @@ * A simple API to store and retrieve messages. * * The version of the OpenAPI document: 0.0.1 - * + * * Generated by: https://openapi-generator.tech */ @@ -71,7 +71,7 @@ public void ConfigureServices(IServiceCollection services) .AddSwaggerGen(c => { c.EnableAnnotations(enableAnnotationsForInheritance: true, enableAnnotationsForPolymorphism: true); - + c.SwaggerDoc("0.0.1", new OpenApiInfo { Title = "Echo API",