Skip to content
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

$copy support was lost by PR #350 #369

Open
james-ball-qualcomm opened this issue Dec 20, 2024 · 3 comments
Open

$copy support was lost by PR #350 #369

james-ball-qualcomm opened this issue Dec 20, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@james-ball-qualcomm
Copy link
Collaborator

If you generate MC100 in the main branch, you'll see this problem. I also have a regression test for it (test_yaml_loader.rb tests) in my branch.

image

Here's the test:

def test_copy_in_the_same_document
yaml = <<~YAML
$defs:
target1: A string
target2:
a: hash
target3: Another string

  obj1:
    target10: abc
    target11:
      $copy: "#/$defs/target1"
    target12: def
    target13:
      $copy: "#/$defs/target3"

YAML

doc = resolve_yaml(yaml)
assert_equal({
    "$child_of" => "#/$defs",
    "target10"  => "abc",
    "target11"  => "A string",
    "target12"  => "def",
    "target13"  => "Another string"
  }, doc["obj1"])

end

XXX

def test_copy_in_the_different_document
yaml2 = <<~YAML
$defs:
target1: A string
target2:
a: hash
target3: Another string
YAML

yaml1 = <<~YAML
  obj1:
    target10: abc
    target11:
      $copy: "YAML2_REL_PATH#/$defs/target1"
    target12: def
    target13:
      $copy: "YAML2_REL_PATH#/$defs/target3"
YAML

doc = resolve_multi_yaml(yaml1, yaml2)
assert_equal({
    "$child_of" => "test/test2.yaml#/$defs",
    "target10"  => "abc",
    "target11"  => "A string",
    "target12"  => "def",
    "target13"  => "Another string"
  }, doc["obj1"])

end

@james-ball-qualcomm james-ball-qualcomm added the bug Something isn't working label Dec 20, 2024
@dhower-qc
Copy link
Collaborator

Do we still need this? The one use case (MIE/MIP description) disappears if we go with community-driven prose + string-matched ratified text.

@james-ball-qualcomm
Copy link
Collaborator Author

I'd like to wait to see how that Community Driven prose plus string match ratified text actually looks before we decide this isn't needed.

@james-ball-qualcomm
Copy link
Collaborator Author

Also it was pretty easy to add support for this in the previous yaml loader code and the python version looks pretty similar so I assume adding it we'll also be easy. Also will probably start having more use cases that take advantage of $copy. The mip/mie was just the first I found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants