-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(demo): schema validation (#949)
Build on previous (#948) refactor to introduce schema validation for custom elements and behaviors: - Extend core schema and add boilerplate to allow custom definitions - Update yarn command to delete generated files before regenerating, and point to extend schema file <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new XML Schema for filtering functionality, enhancing the Hyperview framework. - Added new types and elements for improved filtering capabilities. - **Changes** - Updated XML namespace for the filter component to align with the new Hyperview standards. - Modified validation scripts to streamline XML validation processes. These updates enhance the user experience by providing more robust filtering options and ensuring compatibility with the latest framework standards. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: flochtililoch <[email protected]>
- Loading branch information
1 parent
ed3636d
commit d36b135
Showing
5 changed files
with
116 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<xs:schema | ||
xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
attributeFormDefault="qualified" | ||
elementFormDefault="qualified" | ||
targetNamespace="https://hyperview.org/filter" | ||
xmlns:filter="https://hyperview.org/filter" | ||
xmlns:hv="https://hyperview.org/hyperview" | ||
> | ||
<xs:import | ||
namespace="https://hyperview.org/hyperview" | ||
schemaLocation="hyperview.xsd" | ||
/> | ||
<xs:simpleType name="transform"> | ||
<xs:restriction base="xs:string"> | ||
<xs:enumeration value="lowercase" /> | ||
</xs:restriction> | ||
</xs:simpleType> | ||
<xs:simpleType name="role"> | ||
<xs:restriction base="xs:string"> | ||
<xs:enumeration value="filter-terms" /> | ||
</xs:restriction> | ||
</xs:simpleType> | ||
|
||
<xs:element name="container"> | ||
<xs:complexType> | ||
<xs:sequence> | ||
<xs:any minOccurs="0" maxOccurs="unbounded" /> | ||
</xs:sequence> | ||
<xs:attribute name="id" type="hv:ID" form="unqualified" /> | ||
<xs:attribute name="on-event" type="xs:string" use="required" /> | ||
<xs:attribute name="on-param" type="xs:string" use="required" /> | ||
<xs:attribute name="transform" type="filter:transform" /> | ||
</xs:complexType> | ||
</xs:element> | ||
|
||
<xs:attributeGroup name="filterAttributes"> | ||
<xs:attribute name="regex" type="xs:string" /> | ||
<xs:attribute name="role" type="filter:role" /> | ||
<xs:attribute name="terms" type="xs:string" /> | ||
</xs:attributeGroup> | ||
</xs:schema> |
This file contains 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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<xs:schema | ||
xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
elementFormDefault="qualified" | ||
targetNamespace="https://hyperview.org/hyperview" | ||
xmlns:hv="https://hyperview.org/hyperview" | ||
xmlns:alert="https://hyperview.org/hyperview-alert" | ||
> | ||
<xs:import | ||
namespace="https://hyperview.org/hyperview-alert" | ||
schemaLocation="../../schema/alert.xsd" | ||
/> | ||
<xs:import | ||
namespace="https://hyperview.org/filter" | ||
schemaLocation="filter.xsd" | ||
/> | ||
|
||
<xs:redefine schemaLocation="../../schema/core.xsd"> | ||
<xs:simpleType name="action"> | ||
<xs:restriction base="hv:action"> | ||
<!-- Hyperview core --> | ||
<xs:enumeration value="push" /> | ||
<xs:enumeration value="new" /> | ||
<xs:enumeration value="back" /> | ||
<xs:enumeration value="close" /> | ||
<xs:enumeration value="navigate" /> | ||
<xs:enumeration value="reload" /> | ||
<xs:enumeration value="deep-link" /> | ||
<xs:enumeration value="open-settings" /> | ||
<xs:enumeration value="dispatch-event" /> | ||
<xs:enumeration value="replace" /> | ||
<xs:enumeration value="replace-inner" /> | ||
<xs:enumeration value="append" /> | ||
<xs:enumeration value="prepend" /> | ||
<xs:enumeration value="show" /> | ||
<xs:enumeration value="hide" /> | ||
<xs:enumeration value="toggle" /> | ||
<xs:enumeration value="set-value" /> | ||
<xs:enumeration value="alert" /> | ||
<xs:enumeration value="select-all" /> | ||
<xs:enumeration value="unselect-all" /> | ||
<xs:enumeration value="scroll" /> | ||
|
||
<!-- Hyperview demo extensions --> | ||
<!-- None yet, add future custom behavior actions here --> | ||
</xs:restriction> | ||
</xs:simpleType> | ||
|
||
<xs:attributeGroup name="behaviorAttributes"> | ||
<!-- Hyperview core --> | ||
<xs:attributeGroup ref="hv:behaviorAttributes" /> | ||
|
||
<!-- Hyperview demo extensions --> | ||
<!-- None yet, add future custom behavior attributes here --> | ||
</xs:attributeGroup> | ||
|
||
<!-- This redefines the behavior element with our custom actions / attributes --> | ||
<xs:complexType name="behavior"> | ||
<xs:complexContent> | ||
<xs:restriction base="hv:behavior"> | ||
<xs:sequence> | ||
<xs:element minOccurs="0" maxOccurs="unbounded" ref="alert:option" /> | ||
<xs:element minOccurs="0" maxOccurs="unbounded" ref="hv:styles" /> | ||
</xs:sequence> | ||
<xs:attributeGroup ref="hv:behaviorAttributes" /> | ||
</xs:restriction> | ||
</xs:complexContent> | ||
</xs:complexType> | ||
|
||
</xs:redefine> | ||
<xs:element name="behavior" type="hv:behavior" /> | ||
</xs:schema> |
This file contains 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