From 6109fb0e5e4c714a72c547591e43bfc86b032b5f Mon Sep 17 00:00:00 2001 From: Kunlin Yu Date: Fri, 14 Oct 2022 22:05:25 +0800 Subject: [PATCH] Set comparer to StringComparer.Ordinal to make sure the order of definitions of schema is stable (#300) Signed-off-by: Kunlin Yu --- .../Generation/JSchemaGeneratorInternal.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Src/Newtonsoft.Json.Schema/Generation/JSchemaGeneratorInternal.cs b/Src/Newtonsoft.Json.Schema/Generation/JSchemaGeneratorInternal.cs index a9b15c43..f0ca2efa 100644 --- a/Src/Newtonsoft.Json.Schema/Generation/JSchemaGeneratorInternal.cs +++ b/Src/Newtonsoft.Json.Schema/Generation/JSchemaGeneratorInternal.cs @@ -73,7 +73,7 @@ public JSchema Generate(Type type, Required required, JsonProperty? memberProper } // definition schemas alphabetical ordered - foreach (KeyValuePair definitionSchema in definitionsSchemas.OrderBy(s => s.Key)) + foreach (KeyValuePair definitionSchema in definitionsSchemas.OrderBy(s => s.Key, StringComparer.Ordinal)) { definitions[definitionSchema.Key] = definitionSchema.Value; }