Hi @varaande,
As you rightly pointed out, AEM Forms Designer does not support JSON Schema natively. It primarily relies on XML Schema Definitions (XSDs) for defining the structure of the form data. This poses a challenge if you are looking to use JSON Schema directly. Additionally the bindRef attribute allows for name-based binding, which can be useful when you want to map form data fields to a specific structure, such as a JSON object. However, this approach assumes that the structure is predefined and consistent across form instances. Since AEM Forms Designer relies on XSD for schema definitions, using bindRef without an underlying XML Schema may not be straightforward.
One feasible approach is to create a transformation layer that converts JSON data into an XML format that AEM Forms Designer can understand. This could involve converting your JSON Schema into an equivalent XSD manually or through a custom utility, and ensuring that the JSON data is transformed into XML before being processed by AEM Forms.
Deciding between continuing with your current setup of using JSON + XML Schema + XDP versus simplifying to using JSON Schema + bindRef (name-based binding) only requires a careful analysis of your project's needs, resources, and future scalability.
Continuing with JSON + XML Schema + XDP
Pros:
Compatibility: AEM Forms Designer natively supports XML Schema, making this approach more compatible with existing tools and features.
Stability: This method is well-tested and widely used in enterprise environments, providing a more stable and predictable setup.
Rich Feature Set: XDPs (XML Data Packages) support a wide array of features for dynamic forms, such as scripting and layout flexibility, which are directly integrated with XML Schemas.
Integration: XML Schemas allow for better integration with other systems that may also rely on XML, offering a uniform approach to data handling.
Cons:
Complexity: Managing both XML and JSON can introduce complexity, especially in maintaining and synchronizing data transformations.
Overhead: The need to convert JSON data to XML format adds additional processing steps, which could be a source of potential errors.
Simplifying to JSON Schema + bindRef (name-based binding)
Pros:
Simplicity: Using JSON Schema simplifies the data model, especially if your system is predominantly JSON-based, reducing the need for data transformation layers.
Modern Approach: JSON is often more lightweight and easier to handle in modern web applications, which may improve performance and reduce latency.
Ease of Use: JSON is generally easier to read and write, which can simplify development and debugging processes.
Cons:
Lack of Native Support: AEM Forms Designer does not natively support JSON Schema, which could require custom development or middleware to handle data binding and transformation.
Potential for Errors: Without native tooling support, the risk of errors or inconsistencies in data handling increases.
Limited Functionality: You may not be able to leverage some of the advanced features provided by XDPs and XML Schemas.
Suppose your current setup with JSON + XML Schema + XDP works well and meets your business requirements without significant performance issues or maintenance overhead, it may be wise to continue with this approach. It offers stability and compatibility with AEM Forms Designer. Also, If you anticipate a shift towards more JSON-centric architectures, or if you are developing new systems where JSON is predominantly used, exploring the JSON Schema + bindRef approach could be beneficial in the long term.
Thanks
Pranay