Skip to content

Commit

Permalink
Fixes same key for ref and name #1354 (#1359)
Browse files Browse the repository at this point in the history
  • Loading branch information
BernieWhite authored Nov 25, 2022
1 parent 7743ef2 commit 0962948
Show file tree
Hide file tree
Showing 7 changed files with 233 additions and 230 deletions.
2 changes: 2 additions & 0 deletions docs/CHANGELOG-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ What's changed since pre-release v2.7.0-B0006:
- Bug fixes:
- Fixed job summary directory creation by @BernieWhite.
[#1353](https://github.com/microsoft/PSRule/issues/1353)
- Fixed same key for ref and name by @BernieWhite
[#1354](https://github.com/microsoft/PSRule/issues/1354)

## v2.7.0-B0006 (pre-release)

Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Definitions/DependencyTargetCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public bool TryAdd(T target)

// Add Id, Ref, and aliases to the index.
_Index.Add(target.Id, new TargetLink(target, ResourceIdKind.Id));
if (target.Ref.HasValue)
if (target.Ref.HasValue && target.Id != target.Ref.Value)
_Index.Add(target.Ref.Value, new TargetLink(target, ResourceIdKind.Ref));

for (var i = 0; target.Alias != null && i < target.Alias.Length; i++)
Expand Down
52 changes: 26 additions & 26 deletions tests/PSRule.Tests/FromFile.Json.schema.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Unit test schema",
"description": "A schema for PSRule YAML options files.",
"oneOf": [
{
"$ref": "#/definitions/structure"
}
],
"definitions": {
"structure": {
"type": "object",
"properties": {
"Name": {
"type": "string",
"enum": [
"TestObject1"
]
},
"Type": {
"type": "string"
}
},
"required": [
"Type",
"Name"
]
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Unit test schema",
"description": "A schema for PSRule YAML options files.",
"oneOf": [
{
"$ref": "#/definitions/structure"
}
],
"definitions": {
"structure": {
"type": "object",
"properties": {
"Name": {
"type": "string",
"enum": [
"TestObject1"
]
},
"Type": {
"type": "string"
}
},
"required": [
"Type",
"Name"
]
}
}
}
Loading

0 comments on commit 0962948

Please sign in to comment.