Skip to content

Conversation

@Archie-Miller
Copy link
Collaborator

Removed unnecessary information in StructuredFieldDefinition, as per issue 128.

@Archie-Miller Archie-Miller linked an issue Sep 5, 2025 that may be closed by this pull request
Copy link

Copilot AI left a comment

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 improves the handling of StructureFieldDefinition attributes by removing unnecessary information and only including relevant fields, addressing issue #128. The changes focus on making the structure field definitions more selective and cleaner.

  • Removes unused imports from test files
  • Updates test methods to handle selective attribute inclusion with better validation
  • Modifies the core logic to conditionally include/exclude structure field attributes based on their relevance

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
SystemTest/TestStructureFieldDefinition.cs Updated test methods to validate selective attribute inclusion and removed unused imports
SystemTest/NodeSetFiles/TestAml.xml Added test data with additional description locales and a new data type for testing
SystemTest/NodeSetFiles/Modified.Opc.Ua.NodeSet2.xml Simplified field definitions by removing description elements
NodeSetToAML.cs Modified core logic to conditionally include structure field attributes based on relevance

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +3203 to +3204
m_modelManager.IsTypeOf( field.DecodedDataType, Opc.Ua.DataTypeIds.String ) ||
m_modelManager.IsTypeOf( field.DecodedDataType, Opc.Ua.DataTypeIds.ByteString ) )
Copy link

Copilot AI Sep 5, 2025

Choose a reason for hiding this comment

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

Missing parentheses around the OR condition. The logical AND operator has higher precedence than OR, causing incorrect evaluation. The condition should be: if ( field.MaxStringLength > 0 && (m_modelManager.IsTypeOf( field.DecodedDataType, Opc.Ua.DataTypeIds.String ) || m_modelManager.IsTypeOf( field.DecodedDataType, Opc.Ua.DataTypeIds.ByteString )) )

Suggested change
m_modelManager.IsTypeOf( field.DecodedDataType, Opc.Ua.DataTypeIds.String ) ||
m_modelManager.IsTypeOf( field.DecodedDataType, Opc.Ua.DataTypeIds.ByteString ) )
(m_modelManager.IsTypeOf( field.DecodedDataType, Opc.Ua.DataTypeIds.String ) ||
m_modelManager.IsTypeOf( field.DecodedDataType, Opc.Ua.DataTypeIds.ByteString )) )

Copilot uses AI. Check for mistakes.
Comment on lines +3250 to +3253
if (structureFieldAttribute.Attribute.Count > 0)
{
fieldDefinitionAttribute.Attribute.Insert(structureFieldAttribute);
}
Copy link

Copilot AI Sep 5, 2025

Choose a reason for hiding this comment

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

[nitpick] The condition checking if attributes exist before insertion could be more explicit. Consider adding a comment explaining why empty attribute collections should be skipped, as this logic relates directly to the PR's goal of removing unnecessary information.

Copilot uses AI. Check for mistakes.
@Archie-Miller Archie-Miller merged commit 38458c2 into main Sep 5, 2025
1 check passed
@Archie-Miller Archie-Miller deleted the 128_StructureField_Selections branch September 5, 2025 19:35
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.

Unnecessary information in StructuredFieldDefinition

3 participants