Better JSON macros
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Refactor
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- cpp
- Domain
- backend-api-design
Research direction
The issue does not name any files, tests, or entry points. Start by locating the current JSON macro declarations and their serialization and deserialization implementations, then compare the optional-field behavior and compile-time complexity described here. Done would require an agreed redesign and corresponding implementation and tests, but the scope is not specified.
Written by the indexing model from the issue text.
Description
There's a few issues with our current JSON macros:
- Forces conflation of serialisation and deserialisation. A field is either required (always present in serialisations, must be present to deserialise), or optional (may be omitted when serialising, allowed to be missing when deserialising). This misses the behaviour we'd actually like for most new fields added to existing types, which is that they are always serialised to new JSON objects, but may be missing from old JSON objects. This in turn leads to the confusing interplay between
std::optionalwrappers andOPTIONALmacro declarations. - Repetition of optionality. To add an optional field to a type which previously only had required fields, you must add a
DECLARE_JSON_OPTIONAL_FIELDSline and also change the original declaration fromDECLARE_JSON_TYPEtoDECLARE_JSON_TYPE_WITH_OPTIONAL_FIELDS. This is a complex, non-obvious change, and is a hard-to-debug runtime weirdness if you forget the latter. - Compile-time complexity. The implementation of these macros combines overloaded ADL dispatched functions and some template specializations, producing a large amount of code for the compiler to churn through.
- Maintenance complexity. I barely understand it, and I wrote it. Adding new features is tricky, and likely to increase the matrix of initial declaration macros.
I think we can and should do better on all of these. These are primarily issues for framework developers rather than application developers, so not an immediate priority, but they are exposed for application developers to use so their API must be correctly exposed.
- Dominant language
- C++
- Stars
- 874
- Forks
- 263
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 157
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/CCF
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
microsoft/CCF#8184 · 1 comment ·
Maintainers usually reply within 1 day
-
Encrypt private ledger data directly into serialised entriesPossibly taken @achamayou claimed this 7 days ago. Opencrypto enhancement performance
Difficulty 5/5 Over a week Newbie friendliness 42/100
microsoft/CCF#8169 · 1 reaction · 2 assignees ·
Maintainers usually reply within 1 day
-
Hybrid (classical crypto + PQ) TLS in CCFMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
Maintainers usually reply within 1 day
Similar issues
-
[request] vsg/1.1.16Openupstream update
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
conan-io/conan-center-index#31142 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
NVIDIA/DeepStream#78 ·