Skip to content

Conversation

@grisumbras
Copy link
Member

Fix #991

@cppalliance-bot
Copy link

An automated preview of the documentation is available at https://1056.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html

@cppalliance-bot
Copy link

@grisumbras grisumbras force-pushed the feature/direct-struct-extra branch from 0534d31 to ae620ca Compare October 17, 2024 11:08
@cppalliance-bot
Copy link

An automated preview of the documentation is available at https://1056.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html

@cppalliance-bot
Copy link

@grisumbras grisumbras force-pushed the feature/direct-struct-extra branch from ae620ca to a86add9 Compare October 17, 2024 12:25
@cppalliance-bot
Copy link

An automated preview of the documentation is available at https://1056.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html

@codecov
Copy link

codecov bot commented Oct 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.69%. Comparing base (6071cd5) to head (7b16bf7).
Report is 5 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1056      +/-   ##
===========================================
+ Coverage    93.40%   93.69%   +0.29%     
===========================================
  Files           91       91              
  Lines         8658     9138     +480     
===========================================
+ Hits          8087     8562     +475     
- Misses         571      576       +5     
Files with missing lines Coverage Δ
include/boost/json/detail/parse_into.hpp 100.00% <100.00%> (+0.25%) ⬆️
include/boost/json/detail/value_to.hpp 100.00% <100.00%> (ø)

... and 10 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6071cd5...7b16bf7. Read the comment docs.

@grisumbras grisumbras force-pushed the feature/direct-struct-extra branch from a86add9 to 4d76902 Compare October 17, 2024 13:56
@cppalliance-bot
Copy link

An automated preview of the documentation is available at https://1056.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html

@cppalliance-bot
Copy link

@grisumbras grisumbras force-pushed the feature/direct-struct-extra branch 2 times, most recently from 11f8035 to 533a570 Compare October 17, 2024 16:38
@cppalliance-bot
Copy link

An automated preview of the documentation is available at https://1056.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html

1 similar comment
@cppalliance-bot
Copy link

An automated preview of the documentation is available at https://1056.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html

@cppalliance-bot
Copy link

@cppalliance-bot
Copy link

An automated preview of the documentation is available at https://1056.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html

@cppalliance-bot
Copy link

@grisumbras grisumbras force-pushed the feature/direct-struct-extra branch 2 times, most recently from 2b758cc to 7038f99 Compare October 22, 2024 13:25
@cppalliance-bot
Copy link

An automated preview of the documentation is available at https://1056.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html

@cppalliance-bot
Copy link

@grisumbras grisumbras force-pushed the feature/direct-struct-extra branch from 7038f99 to 82ac926 Compare October 23, 2024 12:40
@cppalliance-bot
Copy link

An automated preview of the documentation is available at https://1056.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html

@cppalliance-bot
Copy link

@grisumbras grisumbras force-pushed the feature/direct-struct-extra branch from 82ac926 to 7b16bf7 Compare October 23, 2024 19:59
@cppalliance-bot
Copy link

An automated preview of the documentation is available at https://1056.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html

@cppalliance-bot
Copy link

@grisumbras grisumbras merged commit 7b16bf7 into boostorg:develop Oct 24, 2024
4 checks passed
@grisumbras grisumbras deleted the feature/direct-struct-extra branch October 24, 2024 12:52
--array_depth_;

if( (array_depth_ + object_depth_) == 0 )
return parent_->signal_end(ec);
Copy link
Contributor

@freitass freitass Dec 4, 2025

Choose a reason for hiding this comment

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

@grisumbras I believe there's a bug in this code. Consider the following scenario:

struct X
{
    int a;
    float b;
    std::string c;
};

BOOST_DESCRIBE_STRUCT(X, (), (a, b, c))

struct W
{
    X x;
};

BOOST_DESCRIBE_STRUCT(W, (), (x))

// ...

const auto json = R"(
{
    "x": {
        "unknown": [],
        "a": 1,
        "b": 3.14,
        "c": "hello"
    }
})";

W w{};
std::error_code ec;
parse_into(w, json, ec);

BOOST_TEST( !ec );               // Ok.
BOOST_TEST( w.x.a == 1 );        // Error: w.x.a is 0
BOOST_TEST( w.x.b == 3.14f );     // Error: w.x.b is 0.0
BOOST_TEST( w.x.c == "hello" );  // Error: w.x.c is ""

Changing this line to signal_value seems to fix the issue:

Suggested change
return parent_->signal_end(ec);
return parent_->signal_value(ec);

Please confirm if that was intentional as I might be missing some other scenario. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

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.

Allow unknown described class members with a parse option

3 participants