Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ namespace Microsoft.ComponentDetection.Contracts.BcdeModels;
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

// Summary:
// Details for a docker container
[JsonObject(MemberSerialization.OptOut, NamingStrategyType = typeof(CamelCaseNamingStrategy))]
public class ContainerDetails
{
// Summary:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
namespace Microsoft.ComponentDetection.Contracts.BcdeModels;

using System.Text.Json.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

[JsonObject(MemberSerialization.OptOut, NamingStrategyType = typeof(CamelCaseNamingStrategy))]
public class DefaultGraphScanResult : ScanResult
{
[JsonPropertyName("dependencyGraphs")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ namespace Microsoft.ComponentDetection.Contracts.BcdeModels;

using System.Collections.Generic;
using System.Text.Json.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

[JsonObject(MemberSerialization.OptOut, NamingStrategyType = typeof(CamelCaseNamingStrategy))]
public class DependencyGraphWithMetadata
{
[JsonPropertyName("graph")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ namespace Microsoft.ComponentDetection.Contracts.BcdeModels;
using System.Collections.Generic;
using System.Text.Json.Serialization;
using Microsoft.ComponentDetection.Contracts.TypedComponent;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;

[JsonObject(MemberSerialization.OptOut, NamingStrategyType = typeof(CamelCaseNamingStrategy))]
public class Detector
{
[JsonPropertyName("detectorId")]
Expand All @@ -20,7 +16,6 @@ public class Detector
[JsonPropertyName("version")]
public int Version { get; set; }

[JsonProperty(ItemConverterType = typeof(StringEnumConverter))]
[JsonPropertyName("supportedComponentTypes")]
public IEnumerable<ComponentType> SupportedComponentTypes { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ namespace Microsoft.ComponentDetection.Contracts.BcdeModels;

using System.Collections.Generic;
using System.Text.Json.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;

[JsonObject(MemberSerialization.OptOut, NamingStrategyType = typeof(CamelCaseNamingStrategy))]
public class ScanResult
{
[JsonPropertyName("componentsFound")]
Expand All @@ -22,7 +18,7 @@ public class ScanResult
[JsonPropertyName("containerDetailsMap")]
public Dictionary<int, ContainerDetails> ContainerDetailsMap { get; set; }

[Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))]
[JsonConverter(typeof(JsonStringEnumConverter))]
[JsonPropertyName("resultCode")]
public ProcessingResultCode ResultCode { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ namespace Microsoft.ComponentDetection.Contracts.BcdeModels;

using System.Collections.Generic;
using System.Text.Json.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;

[JsonObject(MemberSerialization.OptOut, NamingStrategyType = typeof(CamelCaseNamingStrategy))]
public class ScannedComponent
{
[JsonPropertyName("locationsFoundAt")]
Expand All @@ -22,7 +18,7 @@ public class ScannedComponent
[JsonPropertyName("isDevelopmentDependency")]
public bool? IsDevelopmentDependency { get; set; }

[Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))]
[JsonConverter(typeof(JsonStringEnumConverter))]
[JsonPropertyName("dependencyScope")]
public DependencyScope? DependencyScope { get; set; }

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="packageurl-dotnet" />
<PackageReference Include="System.Memory" />
<PackageReference Include="System.Reactive" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,8 @@ namespace Microsoft.ComponentDetection.Contracts.TypedComponent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text.Json.Serialization;
using Microsoft.ComponentDetection.Contracts.BcdeModels;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
using PackageUrl;
using JsonConverterAttribute = Newtonsoft.Json.JsonConverterAttribute;
using JsonIgnoreAttribute = Newtonsoft.Json.JsonIgnoreAttribute;

[JsonObject(MemberSerialization.OptOut, NamingStrategyType = typeof(CamelCaseNamingStrategy))]
[JsonConverter(typeof(TypedComponentConverter))]
[DebuggerDisplay("{DebuggerDisplay,nq}")]
[JsonPolymorphic(TypeDiscriminatorPropertyName = "type")]
[JsonDerivedType(typeof(CargoComponent), typeDiscriminator: nameof(ComponentType.Cargo))]
Expand All @@ -39,8 +31,7 @@ namespace Microsoft.ComponentDetection.Contracts.TypedComponent;
[JsonDerivedType(typeof(VcpkgComponent), typeDiscriminator: nameof(ComponentType.Vcpkg))]
public abstract class TypedComponent
{
[JsonIgnore] // Newtonsoft.Json
[System.Text.Json.Serialization.JsonIgnore] // System.Text.Json
[JsonIgnore]
private string id;

internal TypedComponent()
Expand All @@ -49,21 +40,17 @@ internal TypedComponent()
}

/// <summary>Gets the type of the component, must be well known.</summary>
[JsonConverter(typeof(StringEnumConverter))] // Newtonsoft.Json
[JsonProperty("type", Order = int.MinValue)] // Newtonsoft.Json
[System.Text.Json.Serialization.JsonIgnore] // System.Text.Json - type is handled by [JsonPolymorphic] discriminator
[JsonIgnore] // type is handled by [JsonPolymorphic] discriminator
public abstract ComponentType Type { get; }

/// <summary>Gets the id of the component.</summary>
[JsonProperty("id")] // Newtonsoft.Json
[JsonPropertyName("id")] // System.Text.Json
[JsonPropertyName("id")]
public string Id => this.id ??= this.ComputeId();

[JsonPropertyName("packageUrl")]
public virtual PackageURL PackageUrl { get; }

[JsonIgnore] // Newtonsoft.Json
[System.Text.Json.Serialization.JsonIgnore] // System.Text.Json
[JsonIgnore]
internal string DebuggerDisplay => $"{this.Id}";

protected string ValidateRequiredInput(string input, string fieldName, string componentType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<PackageReference Include="SemanticVersioning" />
<PackageReference Include="yamldotnet" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="System.Reactive" />
<PackageReference Include="System.Threading.Tasks.Dataflow" />
<PackageReference Include="Tomlyn.Signed" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<PackageReference Include="DotNet.Glob" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
<PackageReference Include="Microsoft.Extensions.Logging" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="Polly" />
<PackageReference Include="Serilog" />
<PackageReference Include="Serilog.Sinks.Async" />
Expand Down
Loading