Skip to content

Implement ConfigurationJsonParsingStrategy#634

Merged
castler merged 3 commits into
eclipse-score:mainfrom
etas-contrib:feature/implement_ConfigurationJsonParsingStrategy
Jul 17, 2026
Merged

Implement ConfigurationJsonParsingStrategy#634
castler merged 3 commits into
eclipse-score:mainfrom
etas-contrib:feature/implement_ConfigurationJsonParsingStrategy

Conversation

@Thomas-Mikhael

@Thomas-Mikhael Thomas-Mikhael commented Jul 2, 2026

Copy link
Copy Markdown
Contributor
  • Define IConfigurationParsingStrategy interface
  • Extract JSON parsing into ConfigurationJsonParsingStrategy
  • Move tests into configuration_json_parsing_strategy_test.cpp
  • Keep config_parser lib as a wrapper (for backward compatibility)

@Thomas-Mikhael
Thomas-Mikhael force-pushed the feature/implement_ConfigurationJsonParsingStrategy branch from 52e85dc to 80fe517 Compare July 14, 2026 13:31
@Thomas-Mikhael
Thomas-Mikhael marked this pull request as ready for review July 14, 2026 14:22

@castler castler 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.

What would help to review this PR way more easy is todo the changes in a different way.

Meaning, instead of copying the code from one file to the other, to move the file into another file name (move config_parser -> configuration_json_parsing_strategy) in one commit and then perform the necessary changes on top of the file in another commit.

This should IMHO also reduce the changed lines significantly

IConfigurationParsingStrategy& operator=(const IConfigurationParsingStrategy&) = default;
IConfigurationParsingStrategy& operator=(IConfigurationParsingStrategy&&) noexcept = default;

public:

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.

We normally try to group the same visibilities together

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

// See Note 1
// coverity[autosar_cpp14_a15_5_3_violation]
auto ParseServiceTypeDeployment(const score::json::Object& json_map) -> ServiceTypeDeployment
auto Parse(const std::string_view path) -> Configuration

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.

Parse will and shall not alter the state of the strategy, thus we shall mark it as const

}
}
return ServiceTypeDeployment{score::cpp::blank{}};
ConfigurationJsonParsingStrategy strategy;

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.

We generally try to always use {}-initialization, just to be on the safe side.

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

@Thomas-Mikhael
Thomas-Mikhael force-pushed the feature/implement_ConfigurationJsonParsingStrategy branch from e77a26e to 61e0b3f Compare July 16, 2026 11:52
@Thomas-Mikhael
Thomas-Mikhael force-pushed the feature/implement_ConfigurationJsonParsingStrategy branch 2 times, most recently from 5860927 to eea0ec0 Compare July 16, 2026 12:52
@Thomas-Mikhael

Thomas-Mikhael commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

What would help to review this PR way more easy is todo the changes in a different way.

Meaning, instead of copying the code from one file to the other, to move the file into another file name (move config_parser -> configuration_json_parsing_strategy) in one commit and then perform the necessary changes on top of the file in another commit.

This should IMHO also reduce the changed lines significantly

As much annoying it's, I did rename many times, but still in the full PR view it doesn't recognize that.
You can see that only if you check single commits view (I separated it in committing):

  • Define IConfigurationParsingStrategy interface:
    d1b6ae9
  • rename config_parser to configuration_json_parsing_strategy:
    983b414
  • Wrapper config_parser:
    70b51f9

@Thomas-Mikhael
Thomas-Mikhael requested a review from castler July 16, 2026 12:57
@Thomas-Mikhael
Thomas-Mikhael force-pushed the feature/implement_ConfigurationJsonParsingStrategy branch from b36dd6c to 91d01a1 Compare July 16, 2026 13:15
@Thomas-Mikhael
Thomas-Mikhael force-pushed the feature/implement_ConfigurationJsonParsingStrategy branch from 11b2040 to 70b51f9 Compare July 16, 2026 13:39

@castler castler 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.

Thanks for working on this - I will accept the PR, but just for future references:

1st) It would be nice to try to format the code in the right commit (and not change formatting in one commit and revert that in another)
2nd) More descriptive commit messages would be great. It will help us to generate better release notes, it will help others to understand why this commit was done, and it will help debugging in the future. For example one could write:

Wrap `ConfigurationParserStrategy` in free functions for ABI stability

With this commit we work towards our refactoring to enable configuration
from JSON and Flatbuffers. In a previous commit we move the JSON configuration
into a strategy, and in this commit we restore the previous API by a wrapper, that adds
no additional logic otherwise. This wrapper will be used in future to decide, if JSON or Flatbuffers configuration parsing shall be used.

Don't get me wrong - I also don't do this always - and often its just very short - but that would help a lot :)

}
} // namespace
} // namespace score::mw::com::impl
} // namespace score::mw::com::impl No newline at end of file

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.

its quite interesting to see that always the last line of the file is removed - I thought these kind of changes should be covered by our clang-format....

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.

"should be covered by our clang-format"
You mean during pushing as an adhoc in Github? or you mean locally?

{
RecordProperty("Description",
"Checks that the free Parse(path) function delegates to ConfigurationJsonParsingStrategy.");
RecordProperty("TestType", "Requirements-based 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.

you do not link any requirement here?

@castler
castler added this pull request to the merge queue Jul 17, 2026
@Thomas-Mikhael

Copy link
Copy Markdown
Contributor Author

1st) It would be nice to try to format the code in the right commit (and not change formatting in one commit and revert that in another) 2nd) More descriptive commit messages would be great. It will help us to generate better release notes, it will help others to understand why this commit was done, and it will help debugging in the future.

I agree with you.
Noted down! :)

Merged via the queue into eclipse-score:main with commit 6129813 Jul 17, 2026
8 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in COM - Communication FT Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants