Q. If I have the following collections:
- Each Product is linked to a Category.
- Each Category is linked to a Product_Description_Schema.
The outcome I want to accomplish is that the description schema for Product X I am entering, is defined by the Category it is linked to ( which in turn is defined by the Product_Description_Schema that the Category is linked to ).
e.g. Product = Hilton Hotel London, Category = Hotel, Product_Description_Schema = Accommodation_Type
A. One way is to have a single Product content type with a schema that utilizes JSON Schema dependencies to conditionally include a "description" schema based on the value of "productDescriptionSchemaId".
This value would propagate from the Product_Description_Schema instance to the Category and then from the Category to the Product using property mappings. Thus, the Product would know which Product_Description_Schema is should use and could conditionally use it.
These "description" schemas can be included in the Product schema as #definitions (as per JSON Schema) and then get included via references to avoid having to enter things multiple times in multiple places. This is a good approach as it leverages JSON Schema referencing and would be compatible with any JSON Schema validator.
Another way to do this is to introduce a UI extension so that you can customize the wizard for creating products. Cloud CMS lets you override these components and introduce your own using a modular design and deployment from GitHub. You could add a step to the wizard for creating Products to that they have to pick a category up front. Doing so would then let then give them the proper entry form (which could use the same pattern from the previous method, if you wanted).
Finally, you could also opt to introduce sub-types (such as a "Hotel Product") that extends the base Product and provides a specific schema for Hotels. Doing so may only be advantageous if you wanted to take advantage of per-type features, such as per-type paths, default forms and/or security (such as Joe is allowed to create Hotel Products but not Airline Products).