Skip to content

Commit 9302c3f

Browse files
authored
Mark deprecated fields with deprecated option in protobuf (#269)
This PR adds the protobuf `deprecated` option to properly mark deprecated fields and message types in the dispatch API schema. ## Changes Made 1. **CategorySet message**: Added `option deprecated = true;` to mark the entire message type as deprecated 2. **component_categories field**: Added `[deprecated = true]` to mark the field as deprecated 3. **Release Notes**: Updated RELEASE_NOTES.md to document the deprecation changes ## Before ```proto // Deprecated: Use `CategoryTypeSet` instead message CategorySet { // Set of component categories repeated frequenz.api.common.v1alpha8.microgrid.electrical_components .ElectricalComponentCategory categories = 1; } // Deprecated: Component categories // Use `CategoryTypeSet` instead // In future versions, this field will be removed. CategorySet component_categories = 2; ``` ## After ```proto // Deprecated: Use `CategoryTypeSet` instead message CategorySet { option deprecated = true; // Set of component categories repeated frequenz.api.common.v1alpha8.microgrid.electrical_components .ElectricalComponentCategory categories = 1; } // Deprecated: Component categories // Use `CategoryTypeSet` instead // In future versions, this field will be removed. CategorySet component_categories = 2 [deprecated = true]; ``` ## Benefits - **Clear deprecation signaling**: Code generators will now properly mark these elements as deprecated in generated client libraries - **Developer warnings**: Developers using these deprecated fields will receive appropriate deprecation warnings - **API clarity**: Makes the deprecation status explicit in the protobuf schema itself, not just in comments - **Future-proof**: Prepares for eventual removal of these deprecated elements The changes follow the official protobuf specification for marking deprecated elements and maintain full backward compatibility while providing clear deprecation signals to API consumers. Fixes #252. <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/frequenz-floss/frequenz-api-dispatch/issues/new?title=✨Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo.
2 parents 5b8a884 + 5782cf6 commit 9302c3f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

RELEASE_NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
## Upgrading
1616

17+
- The `CategorySet` message and `component_categories` field in `TargetComponents` are now properly marked as deprecated in the protobuf schema using the `deprecated` option. Code generators will now emit deprecation warnings when these deprecated elements are used. Use `CategoryTypeSet` and `component_categories_types` instead.
18+
1719
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
1820

1921
## New Features

proto/frequenz/api/dispatch/v1/dispatch.proto

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ message TargetComponents {
391391

392392
// Deprecated: Use `CategoryTypeSet` instead
393393
message CategorySet {
394+
option deprecated = true;
394395
// Set of component categories
395396
repeated frequenz.api.common.v1alpha8.microgrid.electrical_components
396397
.ElectricalComponentCategory categories = 1;
@@ -437,7 +438,7 @@ message TargetComponents {
437438
// Deprecated: Component categories
438439
// Use `CategoryTypeSet` instead
439440
// In future versions, this field will be removed.
440-
CategorySet component_categories = 2;
441+
CategorySet component_categories = 2 [deprecated = true];
441442

442443
// Component categories with optional types
443444
CategoryTypeSet component_categories_types = 3;

0 commit comments

Comments
 (0)