Skip to content

Commit

Permalink
fix(demo): Various fixes related to schema validation (#963)
Browse files Browse the repository at this point in the history
Fix various issues related to schema validation, in particular due to
our set up with 11ty:
- Front matter ending up in generated XML files - this happens with
files that were both destined to be served from their own endpoints but
also included from other templates. To solve this, I created
intermediate files for those that need to be served, and remove the
front matter for those that are just included.
- I've also updated the list of files in .eleventyignore to be explicit
- this list represents all the templates that are meant to be included
but should not be served as endpoints (hence not generated as static XML
files). In the future, we will segregate private and public files to
avoid the need to define this list.

Also in this PR:
- remove exclusions from the XML validation command - now most generated
templates are validated (the templates related to the share
functionality, which uses an instawork namespace, is still ignored for
now, it will be ported to a custom behavior in a future PR)
- change the custom bottom bar component namepace prefix from
instawork.com to hyperview.org
- fix a few templates that would produce invalid XML
- fix a few schema definitions that were incorrect

---------

Co-authored-by: flochtililoch <[email protected]>
  • Loading branch information
flochtililoch and flochtililoch authored Oct 15, 2024
1 parent 574ff4b commit 68067f6
Show file tree
Hide file tree
Showing 42 changed files with 262 additions and 98 deletions.
198 changes: 191 additions & 7 deletions demo/.eleventyignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,191 @@
backend/**/styles.xml.njk
backend/**/style.xml.njk
backend/**/rating.xml.njk
backend/**/compliment.xml.njk
backend/**/user.xml.njk
backend/**/select-multiple-content.xml.njk
backend/**/tab.xml.njk
backend/ui/styling/shadows/radius/index.xml.njk
backend/ui/styling/shadows/offset/index.xml.njk
backend/ui/styling/shadows/shadow-color/index.xml.njk
backend/ui/styling/shadows/regular/index.xml.njk
backend/ui/styling/button/shadow/index.xml.njk
backend/ui/styling/button/shadow/styles.xml.njk
backend/ui/styling/button/disabled/index.xml.njk
backend/ui/styling/button/disabled/styles.xml.njk
backend/ui/styling/button/regular/index.xml.njk
backend/ui/styling/button/regular/styles.xml.njk
backend/ui/styling/elevation/elevation-10/index.xml.njk
backend/ui/styling/elevation/elevation-10/styles.xml.njk
backend/ui/styling/elevation/elevation-3/index.xml.njk
backend/ui/styling/elevation/elevation-3/styles.xml.njk
backend/ui/styling/flex/flex-horizontal-justify-end/index.xml.njk
backend/ui/styling/flex/flex-vertical-justify-center-align-end/index.xml.njk
backend/ui/styling/flex/flex-horizontal-justify-center-align-center/index.xml.njk
backend/ui/styling/flex/flex-horizontal/index.xml.njk
backend/ui/styling/flex/flex-vertical/index.xml.njk
backend/ui/styling/flex/flex-horizontal-justify-center/index.xml.njk
backend/ui/styling/flex/flex-horizontal-justify-center-align-end/index.xml.njk
backend/ui/styling/flex/flex-vertical-justify-center/index.xml.njk
backend/ui/styling/flex/flex-vertical-justify-center-align-center/index.xml.njk
backend/ui/styling/flex/flex-vertical-justify-end/index.xml.njk
backend/ui/ui-elements/forms/date-field/label-format/index.xml.njk
backend/ui/ui-elements/forms/date-field/validation-error/index.xml.njk
backend/ui/ui-elements/forms/date-field/default/index.xml.njk
backend/ui/ui-elements/forms/date-field/spinner/index.xml.njk
backend/ui/ui-elements/forms/date-field/filled/index.xml.njk
backend/ui/ui-elements/forms/date-field/min-date/index.xml.njk
backend/ui/ui-elements/forms/date-field/max-date/index.xml.njk
backend/ui/ui-elements/forms/date-field/customized/index.xml.njk
backend/ui/ui-elements/forms/date-field/min-max-date/index.xml.njk
backend/ui/ui-elements/forms/date-field/animations/index.xml.njk
backend/ui/ui-elements/forms/date-field/filled-validation-error/index.xml.njk
backend/ui/ui-elements/forms/index.xml.njk
backend/ui/ui-elements/forms/picker/de-selectable/index.xml.njk
backend/ui/ui-elements/forms/picker/validation-error/index.xml.njk
backend/ui/ui-elements/forms/picker/default/index.xml.njk
backend/ui/ui-elements/forms/picker/filled/index.xml.njk
backend/ui/ui-elements/forms/picker/customized/index.xml.njk
backend/ui/ui-elements/forms/picker/animations/index.xml.njk
backend/ui/ui-elements/forms/picker/filled-validation-error/index.xml.njk
backend/ui/ui-elements/forms/select-multiple/pre-select/index.xml.njk
backend/ui/ui-elements/forms/select-multiple/simple-select/index.xml.njk
backend/ui/ui-elements/forms/select-multiple/custom/index.xml.njk
backend/ui/ui-elements/forms/select-multiple/unselected.png.njk
backend/ui/ui-elements/forms/select-single/pre-select/index.xml.njk
backend/ui/ui-elements/forms/select-single/optional-select/index.xml.njk
backend/ui/ui-elements/forms/select-single/simple-select/index.xml.njk
backend/ui/ui-elements/forms/select-single/custom/index.xml.njk
backend/ui/ui-elements/forms/select-single/unselected.png.njk
backend/ui/ui-elements/forms/switch/styled/index.xml.njk
backend/ui/ui-elements/forms/switch/on/index.xml.njk
backend/ui/ui-elements/forms/switch/off/index.xml.njk
backend/ui/ui-elements/section-list/index.xml.njk
backend/ui/ui-elements/image/image.jpg.njk
backend/ui/ui-elements/list/scroll-view/dismiss-keyboard/index.xml.njk
backend/ui/ui-elements/list/scroll-view/horizontal/index.xml.njk
backend/ui/ui-elements/list/scroll-view/vertical-hidden-scroll/index.xml.njk
backend/ui/ui-elements/list/scroll-view/horizontal-hidden-scroll/index.xml.njk
backend/ui/ui-elements/list/scroll-view/vertical-sticky-header/index.xml.njk
backend/ui/ui-elements/list/scroll-view/vertical/index.xml.njk
backend/ui/ui-elements/list/index.xml.njk
backend/ui/ui-elements/web-view/index.xml.njk
backend/ui/ui-elements/text/index.xml.njk
backend/advanced/case-studies/feedback-widget/styles.xml.njk
backend/advanced/case-studies/feedback-widget/compliment.xml.njk
backend/advanced/case-studies/advanced-forms/location/index.xml.njk
backend/advanced/case-studies/advanced-forms/styles.xml.njk
backend/advanced/case-studies/advanced-forms/food/index.xml.njk
backend/advanced/case-studies/advanced-forms/parking/index.xml.njk
backend/advanced/case-studies/cascader/styles.xml.njk
backend/advanced/case-studies/basic-forms/styles.xml.njk
backend/advanced/case-studies/photos/comments.xml.njk
backend/advanced/case-studies/photos/user/styles.xml.njk
backend/advanced/case-studies/photos/styles.xml.njk
backend/advanced/case-studies/photos/section-1/index.xml.njk
backend/advanced/case-studies/photos/section-1/user.xml.njk
backend/advanced/case-studies/photos/avatars/riker.jpg.njk
backend/advanced/case-studies/photos/avatars/geordi.jpg.njk
backend/advanced/case-studies/photos/avatars/worf.jpg.njk
backend/advanced/case-studies/photos/photos/coffee.jpeg.njk
backend/advanced/case-studies/photos/photos/feet.jpeg.njk
backend/advanced/case-studies/photos/photos/water.jpeg.njk
backend/advanced/case-studies/photos/photos/concert.jpeg.njk
backend/advanced/case-studies/photos/photos/inspiration1.jpeg.njk
backend/advanced/case-studies/photos/photos/dinner.jpeg.njk
backend/advanced/case-studies/photos/photos/salad.jpg.njk
backend/advanced/case-studies/photos/photos/sign.jpeg.njk
backend/advanced/case-studies/photos/section-3/index.xml.njk
backend/advanced/case-studies/photos/section-4/index.xml.njk
backend/advanced/case-studies/photos/section-5/index.xml.njk
backend/advanced/case-studies/photos/section-2/index.xml.njk
backend/advanced/case-studies/business-rating/styles.xml.njk
backend/advanced/case-studies/business-rating/[email protected]
backend/advanced/case-studies/business-rating/star_empty.png.njk
backend/advanced/case-studies/business-rating/[email protected]
backend/advanced/case-studies/business-rating/rating-modal/styles.xml.njk
backend/advanced/case-studies/business-rating/rating-modal/rating.xml.njk
backend/advanced/case-studies/business-rating/image.jpg.njk
backend/navigation/actions/close/close-previous-screen/index.xml.njk
backend/navigation/actions/close/close-query-params/index.xml.njk
backend/navigation/actions/close/close-different-screen/index.xml.njk
backend/navigation/actions/close/close-loading/index.xml.njk
backend/navigation/actions/back/different-screen/index.xml.njk
backend/navigation/actions/back/loading/index.xml.njk
backend/navigation/actions/back/previous-screen/index.xml.njk
backend/behaviors/advanced/scroll/section-list/section-list-content.xml.njk
backend/behaviors/advanced/scroll/list/list-content.xml.njk
backend/behaviors/advanced/set-value/date-field/index.xml.njk
backend/behaviors/advanced/set-value/set-indicator/index.xml.njk
backend/behaviors/advanced/set-value/picker-field/index.xml.njk
backend/behaviors/advanced/set-value/select-single/index.xml.njk
backend/behaviors/advanced/set-value/text-area/index.xml.njk
backend/behaviors/advanced/set-value/set-delay/index.xml.njk
backend/behaviors/advanced/set-value/clear/index.xml.njk
backend/behaviors/advanced/set-value/clear-indicator/index.xml.njk
backend/behaviors/advanced/set-value/switch/index.xml.njk
backend/behaviors/advanced/set-value/text-field/index.xml.njk
backend/behaviors/advanced/set-value/set/index.xml.njk
backend/behaviors/advanced/set-value/clear-delay/index.xml.njk
backend/behaviors/advanced/share/message-url/index.xml.njk
backend/behaviors/advanced/share/all/index.xml.njk
backend/behaviors/advanced/share/message/index.xml.njk
backend/behaviors/advanced/share/url/index.xml.njk
backend/behaviors/basic/fragments/fragment-replace/visible/index.xml.njk
backend/behaviors/basic/fragments/fragment-replace/hidden/index.xml.njk
backend/behaviors/basic/triggers/long-press/long-press-link/index.xml.njk
backend/behaviors/basic/triggers/long-press/long-press-button/index.xml.njk
backend/behaviors/basic/triggers/change/date-field/index.xml.njk
backend/behaviors/basic/triggers/change/picker-field/index.xml.njk
backend/behaviors/basic/triggers/change/text-area/index.xml.njk
backend/behaviors/basic/triggers/change/switch/index.xml.njk
backend/behaviors/basic/triggers/change/text-field/index.xml.njk
backend/behaviors/basic/triggers/press/button/index.xml.njk
backend/behaviors/basic/triggers/press/link/index.xml.njk
backend/behaviors/basic/triggers/deselect/deselect-multiple/index.xml.njk
backend/behaviors/basic/triggers/deselect/deselect-single/index.xml.njk
backend/behaviors/basic/triggers/press-out/button-press-out/index.xml.njk
backend/behaviors/basic/triggers/press-out/link/index.xml.njk
backend/behaviors/basic/triggers/focus/date-field/index.xml.njk
backend/behaviors/basic/triggers/focus/picker-field/index.xml.njk
backend/behaviors/basic/triggers/focus/text-area/index.xml.njk
backend/behaviors/basic/triggers/focus/text-field/index.xml.njk
backend/behaviors/basic/triggers/press-in/button-press-in/index.xml.njk
backend/behaviors/basic/triggers/press-in/link/index.xml.njk
backend/behaviors/basic/triggers/load/press/index.xml.njk
backend/behaviors/basic/triggers/load/on-load/index.xml.njk
backend/behaviors/basic/triggers/load/on-load/styles.xml.njk
backend/behaviors/basic/triggers/blur/date-field/index.xml.njk
backend/behaviors/basic/triggers/blur/picker-field/index.xml.njk
backend/behaviors/basic/triggers/blur/text-area/index.xml.njk
backend/behaviors/basic/triggers/blur/text-field/index.xml.njk
backend/behaviors/basic/triggers/select/multiple/index.xml.njk
backend/behaviors/basic/triggers/select/single/index.xml.njk
backend/behaviors/basic/indicators/shimmer-indicator/image.jpg.njk
backend/behaviors/basic/actions/select-all/indicator/index.xml.njk
backend/behaviors/basic/actions/select-all/tap/index.xml.njk
backend/behaviors/basic/actions/select-all/delay/index.xml.njk
backend/behaviors/basic/actions/unselect-all/indicator/index.xml.njk
backend/behaviors/basic/actions/unselect-all/single-select/index.xml.njk
backend/behaviors/basic/actions/unselect-all/tap/index.xml.njk
backend/behaviors/basic/actions/unselect-all/select-multiple-content.xml.njk
backend/behaviors/basic/actions/unselect-all/delay/index.xml.njk
backend/behaviors/basic/actions/append/once/index.xml.njk
backend/behaviors/basic/actions/append/once/styles.xml.njk
backend/behaviors/basic/actions/append/nested/index.xml.njk
backend/behaviors/basic/actions/append/nested/styles.xml.njk
backend/behaviors/basic/actions/show/indicator/index.xml.njk
backend/behaviors/basic/actions/show/multiple/index.xml.njk
backend/behaviors/basic/actions/show/tap/index.xml.njk
backend/behaviors/basic/actions/show/delay/index.xml.njk
backend/behaviors/basic/actions/prepend/prepend-nested/index.xml.njk
backend/behaviors/basic/actions/prepend/prepend-nested/styles.xml.njk
backend/behaviors/basic/actions/prepend/prepend-once/index.xml.njk
backend/behaviors/basic/actions/prepend/prepend-once/styles.xml.njk
backend/behaviors/basic/actions/hide/indicator/index.xml.njk
backend/behaviors/basic/actions/hide/multiple/index.xml.njk
backend/behaviors/basic/actions/hide/tap/index.xml.njk
backend/behaviors/basic/actions/hide/delay/index.xml.njk
backend/behaviors/basic/actions/toggle/multiple/index.xml.njk
backend/behaviors/basic/actions/toggle/spinner/index.xml.njk
backend/behaviors/basic/actions/toggle/spinner/styles.xml.njk
backend/behaviors/basic/actions/toggle/tap/index.xml.njk
backend/behaviors/basic/actions/toggle/tap/styles.xml.njk
backend/behaviors/basic/actions/toggle/delay/index.xml.njk
backend/behaviors/basic/actions/replace-inner/once/index.xml.njk
backend/behaviors/basic/actions/replace-inner/nested/index.xml.njk
backend/behaviors/basic/actions/replace/once/index.xml.njk
backend/behaviors/basic/actions/replace/twice/index.xml.njk
2 changes: 1 addition & 1 deletion demo/backend/_includes/macros/tabbar-bottom/index.xml.njk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% macro tabbar_bottom(target) %}
<navigation:bottom-tab-bar
xmlns:navigation="https://instawork.com/hyperview-navigation"
xmlns:navigation="https://hyperview.org/navigation"
navigation:navigator="{{ target }}"
>
<select-single style="tabbar-bottom" name="tabbar-bottom">
Expand Down
5 changes: 0 additions & 5 deletions demo/backend/_includes/templates/list.xml.njk
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
---
permalink: "list.xml"
hv_list_tag: "root"
---

{# Standard template for showing a list of links to other screens. List is generated from a collection of screens with the given "hv_list_tag" #}
<list
action="replace"
Expand Down
6 changes: 0 additions & 6 deletions demo/backend/_includes/templates/section-list.xml.njk
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
---
permalink: "section-list.xml"
hv_section_list_tag: "root"
---

{# Standard template for showing a section list of links to other screens. List is generated from a collection of screens with the given "hv_section_list_tag" #}
<section-list
action="replace"
Expand All @@ -14,7 +9,6 @@ hv_section_list_tag: "root"
trigger="refresh"
xmlns="https://hyperview.org/hyperview"
>
<text>{{hv_section_list_tag}}</text>
{% for section_tag in hv_section_list_tag.split(',') %}
<section-title style="list-header item-first">
<text style="list-header-text">{{section_tag}}</text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ hv_button_behavior: "back"
---
{% extends 'templates/base.xml.njk' %}

{# TODO rohanbayya: Fix Report Issue #}

{% block custom_ns %}
xmlns:ns1="https://instawork.com/hyperview-intercom"
{% endblock %}

{% block styles %}
{% include './styles.xml.njk' %}
{% endblock %}
Expand All @@ -21,7 +15,6 @@ hv_button_behavior: "back"
<view style="section-top">
<text style="section-header">Instaworkers</text>
<text style="section-action">
<behavior action="intercom" ns1:action="open" trigger="press" />
Report Issue
</text>
</view>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,12 @@
id="savedButton"
style="bottomsheet-button"
xmlns="https://hyperview.org/hyperview"
xmlns:ns1="https://instawork.com/hyperview-redux"
>
<behavior
action="close"
delay="300"
href="/hyperview/public/advanced/case-studies/business-rating/index.xml"
trigger="load"
/>
<behavior
action="redux"
ns1:action="TOAST/SHOW_TOAST"
ns1:extra="{&quot;payload&quot;:{&quot;toast&quot;:{&quot;colorScheme&quot;:&quot;positive&quot;,&quot;message&quot;:&quot;Thank you for your rating&quot;}}}"
trigger="load"
/>
<text style="bottomsheet-button-label">Saved!!!</text>
</view>
2 changes: 2 additions & 0 deletions demo/backend/advanced/case-studies/content.xml.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{% set hv_list_tag = "case_studies" %}
{% include "templates/list.xml.njk" %}
3 changes: 1 addition & 2 deletions demo/backend/advanced/case-studies/index.xml.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
permalink: "/advanced/case-studies/index.xml"
---

{% set hv_list_tag = "case_studies" %}
{% include "templates/list.xml.njk" %}
{% include "./content.xml.njk" %}
4 changes: 0 additions & 4 deletions demo/backend/advanced/case-studies/photos/comments.xml.njk
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
---
permalink: "/advanced/case-studies/photos/comments.xml"
---

<view style="comments">
<text id="image1-num-likes" style="comments-likes">7 likes</text>
<text
Expand Down
2 changes: 2 additions & 0 deletions demo/backend/advanced/custom-components/content.xml.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{% set hv_list_tag = "custom_components" %}
{% include "templates/list.xml.njk" %}
3 changes: 1 addition & 2 deletions demo/backend/advanced/custom-components/index.xml.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
permalink: "/custom_components/index.xml"
---

{% set hv_list_tag = "custom_components" %}
{% include "templates/list.xml.njk" %}
{% include "./content.xml.njk" %}
4 changes: 2 additions & 2 deletions demo/backend/advanced/index.xml.njk
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ hv_button_behavior: "none"
)
}}
{% call tab("tab-case-studies") -%}
{% include "./case-studies/index.xml.njk" %}
{% include "./case-studies/content.xml.njk" %}
{%- endcall %}
{% call tab("tab-custom-components") -%}
{% include "./custom-components/index.xml.njk" %}
{% include "./custom-components/content.xml.njk" %}
{%- endcall %}
<behavior
action="set-value"
Expand Down
2 changes: 2 additions & 0 deletions demo/backend/behaviors/advanced/content.xml.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{% set hv_list_tag = "advanced" %}
{% include "templates/list.xml.njk" %}
3 changes: 1 addition & 2 deletions demo/backend/behaviors/advanced/index.xml.njk
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ hv_title: "Advanced"
hv_button_behavior: "back"
---

{% set hv_list_tag = "advanced" %}
{% include "templates/list.xml.njk" %}
{% include "./content.xml.njk" %}
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
---
permalink: "/behaviors/advanced/scroll/list/list-content.xml"
---
{% from 'macros/link/index.xml.njk' import link %}

{% for i in range(1, 51) %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
---
permalink: "/behaviors/advanced/scroll/section-list/section-list-content.xml"
---

{% from 'macros/link/index.xml.njk' import link %}

<section-title style="list-header">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
action="select-all"
delay="1000"
show-during-load="show3-spinner"
style="Button"
target="id_sm_indicator"
/>
<view id="show3-spinner" hide="true">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
action="unselect-all"
delay="1000"
show-during-load="show3-spinner"
style="Button"
target="id_sm_indicator"
/>
<view id="show3-spinner" hide="true">
Expand Down
2 changes: 2 additions & 0 deletions demo/backend/behaviors/basic/content.xml.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{% set hv_section_list_tag = "Actions,Triggers,Target,Indicators,Fragments,Once" %}
{% include "templates/section-list.xml.njk" %}
3 changes: 1 addition & 2 deletions demo/backend/behaviors/basic/index.xml.njk
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ hv_title: "Basic"
hv_button_behavior: "back"
---

{% set hv_section_list_tag = "Actions,Triggers,Target,Indicators,Fragments,Once" %}
{% include "templates/section-list.xml.njk" %}
{% include "./content.xml.njk" %}
22 changes: 22 additions & 0 deletions demo/backend/behaviors/content.xml.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{% extends 'templates/tab-route.xml.njk' %}
{% from 'macros/tab/index.xml.njk' import tab, tab_bar %}

{% block tab_route_content %}
{{ tab_bar([
{label: "Advanced", id: "tab-advanced"},
{label: "Basic", id: "tab-basic"}
]) }}
{% call tab("tab-advanced") -%}
{% include "./advanced/content.xml.njk" %}
{%- endcall %}
{% call tab("tab-basic") -%}
{% include "./basic/content.xml.njk" %}
{%- endcall %}
<behavior
action="set-value"
new-value="tab-advanced"
once="true"
trigger="load"
target="tab-bar"
/>
{% endblock %}
Loading

0 comments on commit 68067f6

Please sign in to comment.