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

Syntax error when emitting to JSON from a YAML versioning scheme value #292

Closed
captain-yoshi opened this issue Aug 10, 2022 · 4 comments · Fixed by #299
Closed

Syntax error when emitting to JSON from a YAML versioning scheme value #292

captain-yoshi opened this issue Aug 10, 2022 · 4 comments · Fixed by #299

Comments

@captain-yoshi
Copy link
Contributor

Emitting a JSON file from a YAML with versioning value will give a SyntaxError when parsed in JSON.

YAML

james: 0.0.7

JSON

{"james": 0.0.7}

The versioning conversion to a double should not have passed (just a hypothesis).

@captain-yoshi captain-yoshi changed the title Syntax error when emitting to JSON from a YAML with a versioning scheme Syntax error when emitting to JSON from a YAML versioning scheme value Aug 10, 2022
@captain-yoshi
Copy link
Contributor Author

@jppm I'm getting an unquoted versioning for 1.1.9 when converted to json.

Working versioning:

  • 0.6.1
  • 0.0.0

@biojppm
Copy link
Owner

biojppm commented Sep 12, 2022

That's odd. It succeeds with this:

TEST(emit_json, issue292)
{
    EXPECT_FALSE(csubstr("0.0.0").is_number());
    EXPECT_FALSE(csubstr("0.1.0").is_number());
    EXPECT_FALSE(csubstr("0.6.1").is_number());
    EXPECT_FALSE(csubstr("1.1.9").is_number());
    EXPECT_FALSE(csubstr("1.2.3").is_number());
    Tree t = parse_in_arena("{}");
    t["james"] = "0.0.0";
    EXPECT_EQ(emitrs_json<std::string>(t), "{\"james\": \"0.0.0\"}");
    t["james"] = "0.1.0";
    EXPECT_EQ(emitrs_json<std::string>(t), "{\"james\": \"0.1.0\"}");
    t["james"] = "0.6.1";
    EXPECT_EQ(emitrs_json<std::string>(t), "{\"james\": \"0.6.1\"}");
    t["james"] = "1.1.9";
    EXPECT_EQ(emitrs_json<std::string>(t), "{\"james\": \"1.1.9\"}");
    t["james"] = "1.2.3";
    EXPECT_EQ(emitrs_json<std::string>(t), "{\"james\": \"1.2.3\"}");
}

Are you sure you have the latest version?

@captain-yoshi
Copy link
Contributor Author

captain-yoshi commented Sep 12, 2022

Latest version with rapidyaml. Does fetching rapidyaml through git also fetches the submodules ?

EDIT : sorry you are right, I screwed something with the c4 lib on my end.

@captain-yoshi
Copy link
Contributor Author

captain-yoshi commented Sep 12, 2022

Forgot to update with git submodule update --init --recursive ... I even made a PR to update this command in the docs... Oh well !

This issue was closed.
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 a pull request may close this issue.

2 participants