References: UI schema index
In intent-driven development, one of the key components is the creation of user interfaces (UI) from a scenario definition. This approach has several objectives:
- To establish a versatile framework that enables the automatic generation of user interfaces.
- To ensure that UI generation can occur either on the client side or the server side, providing flexibility in deployment.
- To design the generation process to be adaptable and customizable. This involves incorporating a variety of parsers and allowing for different providers for each parser, thereby enhancing the system’s extensibility and scalability.
As a reference we will use:
In the described scenarios, the primary focus is on generating HTML markup for web-based user interfaces. However, the flexibility of this approach allows for the use of alternative parsers to create different types of user interfaces. For instance, while the current example involves generating standard HTML UI, it’s entirely feasible to develop a parser for Bootstrap to produce Bootstrap-based UIs, or a React parser for React UIs.
Additionally, parsers can be designed for iOS and Android platforms to interpret the schema and generate appropriate markup for these specific environments. The underlying principles of UI generation in this context are relatively straightforward, enabling the use of various programming languages to develop custom solutions tailored to specific requirements.
Here are the key components to be aware of:
- Schema Manager: This is the API you use to initiate the process and retrieve the results. It also manages the parsers and offers an interface for registering providers.
- Parser: This component interprets the schema and coordinates with the providers to produce the desired output.
- Provider: Each provider possesses specialized knowledge about a specific part of the schema and knows what actions to take when parsing those parts.
- Managers: Play a crucial role in handling specific schema elements by loading resources, enabling query functionalities, and overseeing the schema definitions for their respective sections. They act as vital resources for other providers, offering various features depending on the manager and its designated purpose. For instance, the variables manager is responsible for constructing a lookup table for variables, thereby facilitating queries by other providers who need to access variables defined within the schema.
- Value processors: These are commonly employed as managers when the ‘valueProcessor’ read-only property is configured as true. They play a crucial role in assessing schema property values and fetching the appropriate value according to the expression.