RDKEMW-20911 : Fix intent type as object and not string#92
Open
swethasukumarr wants to merge 1 commit into
Open
RDKEMW-20911 : Fix intent type as object and not string#92swethasukumarr wants to merge 1 commit into
swethasukumarr wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Actions “intent” payload contract to treat the intent field as a JSON object (rather than a string), aligning tests and the OpenRPC spec with the updated wire format.
Changes:
- Updated unit/component tests to validate
intentas an object with nested fields (action,context.source). - Updated OpenRPC schema for
Actions.intentandActions.onIntentsointentis typed as anobject(and constrainedintentIdto be non-negative). - Refreshed generated JSON type documentation comments to reflect the new payload shape.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| test/unit/actionsTest.cpp | Adjusts unit test expectations to parse intent as an object and verify nested fields. |
| test/component/actionsGeneratedTest.cpp | Updates component tests + event trigger payload to match the new intent object shape. |
| src/json_types/actions.h | Updates the documentation comment describing the Actions intent wire format. |
| docs/openrpc/the-spec/firebolt-open-rpc.json | Changes the OpenRPC schema/examples to declare intent as an object and enforce intentId >= 0. |
| EXPECT_TRUE(parsed.at("intent").is_object()); | ||
| EXPECT_EQ(parsed.at("intent").at("action").get<std::string>(), "pre-load"); | ||
| EXPECT_EQ(parsed.at("intent").at("context").at("source").get<std::string>(), "system"); | ||
| EXPECT_EQ(parsed.at("intentId").get<unsigned>(), 0u); |
| EXPECT_TRUE(parsed.at("intent").is_object()); | ||
| EXPECT_EQ(parsed.at("intent").at("action").get<std::string>(), "pre-load"); | ||
| EXPECT_EQ(parsed.at("intent").at("context").at("source").get<std::string>(), "system"); | ||
| EXPECT_EQ(parsed.at("intentId").get<unsigned>(), 0u); |
| EXPECT_TRUE(parsed.at("intent").is_object()); | ||
| EXPECT_EQ(parsed.at("intent").at("action").get<std::string>(), "pre-load"); | ||
| EXPECT_EQ(parsed.at("intent").at("context").at("source").get<std::string>(), "system"); | ||
| EXPECT_EQ(parsed.at("intentId").get<unsigned>(), 0u); |
Comment on lines
73
to
76
| "properties": { | ||
| "intent": { "type": "string" }, | ||
| "intentId": { "type": "integer" } | ||
| "intent": { "type": "object" }, | ||
| "intentId": { "type": "integer", "minimum": 0 } | ||
| } |
Comment on lines
119
to
122
| "properties": { | ||
| "intent": { "type": "string" }, | ||
| "intentId": { "type": "integer" } | ||
| "intent": { "type": "object" }, | ||
| "intentId": { "type": "integer", "minimum": 0 } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.