Repository navigation
feat: expose selected CDD service catalogs - #57
Merged
Merged
Conversation
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.
CDD parsing currently selects the first ECU/variant and exposes only DID records, so a consumer cannot browse the full diagnostic catalog or distinguish missing services from unsupported layouts. This change separates document parsing from catalog selection and preserves classes, standalone instances, and their services in source order. Unsupported entries remain visible with diagnostics.
Draft pending consumer integration validation.
API changes
ParseandParseFilereturn aDocument. ItsECUsexpose variant choices;Document.Select(Selection{ECU: 1, Variant: 1})resolves one catalog. Indexes are one-based. Zero selects automatically only when there is exactly one choice at that level. Variants are not merged.Database.Entriespreserves interleaved classes and standalone instances. Services own their source/template identities, literal requirements, request and positive-response metadata. Existing single-record codecs resolve independently for each service alternative.DID.ReadandDID.Writeare service slices; their records are reached throughPositiveResponse.RecordandRequest.Record. Repeated names or identifiers remain visible but make the corresponding lookup ambiguous.Record.CodecError()exposes codec availability without attempting an encode/decode.See
cdd/example_test.gofor a runnable selection, enumeration, and decoding example. The UDS DID lifecycle test uses the new API.Literal state references retain the PR 55 contract: omitted states do not imply permission, and template rules/exclusions remain unresolved. Whole-message encoding, DTC semantics, and automatic session/security changes remain outside this change. DID views recognise the literal SID/identifier shape; they do not establish that an ECU uses UDS.
Validation
go test -race ./...go vet ./...gofmt -l .git diff --checkNote
Medium Risk
Breaking public
cddAPI and DID shape affects any consumer still callingParsefor aDatabaseor encoding viadid.Read/did.Writedirectly.Overview
Breaking API:
Parse/ParseFilenow return aDocumentwith ECU/variant choices;Document.Selectbuilds a per-selectionDatabaseinstead of always using the first ECU/variant.The catalog is no longer “DID records only.”
Database.Entrieskeeps classes, standalone instances, and services (protocol binding, REQ/POS parameters, per-service Requirements, transitions). Unsupported or broken services stay in the catalog with typedDiagnostics(path, source, kind). Duplicate XML ids are treated as ambiguous references rather than last-wins.DIDs are views over matching read/write services:
Read/Writeare service slices; payloads usePositiveResponse.Record/Request.Record. Lookups by name or identifier fail when ambiguous, but all DIDs remain listed. Record codecs gainCodecError()and metadata (localized text, field grouping); preconditions move from records to services.README and
udstests are updated for the two-step parse → select flow and the new record paths.Reviewed by Cursor Bugbot for commit 1f221da. Configure here.