Added model generation from rnc schema#700
Draft
HassanAkbar wants to merge 3 commits into
Draft
Conversation
Contributor
|
@HassanAkbar are you planning to merge this into #699 (I know the base targets it) first, then mark #699 as ready to merge? Thanks! |
Member
Author
|
@ronaldtse yup, that's the plan. |
627a823 to
303b085
Compare
682448e to
157e954
Compare
aa7351c to
a843732
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds RELAX NG Compact Syntax (RNC) schema import by adapting the existing RNG compiler pipeline (RNC → Rng::Grammar → RngCompiler), including preprocessing for RFC XML–style RNC features and an entry point via Lutaml::Model::Schema.from_rnc.
Changes:
- Introduces
Lutaml::Model::Schema::RncCompilerwith preprocessing (annotations stripping, occurrence normalization, include expansion) and wiring viaSchema.from_rnc. - Extends RNG attribute handling to preserve
xml:-prefixed attributes in generated mappings. - Adds documentation and comprehensive RSpec coverage + fixtures for RNC compilation scenarios (includes, warnings, load/create_files modes).
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
spec/lutaml/xml/schema/rnc_compiler_spec.rb |
Adds end-to-end and unit-level tests for RNC compilation, preprocessing behaviors, include resolution, and Schema.from_rnc. |
spec/fixtures/xml/schema/rnc/address_book.rnc |
Fixture RNC schema for baseline model generation. |
spec/fixtures/xml/schema/rnc/book_features.rnc |
Fixture exercising RFC XML-style RNC features (annotations, mixed attribute choices, escaped identifiers, xml:lang). |
spec/fixtures/xml/schema/rnc/includes/library.rnc |
Fixture for include resolution. |
spec/fixtures/xml/schema/rnc/includes/book.rnc |
Included fixture referenced by library.rnc. |
spec/fixtures/xml/schema/rnc/includes/circular_a.rnc |
Fixture for circular include detection. |
spec/fixtures/xml/schema/rnc/includes/circular_b.rnc |
Fixture for circular include detection. |
lib/lutaml/xml.rb |
Registers Schema.from_rnc in the XML plugin layer (with Opal guard). |
lib/lutaml/model/schema.rb |
Adds autoload + placeholder from_rnc when lutaml-xml isn’t loaded. |
lib/lutaml/model/schema/rng_compiler.rb |
Allows alternate default output dir via :default_output_dir (used by RNC adapter). |
lib/lutaml/model/schema/rng_compiler/element_visitor.rb |
Preserves xml: prefix in generated attribute mappings (e.g., xml:lang). |
lib/lutaml/model/schema/rnc_compiler.rb |
New RNC compiler adapter delegating to RngCompiler, with start-define cleanup and warnings plumbing. |
lib/lutaml/model/schema/rnc_compiler/preprocessor.rb |
New preprocessing layer for RNC constructs the rng parser doesn’t handle well. |
lib/lutaml/model/schema/rnc_compiler/source_resolver.rb |
New helper for resolving base directories / sources for include expansion. |
docs/_guides/schema-import.adoc |
Documents RNG/RNC import and the location: option behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a843732 to
f98fdda
Compare
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.
fixes #55