-
Notifications
You must be signed in to change notification settings - Fork 143
fix: match A2uiMessage.a2uiMessageSchema to v0.9 schema #833
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
juan-vgv
wants to merge
1
commit into
flutter:main
Choose a base branch
from
juan-vgv:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -398,6 +398,11 @@ abstract final class A2uiSchemas { | |
|
|
||
| /// Schema for a createSurface message. | ||
| static Schema createSurfaceSchema() => S.object( | ||
| description: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wow, this will likely improve inference performance! |
||
| 'Signals the client to create a new surface and begin rendering it. ' | ||
| "When this message is sent, the client will expect 'updateComponents' " | ||
| "and/or 'updateDataModel' messages for the same surfaceId that define " | ||
| 'the component tree.', | ||
| properties: { | ||
| surfaceIdKey: S.string(description: 'The unique ID for the surface.'), | ||
| 'catalogId': S.string(description: 'The URI of the component catalog.'), | ||
|
|
@@ -414,12 +419,21 @@ abstract final class A2uiSchemas { | |
|
|
||
| /// Schema for a deleteSurface message. | ||
| static Schema deleteSurfaceSchema() => S.object( | ||
| description: | ||
| "Signals the client to delete the surface identified by 'surfaceId'. " | ||
| 'The createSurface message MUST have been previously sent with the ' | ||
| "'catalogId' that is in this message.", | ||
| properties: {surfaceIdKey: S.string()}, | ||
| required: [surfaceIdKey], | ||
| ); | ||
|
|
||
| /// Schema for a updateDataModel message. | ||
| static Schema updateDataModelSchema() => S.object( | ||
| description: | ||
| 'Updates the data model for an existing surface. This message can be ' | ||
| 'sent multiple times to update the data model. The createSurface ' | ||
| "message MUST have been previously sent with the 'catalogId' that is " | ||
| 'in this message.', | ||
| properties: { | ||
| surfaceIdKey: S.string(), | ||
| 'path': S.combined(type: JsonType.string, defaultValue: '/'), | ||
|
|
@@ -445,6 +459,13 @@ abstract final class A2uiSchemas { | |
| .toList(); | ||
|
|
||
| return S.object( | ||
| description: | ||
| 'Updates a surface with a new set of components. This message can ' | ||
| 'be sent multiple times to update the component tree of an existing ' | ||
| 'surface. One of the components in one of the components lists MUST ' | ||
| "have an 'id' of 'root' to serve as the root of the component tree. " | ||
| 'The createSurface message MUST have been previously sent with the ' | ||
| "'catalogId' that is in this message.", | ||
| properties: { | ||
| surfaceIdKey: S.string( | ||
| description: 'The unique identifier for the UI surface.', | ||
|
|
||
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To improve maintainability and reduce code duplication, you could extract the creation of each message variant into a local helper function. This would make the
oneOflist cleaner and easier to read.