Skip to content

Added model generation from rnc schema#700

Draft
HassanAkbar wants to merge 3 commits into
feat/rng-compiler-to-modelsfrom
feat/rnc-compiler-to-models
Draft

Added model generation from rnc schema#700
HassanAkbar wants to merge 3 commits into
feat/rng-compiler-to-modelsfrom
feat/rnc-compiler-to-models

Conversation

@HassanAkbar

Copy link
Copy Markdown
Member

fixes #55

@ronaldtse

Copy link
Copy Markdown
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!

@HassanAkbar

Copy link
Copy Markdown
Member Author

@ronaldtse yup, that's the plan.
But if we need #699 is needed, I can finalize it first and then merge this in main. What do you suggest here?

@HassanAkbar HassanAkbar force-pushed the feat/rng-compiler-to-models branch from 627a823 to 303b085 Compare June 1, 2026 13:47
@HassanAkbar HassanAkbar force-pushed the feat/rnc-compiler-to-models branch 2 times, most recently from 682448e to 157e954 Compare June 5, 2026 08:26
@HassanAkbar HassanAkbar force-pushed the feat/rnc-compiler-to-models branch 2 times, most recently from aa7351c to a843732 Compare June 9, 2026 07:10
@HassanAkbar HassanAkbar requested a review from Copilot June 9, 2026 07:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds RELAX NG Compact Syntax (RNC) schema import by adapting the existing RNG compiler pipeline (RNC → Rng::GrammarRngCompiler), including preprocessing for RFC XML–style RNC features and an entry point via Lutaml::Model::Schema.from_rnc.

Changes:

  • Introduces Lutaml::Model::Schema::RncCompiler with preprocessing (annotations stripping, occurrence normalization, include expansion) and wiring via Schema.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.

Comment thread lib/lutaml/model/schema/rnc_compiler/preprocessor.rb
Comment thread lib/lutaml/model/schema/rnc_compiler/source_resolver.rb
@HassanAkbar HassanAkbar force-pushed the feat/rnc-compiler-to-models branch from a843732 to f98fdda Compare June 9, 2026 08:09
@HassanAkbar HassanAkbar linked an issue Jun 11, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement RNC to Lutaml::Model definitions functionality

3 participants