diff --git a/third_party/dotnet/devtools/src/generator/BUILD.bazel b/third_party/dotnet/devtools/src/generator/BUILD.bazel index c78f7516763d4..f202cd9df6387 100644 --- a/third_party/dotnet/devtools/src/generator/BUILD.bazel +++ b/third_party/dotnet/devtools/src/generator/BUILD.bazel @@ -3,8 +3,9 @@ load("//dotnet:defs.bzl", "csharp_binary", "framework") csharp_binary( name = "generator", srcs = glob(["**/*.cs"]), + nullable = "annotations", # Used as a tool in our build, so just target one framework - target_frameworks = ["net7.0"], + target_frameworks = ["net8.0"], visibility = [ "//dotnet:__subpackages__", ], @@ -14,6 +15,5 @@ csharp_binary( framework("nuget", "Humanizer.Core"), framework("nuget", "Microsoft.Extensions.DependencyInjection"), framework("nuget", "Microsoft.Extensions.DependencyInjection.Abstractions"), - framework("nuget", "Newtonsoft.Json"), ], ) diff --git a/third_party/dotnet/devtools/src/generator/CodeGen/CodeGenerationDefinitionTemplateSettings.cs b/third_party/dotnet/devtools/src/generator/CodeGen/CodeGenerationDefinitionTemplateSettings.cs index c1758190172f8..2ff1ea9a9dcfa 100644 --- a/third_party/dotnet/devtools/src/generator/CodeGen/CodeGenerationDefinitionTemplateSettings.cs +++ b/third_party/dotnet/devtools/src/generator/CodeGen/CodeGenerationDefinitionTemplateSettings.cs @@ -1,6 +1,6 @@ namespace OpenQA.Selenium.DevToolsGenerator.CodeGen { - using Newtonsoft.Json; + using System.Text.Json.Serialization; /// /// Represents settings around Definition templates. @@ -47,22 +47,22 @@ public CodeGenerationDefinitionTemplateSettings() }; } - [JsonProperty("domainTemplate")] + [JsonPropertyName("domainTemplate")] public CodeGenerationTemplateSettings DomainTemplate { get; set; } - [JsonProperty("commandTemplate")] + [JsonPropertyName("commandTemplate")] public CodeGenerationTemplateSettings CommandTemplate { get; set; } - [JsonProperty("eventTemplate")] + [JsonPropertyName("eventTemplate")] public CodeGenerationTemplateSettings EventTemplate { get; set; } - [JsonProperty("typeObjectTemplate")] + [JsonPropertyName("typeObjectTemplate")] public CodeGenerationTemplateSettings TypeObjectTemplate { get; set; } - [JsonProperty("typeHashTemplate")] + [JsonPropertyName("typeHashTemplate")] public CodeGenerationTemplateSettings TypeHashTemplate { get; set; } - [JsonProperty("typeEnumTemplate")] + [JsonPropertyName("typeEnumTemplate")] public CodeGenerationTemplateSettings TypeEnumTemplate { get; set; } } } diff --git a/third_party/dotnet/devtools/src/generator/CodeGen/CodeGenerationSettings.cs b/third_party/dotnet/devtools/src/generator/CodeGen/CodeGenerationSettings.cs index ebbf2c753107d..fdcd62b441d6a 100644 --- a/third_party/dotnet/devtools/src/generator/CodeGen/CodeGenerationSettings.cs +++ b/third_party/dotnet/devtools/src/generator/CodeGen/CodeGenerationSettings.cs @@ -1,6 +1,6 @@ namespace OpenQA.Selenium.DevToolsGenerator.CodeGen { - using Newtonsoft.Json; + using System.Text.Json.Serialization; using System.Collections.Generic; /// @@ -26,43 +26,43 @@ public CodeGenerationSettings() /// /// Collection of templates that will be parsed and output in the target folder. /// - [JsonProperty("include")] + [JsonPropertyName("include")] public ICollection Include { get; set; } /// /// Indicates whether or not domains marked as depreciated will be generated. (Default: true) /// - [JsonProperty("includeDeprecatedDomains")] + [JsonPropertyName("includeDeprecatedDomains")] public bool IncludeDeprecatedDomains { get; set; } /// /// Indicates whether or not domains marked as depreciated will be generated. (Default: true) /// - [JsonProperty("includeExperimentalDomains")] + [JsonPropertyName("includeExperimentalDomains")] public bool IncludeExperimentalDomains { get; set; } /// /// Gets or sets the root namespace of generated classes. /// - [JsonProperty("rootNamespace")] + [JsonPropertyName("rootNamespace")] public string RootNamespace { get; set; } /// /// Gets the version number of the runtime. /// - [JsonProperty("runtimeVersion")] + [JsonPropertyName("runtimeVersion")] public string RuntimeVersion { get; set; } - [JsonProperty("definitionTemplates")] + [JsonPropertyName("definitionTemplates")] public CodeGenerationDefinitionTemplateSettings DefinitionTemplates { get; set; } - [JsonProperty("templatesPath")] + [JsonPropertyName("templatesPath")] public string TemplatesPath { get; set; } /// /// The using statements that will be included on each generated file. /// - [JsonProperty("usingStatements")] + [JsonPropertyName("usingStatements")] public ICollection UsingStatements { get; set; } } } diff --git a/third_party/dotnet/devtools/src/generator/CodeGen/CodeGenerationTemplateSettings.cs b/third_party/dotnet/devtools/src/generator/CodeGen/CodeGenerationTemplateSettings.cs index 4f2dbe266a585..a5360955d5764 100644 --- a/third_party/dotnet/devtools/src/generator/CodeGen/CodeGenerationTemplateSettings.cs +++ b/third_party/dotnet/devtools/src/generator/CodeGen/CodeGenerationTemplateSettings.cs @@ -1,16 +1,16 @@ namespace OpenQA.Selenium.DevToolsGenerator.CodeGen { - using Newtonsoft.Json; + using System.Text.Json.Serialization; /// /// Defines settings around templates /// public class CodeGenerationTemplateSettings { - [JsonProperty("templatePath")] + [JsonPropertyName("templatePath")] public string TemplatePath { get; set; } - [JsonProperty("outputPath")] + [JsonPropertyName("outputPath")] public string OutputPath { get; set; } } } diff --git a/third_party/dotnet/devtools/src/generator/Converters/BooleanJsonConverter.cs b/third_party/dotnet/devtools/src/generator/Converters/BooleanJsonConverter.cs index 99c2d4292a7fb..513fd55a0cc4b 100644 --- a/third_party/dotnet/devtools/src/generator/Converters/BooleanJsonConverter.cs +++ b/third_party/dotnet/devtools/src/generator/Converters/BooleanJsonConverter.cs @@ -1,68 +1,59 @@ namespace OpenQA.Selenium.DevToolsGenerator.Converters { - using Newtonsoft.Json; using System; + using System.Text.Json; + using System.Text.Json.Serialization; /// /// Handles converting JSON string values into a C# boolean data type. /// - public class BooleanJsonConverter : JsonConverter + public class BooleanJsonConverter : JsonConverter { - /// - /// Determines whether this instance can convert the specified object type. - /// - /// Type of the object. - /// - /// true if this instance can convert the specified object type; otherwise, false. - /// - public override bool CanConvert(Type objectType) - { - // Handle only boolean types. - return objectType == typeof(bool); - } + public override bool HandleNull => false; - /// - /// Reads the JSON representation of the object. - /// - /// The to read from. - /// Type of the object. - /// The existing value of object being read. - /// The calling serializer. - /// - /// The object value. - /// - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + public override bool Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - switch (reader.Value.ToString().ToLower().Trim()) + switch (reader.TokenType) { - case "true": - case "yes": - case "y": - case "1": + case JsonTokenType.True: return true; - case "false": - case "no": - case "n": - case "0": + + case JsonTokenType.False: return false; - } - // If we reach here, we're pretty much going to throw an error so let's let Json.NET throw it's pretty-fied error message. - return new JsonSerializer().Deserialize(reader, objectType); - } + case JsonTokenType.String: + string boolString = reader.GetString()!; + if (bool.TryParse(boolString, out bool b)) + { + return b; + } + + boolString = boolString.ToLowerInvariant(); - /// - /// Specifies that this converter will not participate in writing results. - /// - public override bool CanWrite => false; + if (boolString.AsSpan().Trim().SequenceEqual("yes".AsSpan()) || + boolString.AsSpan().Trim().SequenceEqual("y".AsSpan()) || + boolString.AsSpan().Trim().SequenceEqual("1".AsSpan())) + { + return true; + } + + if (boolString.AsSpan().Trim().SequenceEqual("no".AsSpan()) || + boolString.AsSpan().Trim().SequenceEqual("n".AsSpan()) || + boolString.AsSpan().Trim().SequenceEqual("0".AsSpan())) + { + return false; + } + + throw new JsonException(); + + default: + throw new JsonException(); + } + } - /// - /// Writes the JSON representation of the object. - /// - /// The to write to.The value.The calling serializer. - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + public override void Write(Utf8JsonWriter writer, bool value, JsonSerializerOptions options) { - throw new NotSupportedException(); + writer.WriteBooleanValue(value); } } } diff --git a/third_party/dotnet/devtools/src/generator/DevToolsGenerator.csproj b/third_party/dotnet/devtools/src/generator/DevToolsGenerator.csproj index 8c053d83391fd..9c32a512b6730 100644 --- a/third_party/dotnet/devtools/src/generator/DevToolsGenerator.csproj +++ b/third_party/dotnet/devtools/src/generator/DevToolsGenerator.csproj @@ -2,8 +2,9 @@ Exe - net60 + net8.0 OpenQA.Selenium.DevToolsGenerator + annotations @@ -19,7 +20,6 @@ - diff --git a/third_party/dotnet/devtools/src/generator/Program.cs b/third_party/dotnet/devtools/src/generator/Program.cs index a2aded339afb1..32cdfc52b5272 100644 --- a/third_party/dotnet/devtools/src/generator/Program.cs +++ b/third_party/dotnet/devtools/src/generator/Program.cs @@ -3,10 +3,11 @@ using System.Text; using CommandLine; using Microsoft.Extensions.DependencyInjection; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; +using System.Text.Json.Serialization; using OpenQA.Selenium.DevToolsGenerator.CodeGen; using OpenQA.Selenium.DevToolsGenerator.ProtocolDefinition; +using System.Text.Json; +using System.Text.Json.Nodes; namespace OpenQA.Selenium.DevToolsGenerator { @@ -24,7 +25,7 @@ static int Main(string[] args) } var settingsJson = File.ReadAllText(cliArguments.Settings); - var settings = JsonConvert.DeserializeObject(settingsJson); + var settings = JsonSerializer.Deserialize(settingsJson); if (!string.IsNullOrEmpty(cliArguments.TemplatesPath)) { settings.TemplatesPath = cliArguments.TemplatesPath; @@ -48,7 +49,7 @@ static int Main(string[] args) var protocolDefinitionData = GetProtocolDefinitionData(cliArguments); - var protocolDefinition = protocolDefinitionData.ToObject(new JsonSerializer() { MetadataPropertyHandling = MetadataPropertyHandling.Ignore }); + var protocolDefinition = protocolDefinitionData.Deserialize(new JsonSerializerOptions() { ReferenceHandler = ReferenceHandler.IgnoreCycles }); //Begin the code generation process. if (!cliArguments.Quiet) @@ -113,9 +114,9 @@ static int Main(string[] args) /// /// /// - public static JObject GetProtocolDefinitionData(CommandLineOptions args) + public static JsonObject GetProtocolDefinitionData(CommandLineOptions args) { - JObject protocolData; + JsonObject protocolData; string browserProtocolPath = args.BrowserProtocolPath; if (!File.Exists(browserProtocolPath)) { @@ -134,15 +135,15 @@ public static JObject GetProtocolDefinitionData(CommandLineOptions args) } } - JObject browserProtocol = JObject.Parse(File.ReadAllText(browserProtocolPath)); - JObject jsProtocol = JObject.Parse(File.ReadAllText(jsProtocolPath)); + JsonObject browserProtocol = JsonNode.Parse(File.ReadAllText(browserProtocolPath)).AsObject(); + JsonObject jsProtocol = JsonNode.Parse(File.ReadAllText(jsProtocolPath)).AsObject(); ProtocolVersionDefinition currentVersion = new ProtocolVersionDefinition(); currentVersion.ProtocolVersion = "1.3"; currentVersion.Browser = "Chrome/86.0"; protocolData = MergeJavaScriptProtocolDefinitions(browserProtocol, jsProtocol); - protocolData["browserVersion"] = JToken.FromObject(currentVersion); + protocolData["browserVersion"] = JsonSerializer.SerializeToNode(currentVersion); return protocolData; } @@ -153,7 +154,7 @@ public static JObject GetProtocolDefinitionData(CommandLineOptions args) /// /// /// - public static JObject MergeJavaScriptProtocolDefinitions(JObject browserProtocol, JObject jsProtocol) + public static JsonObject MergeJavaScriptProtocolDefinitions(JsonObject? browserProtocol, JsonObject? jsProtocol) { //Merge the 2 protocols together. if (jsProtocol["version"]["majorVersion"] != browserProtocol["version"]["majorVersion"] || @@ -162,11 +163,11 @@ public static JObject MergeJavaScriptProtocolDefinitions(JObject browserProtocol throw new InvalidOperationException("Protocol mismatch -- The WebKit and V8 protocol versions should match."); } - var result = browserProtocol.DeepClone() as JObject; - foreach (var domain in jsProtocol["domains"]) + var result = browserProtocol.DeepClone().AsObject(); + foreach (var domain in jsProtocol["domains"].AsArray()) { - JArray jDomains = (JArray)result["domains"]; - jDomains.Add(domain); + JsonArray jDomains = result["domains"].AsArray(); + jDomains.Add(domain.DeepClone()); } return result; diff --git a/third_party/dotnet/devtools/src/generator/ProtocolDefinition/CommandDefinition.cs b/third_party/dotnet/devtools/src/generator/ProtocolDefinition/CommandDefinition.cs index 9d7dec364c5ad..9a9c900b24d01 100644 --- a/third_party/dotnet/devtools/src/generator/ProtocolDefinition/CommandDefinition.cs +++ b/third_party/dotnet/devtools/src/generator/ProtocolDefinition/CommandDefinition.cs @@ -1,6 +1,6 @@ namespace OpenQA.Selenium.DevToolsGenerator.ProtocolDefinition { - using Newtonsoft.Json; + using System.Text.Json.Serialization; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -14,16 +14,16 @@ public CommandDefinition() Returns = new Collection(); } - [JsonProperty(PropertyName = "handlers")] + [JsonPropertyName("handlers")] public ICollection Handlers { get; set; } - [JsonProperty(PropertyName = "parameters")] + [JsonPropertyName("parameters")] public ICollection Parameters { get; set; } - [JsonProperty(PropertyName = "returns")] + [JsonPropertyName("returns")] public ICollection Returns { get; set; } - [JsonProperty(PropertyName = "redirect")] + [JsonPropertyName("redirect")] public string Redirect { get; set; } [JsonIgnore] diff --git a/third_party/dotnet/devtools/src/generator/ProtocolDefinition/DomainDefinition.cs b/third_party/dotnet/devtools/src/generator/ProtocolDefinition/DomainDefinition.cs index 7c461f3277676..e66f36b82487a 100644 --- a/third_party/dotnet/devtools/src/generator/ProtocolDefinition/DomainDefinition.cs +++ b/third_party/dotnet/devtools/src/generator/ProtocolDefinition/DomainDefinition.cs @@ -1,6 +1,6 @@ namespace OpenQA.Selenium.DevToolsGenerator.ProtocolDefinition { - using Newtonsoft.Json; + using System.Text.Json.Serialization; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -15,19 +15,19 @@ public DomainDefinition() Commands = new Collection(); } - [JsonProperty(PropertyName = "domain")] + [JsonPropertyName("domain")] public override string Name { get; set; } - [JsonProperty(PropertyName = "types")] + [JsonPropertyName("types")] public ICollection Types { get; set; } - [JsonProperty(PropertyName = "commands")] + [JsonPropertyName("commands")] public ICollection Commands { get; set; } - [JsonProperty(PropertyName = "events")] + [JsonPropertyName("events")] public ICollection Events { get; set; } - [JsonProperty(PropertyName = "dependencies")] + [JsonPropertyName("dependencies")] public ICollection Dependencies { get; set; } } } diff --git a/third_party/dotnet/devtools/src/generator/ProtocolDefinition/EventDefinition.cs b/third_party/dotnet/devtools/src/generator/ProtocolDefinition/EventDefinition.cs index ba0d19a661b34..b005742a6a378 100644 --- a/third_party/dotnet/devtools/src/generator/ProtocolDefinition/EventDefinition.cs +++ b/third_party/dotnet/devtools/src/generator/ProtocolDefinition/EventDefinition.cs @@ -1,6 +1,6 @@ namespace OpenQA.Selenium.DevToolsGenerator.ProtocolDefinition { - using Newtonsoft.Json; + using System.Text.Json.Serialization; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -11,7 +11,7 @@ public EventDefinition() Parameters = new Collection(); } - [JsonProperty(PropertyName = "parameters")] + [JsonPropertyName("parameters")] public ICollection Parameters { get; set; } } } diff --git a/third_party/dotnet/devtools/src/generator/ProtocolDefinition/ProtocolDefinition.cs b/third_party/dotnet/devtools/src/generator/ProtocolDefinition/ProtocolDefinition.cs index 487b18e45ae27..cc7757b8d4a58 100644 --- a/third_party/dotnet/devtools/src/generator/ProtocolDefinition/ProtocolDefinition.cs +++ b/third_party/dotnet/devtools/src/generator/ProtocolDefinition/ProtocolDefinition.cs @@ -1,6 +1,6 @@ namespace OpenQA.Selenium.DevToolsGenerator.ProtocolDefinition { - using Newtonsoft.Json; + using System.Text.Json.Serialization; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -11,13 +11,16 @@ public ProtocolDefinition() Domains = new Collection(); } - [JsonProperty(PropertyName = "browserVersion", Required = Required.Always)] + [JsonPropertyName("browserVersion")] + [JsonRequired] public ProtocolVersionDefinition BrowserVersion { get; set; } - [JsonProperty(PropertyName = "version", Required = Required.Always)] + [JsonPropertyName("version")] + [JsonRequired] public Version Version { get; set; } - [JsonProperty(PropertyName = "domains", Required = Required.Always)] + [JsonPropertyName("domains")] + [JsonRequired] public ICollection Domains { get; set; } } } diff --git a/third_party/dotnet/devtools/src/generator/ProtocolDefinition/ProtocolDefinitionItem.cs b/third_party/dotnet/devtools/src/generator/ProtocolDefinition/ProtocolDefinitionItem.cs index 75bdf196f993f..7310359e2f62c 100644 --- a/third_party/dotnet/devtools/src/generator/ProtocolDefinition/ProtocolDefinitionItem.cs +++ b/third_party/dotnet/devtools/src/generator/ProtocolDefinition/ProtocolDefinitionItem.cs @@ -1,12 +1,12 @@ namespace OpenQA.Selenium.DevToolsGenerator.ProtocolDefinition { - using Newtonsoft.Json; + using System.Text.Json.Serialization; using OpenQA.Selenium.DevToolsGenerator.Converters; public abstract class ProtocolDefinitionItem : IDefinition { - [JsonProperty(PropertyName = "deprecated")] + [JsonPropertyName("deprecated")] public bool Deprecated { get; set; } public string Description @@ -15,11 +15,11 @@ public string Description set => InitialDescription = value; } - [JsonProperty(PropertyName = "experimental")] + [JsonPropertyName("experimental")] [JsonConverter(typeof(BooleanJsonConverter))] public bool Experimental { get; set; } - [JsonProperty(PropertyName = "name")] + [JsonPropertyName("name")] public virtual string Name { get; set; } public override string ToString() @@ -27,7 +27,7 @@ public override string ToString() return Name; } - [JsonProperty(PropertyName = "description")] + [JsonPropertyName("description")] protected string InitialDescription { get; set; } } } diff --git a/third_party/dotnet/devtools/src/generator/ProtocolDefinition/ProtocolVersionDefinition.cs b/third_party/dotnet/devtools/src/generator/ProtocolDefinition/ProtocolVersionDefinition.cs index 172f9bd5f47c7..a69bd450025b0 100644 --- a/third_party/dotnet/devtools/src/generator/ProtocolDefinition/ProtocolVersionDefinition.cs +++ b/third_party/dotnet/devtools/src/generator/ProtocolDefinition/ProtocolVersionDefinition.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; using System; using System.Collections.Generic; using System.Text; @@ -11,7 +11,7 @@ namespace OpenQA.Selenium.DevToolsGenerator.ProtocolDefinition /// public class ProtocolVersionDefinition { - [JsonProperty(PropertyName = "Browser")] + [JsonPropertyName("Browser")] public string Browser { get; set; } [JsonIgnore] @@ -20,13 +20,13 @@ public class ProtocolVersionDefinition [JsonIgnore] public string BrowserMajorVersion => Regex.Match(Browser, ".*/(\\d+)\\..*").Groups[1].Value; - [JsonProperty(PropertyName = "Protocol-Version")] + [JsonPropertyName("Protocol-Version")] public string ProtocolVersion { get; set; } - [JsonProperty(PropertyName = "User-Agent")] + [JsonPropertyName("User-Agent")] public string UserAgent { get; set; } - [JsonProperty(PropertyName = "V8-Version")] + [JsonPropertyName("V8-Version")] public string V8Version { get; set; } [JsonIgnore] @@ -46,7 +46,7 @@ public string V8VersionNumber } } - [JsonProperty(PropertyName = "WebKit-Version")] + [JsonPropertyName("WebKit-Version")] public string WebKitVersion { get; set; } [JsonIgnore] diff --git a/third_party/dotnet/devtools/src/generator/ProtocolDefinition/TypeDefinition.cs b/third_party/dotnet/devtools/src/generator/ProtocolDefinition/TypeDefinition.cs index 0c1948b0c356c..90452390914d8 100644 --- a/third_party/dotnet/devtools/src/generator/ProtocolDefinition/TypeDefinition.cs +++ b/third_party/dotnet/devtools/src/generator/ProtocolDefinition/TypeDefinition.cs @@ -1,6 +1,6 @@ namespace OpenQA.Selenium.DevToolsGenerator.ProtocolDefinition { - using Newtonsoft.Json; + using System.Text.Json.Serialization; using OpenQA.Selenium.DevToolsGenerator.Converters; using System; using System.Collections.Generic; @@ -14,31 +14,31 @@ public TypeDefinition() Properties = new Collection(); } - [JsonProperty(PropertyName = "id")] + [JsonPropertyName("id")] public string Id { get; set; } - [JsonProperty(PropertyName = "type")] + [JsonPropertyName("type")] public string Type { get; set; } - [JsonProperty(PropertyName = "enum")] + [JsonPropertyName("enum")] public ICollection Enum { get; set; } - [JsonProperty(PropertyName = "properties")] + [JsonPropertyName("properties")] public ICollection Properties { get; set; } - [JsonProperty(PropertyName = "items")] + [JsonPropertyName("items")] public TypeDefinition Items { get; set; } - [JsonProperty(PropertyName = "minItems")] + [JsonPropertyName("minItems")] public int MinItems { get; set; } - [JsonProperty(PropertyName = "maxItems")] + [JsonPropertyName("maxItems")] public int MaxItems { get; set; } - [JsonProperty(PropertyName = "$ref")] + [JsonPropertyName("$ref")] public string TypeReference { get; set; } - [JsonProperty(PropertyName = "optional")] + [JsonPropertyName("optional")] [JsonConverter(typeof(BooleanJsonConverter))] public bool Optional { get; set; } diff --git a/third_party/dotnet/devtools/src/generator/ProtocolDefinition/Version.cs b/third_party/dotnet/devtools/src/generator/ProtocolDefinition/Version.cs index efbde86ee9ee2..6ccf659057bac 100644 --- a/third_party/dotnet/devtools/src/generator/ProtocolDefinition/Version.cs +++ b/third_party/dotnet/devtools/src/generator/ProtocolDefinition/Version.cs @@ -1,6 +1,6 @@ namespace OpenQA.Selenium.DevToolsGenerator.ProtocolDefinition { - using Newtonsoft.Json; + using System.Text.Json.Serialization; using System; /// @@ -8,10 +8,10 @@ namespace OpenQA.Selenium.DevToolsGenerator.ProtocolDefinition /// public sealed class Version : IComparable { - [JsonProperty(PropertyName = "major")] + [JsonPropertyName("major")] public string Major { get; set; } - [JsonProperty(PropertyName = "minor")] + [JsonPropertyName("minor")] public string Minor { get; set; } public int CompareTo(Version other) diff --git a/third_party/dotnet/devtools/src/generator/Templates/project.hbs b/third_party/dotnet/devtools/src/generator/Templates/project.hbs index 1b8a4fa3994b7..9768e1a26126c 100644 --- a/third_party/dotnet/devtools/src/generator/Templates/project.hbs +++ b/third_party/dotnet/devtools/src/generator/Templates/project.hbs @@ -3,6 +3,7 @@ net45;net46;net47;netstandard2.0 true + annotations {{chromeVersion.BrowserVersion}}{{#if runtimeVersion}}-{{runtimeVersion}}{{/if}} Sean McLellan BaristaLabs, LLC