Skip to content

Commit 58d9a84

Browse files
committed
Add [JsonPropertyName] attributes to Type and PackageUrl
1 parent 6f4b7aa commit 58d9a84

20 files changed

+36
-5
lines changed

src/Microsoft.ComponentDetection.Contracts/TypedComponent/CargoComponent.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ public CargoComponent(string name, string version, string author = null, string
4444
public string? Source { get; set; }
4545
#nullable disable
4646

47+
[JsonPropertyName("type")]
4748
public override ComponentType Type => ComponentType.Cargo;
4849

50+
[JsonPropertyName("packageUrl")]
4951
public override PackageURL PackageUrl => new PackageURL("cargo", string.Empty, this.Name, this.Version, null, string.Empty);
5052

5153
protected override string ComputeId() => $"{this.Name} {this.Version} - {this.Type}";

src/Microsoft.ComponentDetection.Contracts/TypedComponent/ConanComponent.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ public ConanComponent(string name, string version, string previous, string packa
3434
[JsonPropertyName("packageSourceURL")]
3535
public string PackageSourceURL => $"https://conan.io/center/recipes/{this.Name}?version={this.Version}";
3636

37+
[JsonPropertyName("type")]
3738
public override ComponentType Type => ComponentType.Conan;
3839

40+
[JsonPropertyName("packageUrl")]
3941
public override PackageURL PackageUrl => new PackageURL("conan", string.Empty, this.Name, this.Version, null, string.Empty);
4042

4143
protected override string ComputeId() => $"{this.Name} {this.Version} - {this.Type}";

src/Microsoft.ComponentDetection.Contracts/TypedComponent/CondaComponent.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public CondaComponent()
4646
[JsonPropertyName("mD5")]
4747
public string MD5 { get; set; }
4848

49+
[JsonPropertyName("type")]
4950
public override ComponentType Type => ComponentType.Conda;
5051

5152
protected override string ComputeId() => $"{this.Name} {this.Version} {this.Build} {this.Channel} {this.Subdir} {this.Namespace} {this.Url} {this.MD5} - {this.Type}";

src/Microsoft.ComponentDetection.Contracts/TypedComponent/DockerImageComponent.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public DockerImageComponent(string hash, string name = null, string tag = null)
2626
[JsonPropertyName("tag")]
2727
public string Tag { get; set; }
2828

29+
[JsonPropertyName("type")]
2930
public override ComponentType Type => ComponentType.DockerImage;
3031

3132
protected override string ComputeId() => $"{this.Name} {this.Tag} {this.Digest}";

src/Microsoft.ComponentDetection.Contracts/TypedComponent/DockerReferenceComponent.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public DockerReferenceComponent()
3333
[JsonPropertyName("domain")]
3434
public string Domain { get; set; }
3535

36+
[JsonPropertyName("type")]
3637
public override ComponentType Type => ComponentType.DockerReference;
3738

3839
public DockerReference FullReference

src/Microsoft.ComponentDetection.Contracts/TypedComponent/DotNetComponent.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public DotNetComponent(string sdkVersion, string targetFramework = null, string
4343
[JsonPropertyName("projectType")]
4444
public string ProjectType { get; set; }
4545

46+
[JsonPropertyName("type")]
4647
public override ComponentType Type => ComponentType.DotNet;
4748

4849
/// <summary>

src/Microsoft.ComponentDetection.Contracts/TypedComponent/GitComponent.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public GitComponent()
2929
[JsonPropertyName("tag")]
3030
public string Tag { get; set; }
3131

32+
[JsonPropertyName("type")]
3233
public override ComponentType Type => ComponentType.Git;
3334

3435
protected override string ComputeId() => $"{this.RepositoryUrl} : {this.CommitHash} - {this.Type}";

src/Microsoft.ComponentDetection.Contracts/TypedComponent/GoComponent.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ public GoComponent()
3737

3838
// Commit should be used in place of version when available
3939
// https://github.com/package-url/purl-spec/blame/180c46d266c45aa2bd81a2038af3f78e87bb4a25/README.rst#L610
40+
[JsonPropertyName("packageUrl")]
4041
public override PackageURL PackageUrl => new PackageURL("golang", null, this.Name, string.IsNullOrWhiteSpace(this.Hash) ? this.Version : this.Hash, null, null);
4142

43+
[JsonPropertyName("type")]
4244
public override ComponentType Type => ComponentType.Go;
4345

4446
protected override string ComputeId() => $"{this.Name} {this.Version} - {this.Type}";

src/Microsoft.ComponentDetection.Contracts/TypedComponent/LinuxComponent.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ public LinuxComponent(string distribution, string release, string name, string v
4242
public string? Author { get; set; }
4343
#nullable disable
4444

45+
[JsonPropertyName("type")]
4546
public override ComponentType Type => ComponentType.Linux;
4647

48+
[JsonPropertyName("packageUrl")]
4749
public override PackageURL PackageUrl
4850
{
4951
get

src/Microsoft.ComponentDetection.Contracts/TypedComponent/MavenComponent.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ public MavenComponent()
2727
[JsonPropertyName("version")]
2828
public string Version { get; set; }
2929

30+
[JsonPropertyName("type")]
3031
public override ComponentType Type => ComponentType.Maven;
3132

33+
[JsonPropertyName("packageUrl")]
3234
public override PackageURL PackageUrl => new PackageURL("maven", this.GroupId, this.ArtifactId, this.Version, null, null);
3335

3436
protected override string ComputeId() => $"{this.GroupId} {this.ArtifactId} {this.Version} - {this.Type}";

0 commit comments

Comments
 (0)