Skip to content

Clean up structured attrs parsing using JSON utils#14754

Merged
Ericson2314 merged 2 commits intomasterfrom
structured-attrs-cleanup
Jan 16, 2026
Merged

Clean up structured attrs parsing using JSON utils#14754
Ericson2314 merged 2 commits intomasterfrom
structured-attrs-cleanup

Conversation

@Ericson2314
Copy link
Member

Motivation

Shorter, easier to read

Context

Pulled out of #14750


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@Ericson2314 Ericson2314 requested a review from edolstra as a code owner December 9, 2025 17:43
res.insert(parseRef(s));
return res;
} catch (Error & e) {
e.addTrace({}, "while parsing attribute 'outputChecks.\"%s\".%s'", outputName, name);
Copy link
Member Author

Choose a reason for hiding this comment

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

So we don't use context versus old throw

for (auto & [outputName, output] : getObject(*udr))
res.insert_or_assign(outputName, getBoolean(output));
} catch (Error & e) {
e.addTrace({}, "while parsing attribute 'unsafeDiscardReferences'");
Copy link
Member Author

@Ericson2314 Ericson2314 Dec 9, 2025

Choose a reason for hiding this comment

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

So we don't loose context versus old throw

@Ericson2314 Ericson2314 force-pushed the structured-attrs-cleanup branch 2 times, most recently from 4218962 to e912e1b Compare December 9, 2025 18:03
Comment on lines +78 to +79
template<typename T>
static inline std::optional<T> ptrToOwned(const nlohmann::json * ptr)
Copy link
Member Author

Choose a reason for hiding this comment

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

moving it to the right namespace

@Ericson2314 Ericson2314 force-pushed the structured-attrs-cleanup branch from e912e1b to 04d073f Compare January 13, 2026 19:03
@Ericson2314 Ericson2314 force-pushed the structured-attrs-cleanup branch from 04d073f to eb653e5 Compare January 16, 2026 19:56
@Ericson2314 Ericson2314 added this pull request to the merge queue Jan 16, 2026
Merged via the queue into master with commit 1e1d9f2 Jan 16, 2026
18 checks passed
@Ericson2314 Ericson2314 deleted the structured-attrs-cleanup branch January 16, 2026 22:58
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.

3 participants