Repository navigation
[Fix] keep an explicit IS-EDITABLE="false" when a document is read and written again; fixes #86 - #106
Merged
Merged
Conversation
…d written again; fixes #86 - add AccessControlledElement.IsEditableSpecified, set when IS-EDITABLE is read or IsEditable is set; IS-EDITABLE is written when it is specified or true - write the attributes of AccessControlledElement and SpecHierarchy before the ALTERNATIVE-ID element, through a new Identifiable.WriteXmlAttributes(Async); an element with an ALTERNATIVE-ID that was editable or table-internal threw an InvalidOperationException - add IsEditableTestFixture Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- rename the local in AccessControlledElement.ReadXml that hid the new isEditable field (S1117) - let AssertRoundTrip take a MemoryStream (CA1859) - keep the expected element names in a static readonly field (CA1861) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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 #86.
What changes
IS-EDITABLE="false"survives a round trip.AccessControlledElementgets a publicIsEditableSpecified. It is true whenIS-EDITABLEwas present in the document that was read, or whenIsEditablewas set.IS-EDITABLEis written whenIsEditableSpecifiedorIsEditableis true, in the sync and async writers. An element without the attribute is still written without it.IsEditablestays a plainbool.ALTERNATIVE-ID.IS-EDITABLE(andIS-TABLE-INTERNALon a spec hierarchy) were written afterbase.WriteXml, which had already written theALTERNATIVE-IDchild element. An editable or table-internal element with an alternative id therefore threw anInvalidOperationException; this already happened forIS-EDITABLE="true"before this change.Identifiablenow has an internalWriteXmlAttributes/WriteXmlAttributesAsyncthat runs after its own attributes and beforeALTERNATIVE-ID;AccessControlledElementandSpecHierarchywrite their attributes there. The other subclasses already write their attributes beforebase.WriteXmland are unchanged.Notes for the reviewer
IS-EDITABLEonSPEC-OBJECT; it is only onSPEC-HIERARCHYand theATTRIBUTE-DEFINITION-*elements, the twoAccessControlledElementsubclasses. The fix and the tests cover those, and the acceptance criterion holds for them.IsEditable = false(for exampletarget.IsEditable = source.IsEditable) now writesIS-EDITABLE="false"where it used to write nothing. Both mean read-only. SetIsEditableSpecified = falseto leave the attribute out. Listed under Changed in the changelog.IS-EDITABLE="0"/"1"are read as booleans and written back as"false"/"true"; an empty or whitespace value is treated as absent.IS-TABLE-INTERNALof its child).Tests
New
IsEditableTestFixture:.reqifand.reqifz, sync and async, of false, true and absent on spec hierarchies and an attribute definition;IsEditableSpecifiedandIsEditable, including values set in code;ALTERNATIVE-IDtogether withIS-EDITABLE,IS-TABLE-INTERNALandMULTI-VALUED;IS-EDITABLEvalues;MIN,MAX,ACCURACY,MAX-LENGTHandMULTI-VALUEDof datatypes and attribute definitions next to anALTERNATIVE-ID.dotnet build ReqIFSharp.sln -c Release: 0 warnings.dotnet test ReqIFSharp.sln: 642 passed.🤖 Generated with Claude Code