Skip to content

Conversation

@dhower-qc
Copy link
Collaborator

fixes #246

Copy link
Collaborator

@james-ball-qualcomm james-ball-qualcomm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do I only see changes to one certificate_model? Shouldn't this change require all the certificate arch files (models & classes) and profile arch files (releases & classes) to be changed?

Copy link
Collaborator

@james-ball-qualcomm james-ball-qualcomm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The examples in arch/README.adoc need to be updated.

Copy link
Collaborator

@james-ball-qualcomm james-ball-qualcomm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you rename MockCertificateModel to MockCertificateModel100? I don't want to hold up merging this into main but I am curious why the change (and somewhat concerned).

@james-ball-qualcomm james-ball-qualcomm merged commit 1ffe6d8 into main Nov 16, 2024
4 checks passed
@james-ball-qualcomm james-ball-qualcomm deleted the schema_change branch November 16, 2024 00:21
@james-ball-qualcomm
Copy link
Collaborator

I'm going to restore the original name of MockCertificateModel.

Also, I noticed that there is no Profile schema and the Profile Release and Profile Class haven't been updated yet. Is that on your list to change relatively soon?

@james-ball-qualcomm
Copy link
Collaborator

What happened to these tests in test_yaml_loader.rb? Why were they removed? Were they renamed or moved somewhere else?

def test_refs_in_the_same_document
yaml = <<~YAML
$defs:
target1: A string
target2:
a: hash

  obj1:
    $ref: "#/$defs/target2"

  obj2:
    $ref: "#/$defs/target2"
    target2: Should disappear

  obj3:
    target2: Should disappear
    $ref: "#/$defs/target2"

YAML

f = Tempfile.new("yml")
f.write(yaml)
f.flush

doc = YamlLoader.load(f.path)
assert_equal({ "a" => "hash" }, doc["obj1"])
assert_equal({ "a" => "hash" }, doc["obj2"])
assert_equal({ "a" => "hash" }, doc["obj3"])

end

def test_refs_in_the_different_document
yaml1 = <<~YAML
$defs:
target1: A string
target2:
a: hash
YAML

f1 = Tempfile.new("yml")
f1.write(yaml1)
f1.flush
f1_path = Pathname.new(f1.path)

yaml2 = <<~YAML
  obj1:
    $ref: "#{f1_path.basename}#/$defs/target2"

  obj2:
    $ref: "#{f1_path.basename}#/$defs/target2"
    target2: Should disappear

  obj3:
    target2: Should disappear
    $ref: "#{f1_path.basename}#/$defs/target2"
YAML

f2 = Tempfile.new("yml")
f2.write(yaml2)
f2.flush

doc = YamlLoader.load(f2.path)
assert_equal({ "a" => "hash" }, doc["obj1"])
assert_equal({ "a" => "hash" }, doc["obj2"])
assert_equal({ "a" => "hash" }, doc["obj3"])

end

@dhower-qc
Copy link
Collaborator Author

We aren't expanding $ref any more; just $inherits.

@james-ball-qualcomm
Copy link
Collaborator

Thanks. Can you explain how $ref works now vs. before? Also, do we still need all the code for $ref in yaml_loader.rb?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make name and kind explicit in objects

3 participants