-
Notifications
You must be signed in to change notification settings - Fork 21
Implement support for duplicated identifiers #186
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
Conversation
While it is obviously not legal to have different element types with the exact same identifiers in an XML schema, it is possible to tolerate this in xsd-parser. The basic idea is to add a SchemaId to every Ident, therefore allowing otherwise identical Idents to coexist if they were identified in different schema files. This sounds simple, but creates the problem that if schema 1 defines foo:bar and then schema 2 references it, the Ident from the reference would be tagged as schema 2 and would therefore not resolve to the ident from schema 1. So most of the work then boils down to adding fallback logic everywhere so that if an Ident is not found with the same SchemaId it correctly resolves to an Ident defined elsewhere, just like before.
|
Hey @main--, looks promising, I like the idea of adding the schema id to the identifier, but I do not like the invasive change to the Here is a first list of points I see:
|
|
Hey @main--, I'm preparing a new release, I just wanted to sync with you, if we should aim to get this PR into the new release also, or if we postpone it to a later one? Time wise I aim to make the release end of next week - Dec-07 (latest in two weeks - Dec-14). |
|
Hi, thank you for asking. From my side there is no rush on this and I'm currently tied up in other projects. I intend to finish this, but it will probably take a few weeks until I can get back to it so no need to wait for me. |
|
Ok, then we will put this into the next release, not the current one 👍 |
f2cd529 to
9af9b15
Compare
9af9b15 to
9d5d048
Compare
|
I implemented your suggestion with the custom map. What made it a bit awkward is the fact that it needs to handle both I also added a I considered how to avoid adding the schema to Unfortunately this still has a small breaking change regarding |
|
Hey @main--, Thanks for all the work, I'll have a look over the weekend and report back.
The Problem I pointed out before is caused by the recursive evaluation of the types. If for example a type
Ok, this was just an idea of mine. I'll have a look into the code and re-evaluate that idea again. |
|
Hey @main--, sorry for the late reply, this took longer than expected. I reviewed your changes and started simplifying a few things. While doing that, I explored my idea around the new Instead of resolving the schema every time an entry is accessed from a map, the Since GitHub doesn’t allow changing the source branch of an existing PR, I opened a new one here: #210. Please have a look and if you’re okay with it, I would close this PR and merge the new one. |
|
Closed as duplicate to #210 |
Here is my attempt to fix #156.
I'm not sure if this is the best approach, and I'm not sure that I handled all the code paths correctly. At least the tests are passing now, so that's a good sign -- though I'm still not sure why some of the ID numbers changed on the schema tests.
Making the two maps private is of course an unfortunate breaking change, but otherwise I see a high risk of bugs caused by calling
.get(ident)without a fallback in case the ident schema doesn't match.I'm curious to see what you think about this.