-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API changes to support SPDX 3.0 #924
Open
pragnya17
wants to merge
14
commits into
main
Choose a base branch
from
ppandrate_Spdx30ApiChanges
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,925
−787
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e0d9061
update UT to use spdx 3.0 generator
414a3fb
generator api changes + restructuring classes
3e4fd88
merge conflict
bbdd751
wokring generator api changes with UT
9010c31
working UT for compliance standard
0c6c7a3
parsing deduplication
b5a943e
generator deduplication + add context
c462e85
merge conflict
886040a
remove from public docs until release
da1a30f
clean up changes + update interface pins
06ef615
update spdxmetadata - including this breaking change since this PR ha…
0116139
fix unit tests
a12527f
Refactor constants
2c3d594
Clean up and refactor code, address PR comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/Microsoft.Sbom.Api/Config/Validators/ManifestInfoValidator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
using Microsoft.Sbom.Api.Utils; | ||
using Microsoft.Sbom.Common.Config.Attributes; | ||
using Microsoft.Sbom.Common.Config.Validators; | ||
using Microsoft.Sbom.Constants; | ||
using Microsoft.Sbom.Extensions.Entities; | ||
using PowerArgs; | ||
|
||
namespace Microsoft.Sbom.Api.Config.Validators; | ||
|
||
/// <summary> | ||
/// Validates if manifest info is valid. | ||
/// </summary> | ||
public class ManifestInfoValidator : ConfigValidator | ||
{ | ||
public ManifestInfoValidator(IAssemblyConfig assemblyConfig) | ||
: base(typeof(ValidUriAttribute), assemblyConfig) | ||
{ | ||
} | ||
|
||
public ManifestInfoValidator(Type supportedAttribute, IAssemblyConfig assemblyConfig) | ||
: base(supportedAttribute, assemblyConfig) | ||
{ | ||
} | ||
|
||
public override void ValidateInternal(string paramName, object paramValue, Attribute attribute) | ||
{ | ||
if (paramValue is not null && !SpdxConstants.SupportedSpdxManifests.Contains(paramValue as ManifestInfo)) | ||
{ | ||
throw new ValidationArgException($"The value of {paramName} must be a valid ManifestInfo. Supported SPDX versions include 2.2 and 3.0."); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System.Collections.Generic; | ||
using System.Text.Json; | ||
using Microsoft.Sbom.Api.Entities; | ||
using Microsoft.Sbom.Extensions; | ||
|
||
namespace Microsoft.Sbom.Api.Workflows.Helpers; | ||
|
||
/// <summary> | ||
/// Result from GenerateAsync | ||
/// </summary> | ||
public class GenerationResult | ||
{ | ||
public List<FileValidationResult> Errors { get; set; } | ||
|
||
public Dictionary<IManifestToolJsonSerializer, List<JsonDocument>> SerializerToJsonDocuments { get; set; } | ||
|
||
public GenerationResult(List<FileValidationResult> errors, Dictionary<IManifestToolJsonSerializer, List<JsonDocument>> serializerToJsonDocuments) | ||
{ | ||
Errors = errors; | ||
SerializerToJsonDocuments = serializerToJsonDocuments; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably we can only match 1 config--should we break out of the loop after the first match?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure if the customer was allowed to pass in multiple manifests. Seems like the conclusion is that there is only matching manifest based on your comment and what I've seen in the rest of the code, so I'll add a break statement after a successful match