fix: preserve all Services and Capabilities in GetServicesResponse#66
Open
GyeongHoKim wants to merge 3 commits into
Open
fix: preserve all Services and Capabilities in GetServicesResponse#66GyeongHoKim wants to merge 3 commits into
GyeongHoKim wants to merge 3 commits into
Conversation
- WSDL declares <Service> with maxOccurs="unbounded", but the Go struct held a single value - Each unmarshalled <Service> overwrote the previous, so only the last survived - Change Service to []Service so every entry is preserved
- WSDL declares <Capabilities> as xs:any with a service-specific namespace (trt, tev, tptz, ...) - Old shape embedded a Capabilities type with an untagged Any string, so the payload was silently dropped - Replace with a named ServiceCapabilities field whose Any string carries xml:",innerxml" - Callers re-unmarshal the raw payload into the per-service capability type chosen by Service.Namespace
- PreservesAllServices: unmarshals a four-service payload and asserts every <Service> survives, guarding against the single-value field regression - PreservesInnerXML: unmarshals a Media <Capabilities> block under trt, asserts Capabilities.Any captures the raw XML, then re-unmarshals into a service-specific type to confirm the consumption pattern
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.
Summary
Fixes two bugs in
device.GetServicesResponsethat made the parsed result diverge from what the ONVIF WSDL declares.Servicewas a single value despite the WSDL declaringmaxOccurs="unbounded", so every<Service>element except the last was silently dropped during unmarshal.Service.Capabilitieswas an embedded type with an untaggedAny string, so the per-service<Capabilities>payload (declared asxs:anywith a service-specific namespace) was never captured —IncludeCapability=truewas effectively useless.Closes #65