Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pulling in everything from an include .xsd #74

Open
stationcasinosgithub opened this issue Nov 17, 2016 · 1 comment
Open

Pulling in everything from an include .xsd #74

stationcasinosgithub opened this issue Nov 17, 2016 · 1 comment
Assignees
Labels
Milestone

Comments

@stationcasinosgithub
Copy link

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!

@highsource
Copy link
Owner

There's a number of ways to achieve this, see includes and excludes configuration.

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.

@highsource highsource added this to the 2.3.x milestone Nov 17, 2016
@highsource highsource self-assigned this Nov 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants