XmlSchemaClassGenerator icon indicating copy to clipboard operation
XmlSchemaClassGenerator copied to clipboard

Feature request: exclude imported types

Open asherber opened this issue 3 years ago • 4 comments

Xsd2Code used to have an eit flag to exclude imported types, so that code would only be generated for the types in the schema files being looked at. This is useful when a schema makes use of a number of imported types that have already had their code files generated; we only care about the new types being added to the ecosystem.

In my case, I can fake this by using a custom OutputWriter that ignores all namespaces except the one that I'm interested in (since each of my XSDs defines a unique target namespaces) or by cleaning up after code generation and deleting the code files I don't need. But it would be nice if the generator could have a flag to handle this natively.

asherber avatar Nov 27 '22 02:11 asherber

That's a very good idea. Would you be interested in providing a PR?

mganss avatar Nov 29 '22 19:11 mganss

I'm happy to help, but this is an area of code I'm not very familiar with. (Which is why I've always used existing utilities!) Can you suggest some pseudo code or a place where this might go, to get me started?

asherber avatar Nov 29 '22 19:11 asherber

I think this could fit somewhere in here:

https://github.com/mganss/XmlSchemaClassGenerator/blob/990b09d34d577e4486fa86a85f78db556ec0d0c2/XmlSchemaClassGenerator/Generator.cs#L320-L374

mganss avatar Nov 29 '22 19:11 mganss

Thanks, I'll take a look!

asherber avatar Nov 29 '22 19:11 asherber