|
2 | 2 | A2UI_SCHEMA = """ |
3 | 3 | { |
4 | 4 | "title": "A2UI Message Schema", |
5 | | - "description": "Describes a JSON payload for an A2UI message, which is used to dynamically construct and update user interfaces. A message MUST contain exactly ONE of the action properties: 'beginRendering', 'surfaceUpdate', 'dataModelUpdate', or 'surfaceDeletion'.", |
| 5 | + "description": "Describes a JSON payload for an A2UI message, which is used to dynamically construct and update user interfaces. A message MUST contain exactly ONE of the action properties: 'beginRendering', 'surfaceUpdate', 'dataModelUpdate', or 'deleteSurface'.", |
6 | 6 | "type": "object", |
7 | 7 | "properties": { |
8 | 8 | "beginRendering": { |
|
25 | 25 | "type": "string", |
26 | 26 | "description": "The primary font for the UI." |
27 | 27 | }, |
28 | | - "logoUrl": { |
29 | | - "type": "string", |
30 | | - "description": "A URL for the logo image." |
31 | | - }, |
32 | 28 | "primaryColor": { |
33 | 29 | "type": "string", |
34 | 30 | "description": "The primary UI color as a hexadecimal code (e.g., '#00BFFF').", |
|
641 | 637 | "description": "An array of data entries. Each entry must contain a 'key' and exactly one corresponding typed 'value*' property.", |
642 | 638 | "items": { |
643 | 639 | "type": "object", |
644 | | - "description": "A single data entry. Exactly one 'value_' property should be provided alongside the key.", |
| 640 | + "description": "A single data entry. Exactly one 'value*' property should be provided alongside the key.", |
645 | 641 | "properties": { |
646 | 642 | "key": { |
647 | 643 | "type": "string", |
648 | 644 | "description": "The key for this data entry." |
649 | 645 | }, |
650 | 646 | "valueString": { |
651 | | - "type": "string", |
652 | | - "description": "A string value." |
| 647 | + "type": "string" |
653 | 648 | }, |
654 | 649 | "valueNumber": { |
655 | | - "type": "number", |
656 | | - "description": "A number value." |
| 650 | + "type": "number" |
657 | 651 | }, |
658 | 652 | "valueBoolean": { |
659 | | - "type": "boolean", |
660 | | - "description": "A boolean value." |
| 653 | + "type": "boolean" |
| 654 | + }, |
| 655 | + "valueList": { |
| 656 | + "type": "array", |
| 657 | + "items": { |
| 658 | + "type": "object", |
| 659 | + "properties": { |
| 660 | + "valueString": { |
| 661 | + "type": "string" |
| 662 | + }, |
| 663 | + "valueNumber": { |
| 664 | + "type": "number" |
| 665 | + }, |
| 666 | + "valueBoolean": { |
| 667 | + "type": "boolean" |
| 668 | + } |
| 669 | + } |
| 670 | + } |
661 | 671 | } |
662 | 672 | }, |
663 | 673 | "required": ["key"] |
|
684 | 694 | RESTAURANT_UI_EXAMPLES = """ |
685 | 695 | ---BEGIN SINGLE_COLUMN_LIST_EXAMPLE--- |
686 | 696 | [ |
687 | | - {{ "beginRendering": {{ "surfaceId": "default", "root": "root-column", "styles": {{ "primaryColor": "#FF0000", "font": "Roboto", "logoUrl": "{base_url}/static/logo.png" }} }} }}, |
| 697 | + {{ "beginRendering": {{ "surfaceId": "default", "root": "root-column", "styles": {{ "primaryColor": "#FF0000", "font": "Roboto" }} }} }}, |
688 | 698 | {{ "surfaceUpdate": {{ |
689 | 699 | "surfaceId": "default", |
690 | 700 | "components": [ |
|
699 | 709 | {{ "id": "template-rating", "componentProperties": {{ "Text": {{ "text": {{ "path": "rating" }} }} }} }}, |
700 | 710 | {{ "id": "template-detail", "componentProperties": {{ "Text": {{ "text": {{ "path": "detail" }} }} }} }}, |
701 | 711 | {{ "id": "template-link", "componentProperties": {{ "Text": {{ "text": {{ "path": "infoLink" }} }} }} }}, |
702 | | - {{ "id": "template-book-button", "componentProperties": {{ "Button": {{ "label": {{ "literalString": "Book Now" }}, "action": {{ "action": "book_restaurant", "context": [ {{ "key": "restaurantName", "value": {{ "path": "name" }} }}, {{ "key": "imageUrl", "value": {{ "path": "imageUrl" }} }}, {{ "key": "address", "value": {{ "path": "address" }} }} ] }} }} }} }} |
| 712 | + {{ "id": "template-book-button", "componentProperties": {{ "Button": {{ "child": "book-now-text", "action": {{ "name": "book_restaurant", "context": [ {{ "key": "restaurantName", "value": {{ "path": "name" }} }}, {{ "key": "imageUrl", "value": {{ "path": "imageUrl" }} }}, {{ "key": "address", "value": {{ "path": "address" }} }} ] }} }} }} }}, |
| 713 | + {{ "id": "book-now-text", "componentProperties": {{ "Text": {{ "text": {{ "literalString": "Book Now" }} }} }} }} |
703 | 714 | ] |
704 | 715 | }} }}, |
705 | 716 | {{ "dataModelUpdate": {{ |
|
714 | 725 |
|
715 | 726 | ---BEGIN TWO_COLUMN_LIST_EXAMPLE--- |
716 | 727 | [ |
717 | | - {{ "beginRendering": {{ "surfaceId": "default", "root": "root-column", "styles": {{ "primaryColor": "#FF0000", "font": "Roboto", "logoUrl": "{base_url}/static/logo.png" }} }} }}, |
| 728 | + {{ "beginRendering": {{ "surfaceId": "default", "root": "root-column", "styles": {{ "primaryColor": "#FF0000", "font": "Roboto" }} }} }}, |
718 | 729 | {{ "surfaceUpdate": {{ |
719 | 730 | "surfaceId": "default", |
720 | 731 | "components": [ |
|
729 | 740 | {{ "id": "template-rating-1", "componentProperties": {{ "Text": {{ "text": {{ "path": "/items/0/rating" }} }} }} }}, |
730 | 741 | {{ "id": "template-detail-1", "componentProperties": {{ "Text": {{ "text": {{ "path": "/items/0/detail" }} }} }} }}, |
731 | 742 | {{ "id": "template-link-1", "componentProperties": {{ "Text": {{ "text": {{ "path": "/items/0/infoLink" }} }} }} }}, |
732 | | - {{ "id": "template-book-button-1", "componentProperties": {{ "Button": {{ "label": {{ "literalString": "Book Now" }}, "action": {{ "action": "book_restaurant", "context": [ {{ "key": "restaurantName", "value": {{ "path": "/items/0/name" }} }}, {{ "key": "imageUrl", "value": {{ "path": "/items/0/imageUrl" }} }}, {{ "key": "address", "value": {{ "path": "/items/0/address" }} }} ] }} }} }} }}, |
| 743 | + {{ "id": "template-book-button-1", "componentProperties": {{ "Button": {{ "child": "book-now-text-1", "action": {{ "name": "book_restaurant", "context": [ {{ "key": "restaurantName", "value": {{ "path": "/items/0/name" }} }}, {{ "key": "imageUrl", "value": {{ "path": "/items/0/imageUrl" }} }}, {{ "key": "address", "value": {{ "path": "/items/0/address" }} }} ] }} }} }} }}, |
| 744 | + {{ "id": "book-now-text-1", "componentProperties": {{ "Text": {{ "text": {{ "literalString": "Book Now" }} }} }} }}, |
733 | 745 | {{ "id": "item-card-2", "weight": 1, "componentProperties": {{ "Card": {{ "child": "card-layout-2" }} }} }}, |
734 | 746 | {{ "id": "card-layout-2", "componentProperties": {{ "Column": {{ "children": {{ "explicitList": ["template-image-2", "card-details-2"] }} }} }} }}, |
735 | 747 | {{ "id": "template-image-2", "componentProperties": {{ "Image": {{ "url": {{ "path": "/items/1/imageUrl" }}, "width": "100%" }} }} }}, |
|
738 | 750 | {{ "id": "template-rating-2", "componentProperties": {{ "Text": {{ "text": {{ "path": "/items/1/rating" }} }} }} }}, |
739 | 751 | {{ "id": "template-detail-2", "componentProperties": {{ "Text": {{ "text": {{ "path": "/items/1/detail" }} }} }} }}, |
740 | 752 | {{ "id": "template-link-2", "componentProperties": {{ "Text": {{ "text": {{ "path": "/items/1/infoLink" }} }} }} }}, |
741 | | - {{ "id": "template-book-button-2", "componentProperties": {{ "Button": {{ "label": {{ "literalString": "Book Now" }}, "action": {{ "action": "book_restaurant", "context": [ {{ "key": "restaurantName", "value": {{ "path": "/items/1/name" }} }}, {{ "key": "imageUrl", "value": {{ "path": "/items/1/imageUrl" }} }}, {{ "key": "address", "value": {{ "path": "/items/1/address" }} }} ] }} }} }} }} |
| 753 | + {{ "id": "template-book-button-2", "componentProperties": {{ "Button": {{ "child": "book-now-text-2", "action": {{ "name": "book_restaurant", "context": [ {{ "key": "restaurantName", "value": {{ "path": "/items/1/name" }} }}, {{ "key": "imageUrl", "value": {{ "path": "/items/1/imageUrl" }} }}, {{ "key": "address", "value": {{ "path": "/items/1/address" }} }} ] }} }} }} }}, |
| 754 | + {{ "id": "book-now-text-2", "componentProperties": {{ "Text": {{ "text": {{ "literalString": "Book Now" }} }} }} }} |
742 | 755 | ] |
743 | 756 | }} }}, |
744 | 757 | {{ "dataModelUpdate": {{ |
|
753 | 766 |
|
754 | 767 | ---BEGIN BOOKING_FORM_EXAMPLE--- |
755 | 768 | [ |
756 | | - {{ "beginRendering": {{ "surfaceId": "booking-form", "root": "booking-form-column", "styles": {{ "primaryColor": "#FF0000", "font": "Roboto", "logoUrl": "{base_url}/static/logo.png" }} }} }}, |
| 769 | + {{ "beginRendering": {{ "surfaceId": "booking-form", "root": "booking-form-column", "styles": {{ "primaryColor": "#FF0000", "font": "Roboto" }} }} }}, |
757 | 770 | {{ "surfaceUpdate": {{ |
758 | 771 | "surfaceId": "booking-form", |
759 | 772 | "components": [ |
|
764 | 777 | {{ "id": "party-size-field", "componentProperties": {{ "TextField": {{ "label": {{ "literalString": "Party Size" }}, "text": {{ "path": "partySize" }}, "type": "number" }} }} }}, |
765 | 778 | {{ "id": "datetime-field", "componentProperties": {{ "DateTimeInput": {{ "label": {{ "literalString": "Date & Time" }}, "value": {{ "path": "reservationTime" }}, "enableDate": true, "enableTime": true }} }} }}, |
766 | 779 | {{ "id": "dietary-field", "componentProperties": {{ "TextField": {{ "label": {{ "literalString": "Dietary Requirements" }}, "text": {{ "path": "dietary" }} }} }} }}, |
767 | | - {{ "id": "submit-button", "componentProperties": {{ "Button": {{ "label": {{ "literalString": "Submit Reservation" }}, "action": {{ "action": "submit_booking", "context": [ {{ "key": "restaurantName", "value": {{ "path": "restaurantName" }} }}, {{ "key": "partySize", "value": {{ "path": "partySize" }} }}, {{ "key": "reservationTime", "value": {{ "path": "reservationTime" }} }}, {{ "key": "dietary", "value": {{ "path": "dietary" }} }}, {{ "key": "imageUrl", "value": {{ "path": "imageUrl" }} }} ] }} }} }} }} |
| 780 | + {{ "id": "submit-button", "componentProperties": {{ "Button": {{ "child": "submit-reservation-text", "action": {{ "name": "submit_booking", "context": [ {{ "key": "restaurantName", "value": {{ "path": "restaurantName" }} }}, {{ "key": "partySize", "value": {{ "path": "partySize" }} }}, {{ "key": "reservationTime", "value": {{ "path": "reservationTime" }} }}, {{ "key": "dietary", "value": {{ "path": "dietary" }} }}, {{ "key": "imageUrl", "value": {{ "path": "imageUrl" }} }} ] }} }} }} }}, |
| 781 | + {{ "id": "submit-reservation-text", "componentProperties": {{ "Text": {{ "text": {{ "literalString": "Submit Reservation" }} }} }} }} |
768 | 782 | ] |
769 | 783 | }} }}, |
770 | 784 | {{ "dataModelUpdate": {{ |
|
785 | 799 |
|
786 | 800 | ---BEGIN CONFIRMATION_EXAMPLE--- |
787 | 801 | [ |
788 | | - {{ "beginRendering": {{ "surfaceId": "confirmation", "root": "confirmation-card", "styles": {{ "primaryColor": "#FF0000", "font": "Roboto", "logoUrl": "{base_url}/static/logo.png" }} }} }}, |
| 802 | + {{ "beginRendering": {{ "surfaceId": "confirmation", "root": "confirmation-card", "styles": {{ "primaryColor": "#FF0000", "font": "Roboto" }} }} }}, |
789 | 803 | {{ "surfaceUpdate": {{ |
790 | 804 | "surfaceId": "confirmation", |
791 | 805 | "components": [ |
|
0 commit comments