Skip to content

Commit

Permalink
fix: AccessMode such that it is optional (#358)
Browse files Browse the repository at this point in the history
Signed-off-by: andreas hilti <69210561+andreas-hilti@users.noreply.github.com>
  • Loading branch information
andreas-hilti authored Sep 15, 2024
1 parent 1ab1cc2 commit 97fe22d
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 15 deletions.
21 changes: 18 additions & 3 deletions src/CycloneDX.Core/Models/Workspace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,25 @@ public enum AccessModeType
public ResourceReferenceChoices ResourceReferences { get; set; }
public bool ShouldSerializeResourceReferences() { return ResourceReferences?.Count > 0; }

[XmlElement("accessMode")]
[XmlIgnore]
[ProtoMember(8)]
public AccessModeType AccessMode { get; set; }

public AccessModeType? AccessMode { get; set; }

[XmlElement("accessMode")]
[JsonIgnore]
public AccessModeType NonNullableAccessMode
{
get
{
return AccessMode.Value;
}
set
{
AccessMode = value;
}
}
public bool ShouldSerializeNonNullableAccessMode() { return AccessMode.HasValue; }

[XmlElement("mountPath")]
[ProtoMember(9)]
public string MountPath { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@
{
"bom-ref": "workspace-1",
"uid": "workspace-uid-1",
"name": "workspace",
"accessMode": "read-only"
"name": "workspace"
}
],
"runtimeTopology": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@
{
"bom-ref": "workspace-1",
"uid": "workspace-uid-1",
"name": "workspace",
"accessMode": "read-only"
"name": "workspace"
}
],
"runtimeTopology": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@
{
"bom-ref": "workspace-1",
"uid": "workspace-uid-1",
"name": "workspace",
"accessMode": "read-only"
"name": "workspace"
}
],
"runtimeTopology": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@
{
"bom-ref": "workspace-1",
"uid": "workspace-uid-1",
"name": "workspace",
"accessMode": "read-only"
"name": "workspace"
}
],
"runtimeTopology": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
<workspace bom-ref="workspace-1">
<uid>workspace-uid-1</uid>
<name>workspace</name>
<accessMode>read-only</accessMode>
</workspace>
</workspaces>
<runtimeTopology>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
<workspace bom-ref="workspace-1">
<uid>workspace-uid-1</uid>
<name>workspace</name>
<accessMode>read-only</accessMode>
</workspace>
</workspaces>
<runtimeTopology>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
<workspace bom-ref="workspace-1">
<uid>workspace-uid-1</uid>
<name>workspace</name>
<accessMode>read-only</accessMode>
</workspace>
</workspaces>
<runtimeTopology>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
<workspace bom-ref="workspace-1">
<uid>workspace-uid-1</uid>
<name>workspace</name>
<accessMode>read-only</accessMode>
</workspace>
</workspaces>
<runtimeTopology>
Expand Down

0 comments on commit 97fe22d

Please sign in to comment.