Skip to content

Add default namespace prefix for simple type references in generated XSDs#363

Open
klasfahlberg wants to merge 4 commits intomojohaus:masterfrom
ITS-UMU:ladok-patches
Open

Add default namespace prefix for simple type references in generated XSDs#363
klasfahlberg wants to merge 4 commits intomojohaus:masterfrom
ITS-UMU:ladok-patches

Conversation

@klasfahlberg
Copy link
Copy Markdown

This patch addresses an issue where schemagen does not generate the default namespace prefix for references to simple types (such as enum types), resulting in XSDs that are not fully compatible with xjc. The following changes were made:

Added logic to detect element references without a namespace prefix and prepend the default namespace prefix where appropriate.

  • Updated ChangeNamespacePrefixProcessor to handle these cases and ensure compatibility.
  • Adjusted SimpleNamespaceResolver to avoid overwriting the tns prefix and improve prefix/URI mapping safety.
  • Minor update in XsdGeneratorHelper to prevent unnecessary prefix substitutions.

These changes ensure that generated XSDs include the correct namespace prefixes, improving compatibility with tools expecting explicit prefixes.

These two PR:s, written by a former colleague, are no longer relevant and can be closed.

@klasfahlberg klasfahlberg changed the title Add default namespace prefix for simple type references in generated XSDsLadok patches Add default namespace prefix for simple type references in generated XSDs Jun 2, 2025
@slachiewicz
Copy link
Copy Markdown
Member

Could You try to add some tests?

@xdy
Copy link
Copy Markdown

xdy commented Aug 15, 2025

Added some tests from Klas.

@klasfahlberg
Copy link
Copy Markdown
Author

slachiewicz Are the added tests sufficient?

@slachiewicz slachiewicz requested a review from Copilot October 5, 2025 18:07

This comment was marked as resolved.

@klasfahlberg
Copy link
Copy Markdown
Author

@slachiewicz any insight on when this will make it to a release?

@slachiewicz
Copy link
Copy Markdown
Member

Hi, I missed this one. Could you try to rebase changes to resolve conflicts?

Johan Fredlander and others added 2 commits April 15, 2026 12:04
…fix for references to simple types, such as enum types => we want to add the default namespace prefix to those nodes in order to get xjc-compatible XSD:s.
@klasfahlberg
Copy link
Copy Markdown
Author

@slachiewicz done

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Handle prefix2Uri and uri2Prefix consistently.
@klasfahlberg
Copy link
Copy Markdown
Author

@slachiewicz code/comments updated

@klasfahlberg
Copy link
Copy Markdown
Author

@slachiewicz I've pushed a commit with the formatting (mvn spotless:apply)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants