8000 Refactor v2_1 messages by AnlangA · Pull Request #167 · codelabsab/rust-ocpp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Refactor v2_1 messages #167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 99 commits into
base: main
Choose a base branch
from
Open

Conversation

AnlangA
Copy link
Contributor
@AnlangA AnlangA commented May 27, 2025

I refactored the messages in v2_1, corrected some errors in it, including encoding format and numerical limits, etc. I also added functions

Copy link
codecov bot commented May 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.36%. Comparing base (bc60955) to head (211399d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #167      +/-   ##
==========================================
+ Coverage   93.99%   96.36%   +2.36%     
==========================================
  Files         189      271      +82     
  Lines       31464    58584   +27120     
==========================================
+ Hits        29576    56457   +26881     
- Misses       1888     2127     +239     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tommymalmqvist
Copy link
Member

I refactored the messages in v2_1, corrected some errors in it, including encoding format and numerical limits, etc. I also added functions

Hello @AnlangA, thanks! Not sure why codecov is failing. Will have to check that first.

@tommymalmqvist tommymalmqvist requested a review from Copilot May 31, 2025 05:22
Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors v2_1 messages by updating multiple enumeration definitions to include enhanced documentation and unified serialization behavior.

  • Added documentation and serde attributes across enumeration variants for consistency.
  • Added new enumeration variants and modules to support additional message types.

Reviewed Changes

Copilot reviewed 113 out of 113 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/v2_1/enumerations/vpn.rs Added documentation and applied camelCase renaming for VPN protocol variants.
src/v2_1/enumerations/upload_log_status.rs Updated to include default variant and camelCase renaming for upload status.
src/v2_1/enumerations/update_firmware_status.rs Added new firmware update status variants with clear documentation.
src/v2_1/enumerations/update.rs Refined update types with descriptive documentation and serialization formatting.
src/v2_1/enumerations/unpublish_firmware_status.rs Improved documentation and serialization for unpublishing firmware status.
src/v2_1/enumerations/unlock_status.rs Enhanced documentation and standardized enum variant naming for unlock status.
src/v2_1/enumerations/trigger_reason.rs Extended trigger reason enum with detailed variant descriptions.
src/v2_1/enumerations/transaction_event.rs Updated transaction event types with additional documentation and renaming.
src/v2_1/enumerations/tariff_cost.rs Applied camelCase renaming and added documentation for tariff cost variants.
src/v2_1/enumerations/tariff_clear_status.rs Enhanced documentation with camelCase renaming for tariff clear status.
src/v2_1/enumerations/tariff_change_status.rs Updated tariff change status with consistent serialization formatting.
src/v2_1/enumerations/set_variable_status.rs Improved documentation and variant naming for set variable status.
src/v2_1/enumerations/set_network_profile_status.rs Added descriptive comments and camelCase renaming for network profile status.
src/v2_1/enumerations/set_monitoring_status.rs Refined monitoring status enum with updated documentation and renaming.
src/v2_1/enumerations/send_local_list_status.rs Extended local list status enum with clear documentation and valid serialization.
src/v2_1/enumerations/reset_status.rs Updated reset status without Default derivation, differing from most enumerations.
src/v2_1/enumerations/reset.rs Added new reset type variant and improved documentation with serialization attributes.
src/v2_1/enumerations/reservation_update_status.rs Standardized reservation update status with camelCase renaming and clear docs.
src/v2_1/enumerations/mod.rs Updated module exports to include new enumerations, maintaining consistent naming.
src/v2_1/enumerations/data_enum.rs Minor reordering of serde import, aligning with updated style in other files.
Comments suppressed due to low confidence (1)

src/v2_1/enumerations/reset_status.rs:4

  • [nitpick] Consider deriving Default for ResetStatusEnumType for consistency with other enumerations, unless the omission is intentional.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]

AnlangA added 26 commits June 4, 2025 07:50
- Introduced PeriodicEventStreamParamsType to encapsulate parameters for the periodic event stream.
- Added nested validation for custom_data and params fields in AdjustPeriodicEventStreamRequest.
- Removed redundant PeriodicEventStreamParamsType struct definition from the file to streamline the code.
- Reorder imports alphabetically for consistency
- Split long use statements into multiple lines for better readability
- Standardize import formatting across all message modules
- Update mod.rs with improved multi-line use statements

This change improves code maintainability and follows Rust formatting conventions.
… display message, variable monitoring, and cost updated messages
AnlangA added 29 commits June 4, 2025 07:50
Tests cover serialization, validation, builder patterns, setter methods,
and all enum variants for both TriggerMessageRequest and
TriggerMessageResponse structs.
Extends test coverage for authorize, clear_charging_profile,
clear_display_message, clear_variable_monitoring, and cost_updated
message types with setter method validation, method chaining
verification, optional field clearing, edge case handling, and
partial JSON deserialization tests.
Tests cover builder pattern usage, method chaining with other fields,
and setter/getter methods including clearing tariff values.
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.

2 participants
0