Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix interpretation of IncludeSubtypes #1018

Merged
merged 1 commit into from
Sep 7, 2022

Conversation

cziebuhr
Copy link
Contributor

@cziebuhr cziebuhr commented Sep 5, 2022

Fix interpretation of IncludeSubtypes in Browse requests.

According to the spec, IncludeSubtypes indicates whether subtypes of the ReferenceType should be included in the browse. If TRUE, then instances of ReferenceType and its subtypes are returned.

The current implementation has a different interpretation: Get instances of ReferenceType and subtypes thereof. If IncludeSubtypes is FALSE, then exclude the type "HasSubtype".

The same applies to RelativePath requests.

Fixes #233.
There may be conflicts with #1017, I can rebase when it got merged.

WARNING: This change has compatibility drawbacks, not sure how to deal with it in all cases.

  • Old client with new server (or other opcua servers):
    If using add_object with type definition (or directly using instantiate), no children will get created because get_children_descriptions(includesubtypes=False) on the ObjectType node which calls get_references(refs=ua.ObjectIds.HierarchicalReferences, includesubtypes=False) won't return anything. This is a breaking change, but also fixes behaviour when used with other opcua servers.

  • New client with old server:
    Some places call get_referenced_nodes(refs=HasSubtype, includesubtypes=True). Includesubtypes could actually be set to False because HasSubtype probably won't get subclassed. It should be harmless to keep it set to True, keeping compatibility with old servers and just wasting some cpu cycles there. However, for code cleanliness I removed the includesubtypes=True parameter from the call. It's still active, as it defaults to True.

@schroeder-
Copy link
Contributor

schroeder- commented Sep 6, 2022

Old client with new server (or other opcua servers):
If using add_object with type definition (or directly using instantiate), no children will get created because get_children_descriptions(includesubtypes=False) on the ObjectType node which calls get_references(refs=ua.ObjectIds.HierarchicalReferences, includesubtypes=False) won't return anything. This is a breaking change, but also fixes behaviour when used with other opcua servers.

I would rly care about that, because in practices there aren't that many servers allowing to create nodes from the client.

@cziebuhr
Copy link
Contributor Author

cziebuhr commented Sep 6, 2022

I would rly care about that, because in practices there aren't that many servers allowing to create nodes from the client.

Did you mean to NOT rly care?

@schroeder-
Copy link
Contributor

Sry, you are correct. Meant not really.

@oroulet oroulet merged commit 7b2b130 into FreeOpcUa:master Sep 7, 2022
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.

Browsing HasSubType references without "includeSubtypes"
3 participants