Skip to content

json parser: collapse the parser indirection into a single JsonParser implementation - #677

Merged
fbaeuerle merged 6 commits into
eclipse-score:mainfrom
Nikhil2206:nk-json-634
Oct 28, 2026
Merged

fbaeuerle merged 6 commits into
eclipse-score:mainfrom
Nikhil2206:nk-json-634

Conversation

@Nikhil2206

Copy link
Copy Markdown
Contributor

Closes #634

JsonParser::FromFile and FromBuffer are now defined in json_parser.cpp, next to the class they belong to.

  • The vaJson tree builder (VajsonParser) is no longer a public class in score::json. It is a file-local class (AnyTreeBuilder) in json_parser.cpp.
  • The vajson_parser library and its header and source, and the //score/json/internal/parser:parser alias, are removed. json_parser_impl links the vaJson reader directly.
  • The vaJson parser tests call JsonParser instead of the removed class.
  • The class diagram and the coverage scope list are updated accordingly.

Structural change only: the public API (IJsonParser, JsonParser, operator""_json) and the parsing behavior are unchanged. The parser logic is moved as is, including the coverage and Coverity annotations.

Tests: all //score/json/... tests pass, with the same test counts for the vaJson parser suites (27 and 16).

@github-project-automation github-project-automation Bot moved this to In Progress in BAS - Baselibs FT Oct 13, 2026
@github-actions github-actions Bot added comp-json Related to score/json component c++ C++ code bazel Bazel and Starlark build files labels Oct 13, 2026
Comment thread score/json/json_parser.cpp Fixed
Comment thread score/json/json_parser.cpp Fixed
Comment thread score/json/json_parser.cpp Fixed
Comment thread score/json/json_parser.cpp Fixed
Comment thread score/json/json_parser.cpp Fixed
Comment thread score/json/json_parser.cpp Fixed
Comment thread score/json/json_parser.cpp Fixed
Comment thread score/json/json_parser.cpp Fixed
@github-actions

Copy link
Copy Markdown
Contributor

Documentation preview for this pull request is available at:
pr-677: https://eclipse-score.github.io/baselibs/pr-677/

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Migrated tests retain obsolete requirement metadata, and the moved class members violate the documented member-comment convention.

4 open findings
What changed in this PR

Consolidates vaJson parsing into JsonParser, removing the redundant parser layer while preserving the public API.

Changes:

  • Moves tree-building and parsing into json_parser.cpp.
  • Removes VajsonParser, its target, and parser alias.
  • Updates tests, dependencies, coverage scope, and architecture documentation.
File Description
tools/​coverage/​BUILD Removes the obsolete coverage root.
score/​json/​json_parser.cpp Adds the internal tree builder and parser implementation.
score/​json/​internal/​parser/​vajson/​vajson_parser.h Removes the redundant parser class.
score/​json/​internal/​parser/​vajson/​vajson_parser.cpp Removes the former implementation layer.
score/​json/​internal/​parser/​vajson/​vajson_parser_test.cpp Migrates parser tests to JsonParser.
score/​json/​internal/​parser/​vajson/​unit_test/​BUILD Updates implementation-test dependencies.
score/​json/​internal/​parser/​vajson/​number_parser_test.cpp Migrates typed parsing tests.
score/​json/​internal/​parser/​vajson/​BUILD Removes the parser library and updates tests.
score/​json/​internal/​parser/​BUILD Removes the parser alias.
score/​json/​detailed_design/​class_diagram.puml Documents the consolidated design.
score/​json/​BUILD Links the vaJson implementation directly.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread score/json/json_parser.cpp Resolved
Comment thread score/json/internal/parser/vajson/BUILD Outdated
)

cc_test(
name = "vajson_parser_test",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it feels like tests target was left behind while parser was moved

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

Comment thread score/json/BUILD Outdated
":parser_interface",
"@score_baselibs//score/json/internal/parser",
"@score_baselibs//score/json/internal/model",
"@score_baselibs//score/json/internal/parser/vajson/vajson_impl",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

could this be moved to implementation_deps? generally all internal details should be handled that way.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done. The internal model, vajson and result deps of json_parser_impl are now in implementation_deps, so they are no longer exposed to consumers.

Comment thread score/json/json_parser.cpp Outdated

#include "score/json/json_parser.h"

#include "score/json/internal/parser/vajson/vajson_impl/reader.h"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

couldn't we flatten the directory structure a bit more?
vajson/vajson_impl seems redundant.

@Nikhil2206 Nikhil2206 Oct 26, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have tried. vajson_impl is gone. reader/ and util/ now sit directly under vajson/, and the includes are updated to match\

…der internal

JsonParser::FromFile and FromBuffer are now defined in json_parser.cpp
next to the class. The vaJson tree builder is a file-local class of
json_parser.cpp instead of the public VajsonParser, and the
vajson_parser library and the parser alias are removed.
The public API and behavior are unchanged.
Address review feedback on eclipse-score#677.

The vaJson tree builder moved into `json_parser.cpp`, but its two test
targets stayed in `internal/parser/vajson/`. They exercise `JsonParser`
and use the shared test suites from `internal/parser/`, so they now live
next to them, alongside `json_parser_test`.

`internal/parser/vajson/BUILD` held only these two targets and is removed.

Test sources and target names are unchanged.
Address review feedback on eclipse-score#677.

With the vaJson tree builder gone from `internal/parser/vajson/`, the
`vajson_impl` subdirectory only repeated the name of its parent. The vaJson
reader sources now sit directly in `internal/parser/vajson/`, and the library
target is named after its directory: `//score/json/internal/parser/vajson`.

All changes are renames plus rewritten include paths and BUILD labels. No
source logic changes.
Address review feedback on eclipse-score#677.

`json_parser_impl` has no public headers of its own. `json_parser.h` comes
from `:parser_interface`, which stays in `deps`. The model, vaJson reader and
result targets are only included from `json_parser.cpp`, so they move to
`implementation_deps` and no longer leak into the dependency graph of
consumers of `:json`.

No source changes.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The previously reported requirement-link mismatch in the hexadecimal test remains an unresolved verification-traceability concern.

No open issues 🎉

4 resolved since last review

Review effort: Balanced

This branch was previously deployed

1 inactive deployment
workflow-approval — eb5f5ca0 Deployed Oct 27, 2026 by Nikhil2206 via Build and Test score-qnx-aarch64 / approval #2517
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bazel Bazel and Starlark build files c++ C++ code comp-json Related to score/json component

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

json parser: collapse the parser indirection into a single JsonParser implementation

5 participants