Support NMTOKENS as built in type#38
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the XSD-to-Ballerina type mapping to treat additional XML Schema built-in simple types (notably NMTOKENS) as supported built-ins, and bumps the Ballerina tool package version to 1.2.1 for the fix linked in ballerina-library#8660.
Changes:
- Add new XSD built-in type constants (
NMTOKENS,ENTITY,ENTITIES,Name) and map them to Ballerinastring. - Expand the “simple type” detection list to include these newly supported built-ins.
- Bump module-ballerina-xsd package/dependency versions to
1.2.1and update BalTool jar paths.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| xsd-core/src/main/java/io/ballerina/xsd/core/visitor/Utils.java | Adds new built-in XSD type constants and updates type mapping / simple-type detection logic. |
| module-ballerina-xsd/Dependencies.toml | Updates dependency version to 1.2.1. |
| module-ballerina-xsd/Ballerina.toml | Updates package version to 1.2.1. |
| module-ballerina-xsd/BalTool.toml | Updates local jar paths to 1.2.1-SNAPSHOT. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
xsd-core/src/main/java/io/ballerina/xsd/core/visitor/Utils.java
Outdated
Show resolved
Hide resolved
xsd-core/src/main/java/io/ballerina/xsd/core/visitor/Utils.java
Outdated
Show resolved
Hide resolved
0e51d26
|
No actionable comments were generated in the recent review. 🎉 📝 WalkthroughWalkthroughThe PR bumps module version from 1.2.0 to 1.2.1 across configuration files and extends the XSD-to-Record converter to support additional XSD built-in string types: NMTOKENS, ENTITY, ENTITIES, and NAME by mapping them to string in the type generator. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
Co-authored-by: Nuvindu <63797478+Nuvindu@users.noreply.github.com>
Purpose
Summary
This pull request adds support for additional XSD built-in types (xs:NMTOKENS, xs:ENTITY, xs:ENTITIES, and xs:NAME) to the Ballerina XSD tool. Previously, when an XSD schema contained these types, the generated Ballerina records would reference unknown types, causing compilation failures.
Key Changes
Type Support Enhancement
Utils.javafor the four previously unsupported built-in types: NMTOKENS, ENTITY, ENTITIES, and NAMESIMPLE_TYPESset for improved maintainabilityTesting and Validation
44_elements_with_builtin_string_types) with corresponding XSD and expected Ballerina outputVersion Updates
Outcome
Generated Ballerina code now correctly compiles when working with XSD schemas that use xs:NMTOKENS and related built-in types, eliminating unknown type reference errors that previously blocked code generation.