Remove spurious attributes from IsoSts models - #58
Open
HassanAkbar wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aligns several Sts::IsoSts element models with the actual ISOSTS schema by removing attributes that were mistakenly carried over from NISO STS modeling, and strengthens the spec suite to ensure both the Ruby-level attribute sets and XML-level behavior reflect the schema.
Changes:
- Removed undeclared attributes from
IsoStsmodels:Graphic#graphic_type,Body#content_type,Back#content_type, and#lang/#specific_useonLanguageandContentLanguage. - Updated attribute-key-set assertions to match the corrected models.
- Added XML-behavior guards (via Nokogiri) to ensure these undeclared XML attributes are ignored/dropped during parse/serialize.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| spec/iso_sts/iso_sts_element_spec.rb | Updates expected attribute sets and adds XML-level guards ensuring undeclared attributes are not preserved. |
| lib/sts/iso_sts/language.rb | Removes lang and specific_use attributes/mappings from Language. |
| lib/sts/iso_sts/content_language.rb | Removes lang and specific_use attributes/mappings from ContentLanguage. |
| lib/sts/iso_sts/graphic.rb | Removes the undeclared unprefixed type mapping (graphic_type) while keeping xlink:type. |
| lib/sts/iso_sts/body.rb | Removes the undeclared content-type mapping from Body. |
| lib/sts/iso_sts/back.rb | Removes the undeclared content-type mapping from Back. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Removes the 7 spurious attributes on 5 models that #42 deferred.
Five IsoSts models carried attributes ISOSTS does not define. They came from the earlier pass that verified attributes against the NISO XSD and applied the result to IsoSts — the wrong schema for these models.
Removed:
typeongraphic,content-typeonbodyandback, andlang+specific-useonlanguageandcontent-language.Every removal is verified against
ISOSTS.dtdandISOSTS.xsd.%body-atts;expands tospecific-usealone,backhas noATTLISTat all,%graphic-atts;givesxlink:typebut never a baretype, and neitherlanguagenorcontent-languagedeclares any attribute.graphickeepsxlink:type. Only the unprefixedtypewas undeclared.@idstays on all five. ISOSTS does not define it either, but that is the deliberate 86948b9 convention across 220 models.Breaking change: 7 readers are gone —
Body#content_type,Back#content_type,Graphic#graphic_type, and#lang/#specific_useon bothLanguageandContentLanguage. Callers reading them will get aNoMethodError. No fixture or reference document in the repo uses any of them, so on valid ISOSTS input these readers were alwaysnil.bundle exec rspec: 5212 examples, 0 failures.bundle exec rubocop: clean. All 7 new guards fail without the fix.Metanorma PR checklist
refs #40