Skip to content

Remove spurious attributes from IsoSts models - #58

Open
HassanAkbar wants to merge 1 commit into
mainfrom
fix/isosts-spurious-attributes
Open

Remove spurious attributes from IsoSts models#58
HassanAkbar wants to merge 1 commit into
mainfrom
fix/isosts-spurious-attributes

Conversation

@HassanAkbar

Copy link
Copy Markdown
Member

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: type on graphic, content-type on body and back, and lang+specific-use on language and content-language.

Every removal is verified against ISOSTS.dtd and ISOSTS.xsd. %body-atts; expands to specific-use alone, back has no ATTLIST at all, %graphic-atts; gives xlink:type but never a bare type, and neither language nor content-language declares any attribute.

graphic keeps xlink:type. Only the unprefixed type was undeclared.

@id stays 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_use on both Language and ContentLanguage. Callers reading them will get a NoMethodError. No fixture or reference document in the repo uses any of them, so on valid ISOSTS input these readers were always nil.

bundle exec rspec: 5212 examples, 0 failures. bundle exec rubocop: clean. All 7 new guards fail without the fix.

Metanorma PR checklist

refs #40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 IsoSts models: Graphic#graphic_type, Body#content_type, Back#content_type, and #lang/#specific_use on Language and ContentLanguage.
  • 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.

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.

2 participants