You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have an particular xsd file that has an include to a Globals.xsd. Globals contains a lot of definitions including many that are not applicable to that xsd file. When I run jsonix compiler it results in a huge json schema with everything from Globals. Is there any way to only pull those items referenced by the specified xsd file?
Thanks!
The text was updated successfully, but these errors were encountered:
Is there any way to only pull those items referenced by the specified xsd file?
Yes. Well, almost. See Including Dependencies of Other Mappings. If you have two separate schemas Particular and Globals (by separate I mean different namespaces resulting in different packages/mappings), you could configure jsonix:includes/jsonix:dependencies-of-mapping[@name='Particular'] for the Globals mapping. This will only include stuff from Globals which Particular needs. Schema compiler will calculate a graph of dependencies and transitively include everything Particular needs - and only this.
The important point is that these have to be separate mappings. This is normally the case when one schema imports another schema which has a different namespace. (The logic is namespace -> package -> mapping.)
But if you have an inlcusion (xs:include) you effectively don't have two separate schemas, you have one schema defined in several files. In this case you don't have two mappings so this trick won't work.
In this case you can configure jsonix:include with jsonix:elements for all the top-level elements from your particular schema that you're interested in. Alternatively you could configure jsonix:exclude for the stuff you don't need but it's probably more work.
We have an particular xsd file that has an include to a Globals.xsd. Globals contains a lot of definitions including many that are not applicable to that xsd file. When I run jsonix compiler it results in a huge json schema with everything from Globals. Is there any way to only pull those items referenced by the specified xsd file?
Thanks!
The text was updated successfully, but these errors were encountered: