Style: XSD file fixes and CI linter - #1674
Draft
pniedzielski wants to merge 3 commits into
Draft
Conversation
This patch removes from mqbcmd.xsd the explicit `xmlns:xs` namespace,
which just duplicates the default namespace. `xmlns:xs` was only used
to name simple XML Schema data types, like `xs:string`, not XML Schema
elements, like (`xs:`)`element`.
Along the way, we found some incorrect namespace usage in this file:
local types referenced as if they lived in the XML Schema namespace, and
built-in types referenced via `tns:`. This never caused problems
because our code gen resolves type references by their local name,
ignoring the namespace, so the generated code was unaffected. However,
under strict XSD validation, this fails. In addition to making the XML
Schema namespace implicit, this patch also normalizes/corrects these
cases, listed below:
1. In `LeaderMessageSequence`, `electorTerm` is given the type
`tns:unsignedLong` (which is nonsense), rather than the real
type: (`xs:`)`unsignedLong`.
2. In `SubscriptionGroup`, `priorityGroup` is given the unprefixed
type `PriorityGroup`, rather than the local type
`tns:PriorityGroup`.
3. In `PriorityGroup`, `highestSubscriptions` is given the
unprefixed type `Subscription`, rather than the local type
`tns:Subscription`.
4. In `Subscription`, `subscriber` is given the unprefixed type
`Subscriber`, rather than the local type `tns:Subscriber`.
5. In `ClusterNodeInfo`, `status` is given the type
`xs:NodeStatus` (which again, is nonsense), rather than the local
type `tns:NodeStatus`.
6. In `AppState`, `roundRobinRouter` is given the type
`xs:RoundRobinRouter` (which is nonsense), rather than the local
type `tns:RoundRobinRouter`.
Signed-off-by: Patrick M. Niedzielski <pniedzielski@bloomberg.net>
bmqstm.xsd is the only XSD file that qualifies every element with an `xs:` namespace prefix, and that does not specify its target namespace (or give it a prefix `tns:`). This may have been because of its history in the MWC package rather than being purely BMQ like the others. This patch brings it into line with the rest of the XSD files by making the XML Schema namespace implicit, and making the target namespace explicit. Signed-off-by: Patrick M. Niedzielski <pniedzielski@bloomberg.net>
This patch adds a CI linter for our XML schemas, which would have caught the style issues fixed by the two previous patches. The linter does two separate checks: first, it verifies that all the schemas are valid XML, and then it verifies that they are all valid XML schemas. Signed-off-by: Patrick M. Niedzielski <pniedzielski@bloomberg.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR includes a few XSD style fixes that I've found while doing work on an XSD->C++ codegen tool, as well as a CI check that could have found them. See commit messages for details on each.