Skip to content

feat(coserv): add coserv API discovery document#272

Merged
thomas-fossati merged 2 commits into
veraison:mainfrom
MonakaResearch:main
Jun 11, 2026
Merged

feat(coserv): add coserv API discovery document#272
thomas-fossati merged 2 commits into
veraison:mainfrom
MonakaResearch:main

Conversation

@shefali-kamal

Copy link
Copy Markdown

Fixes #262

@thomas-fossati thomas-fossati left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks!

I have left a couple of easy comments inline.

Comment thread coserv/discovery.go Outdated
Comment on lines +119 to +121
if !strings.HasSuffix(queryResponse, "{query}") {
return ErrInvalidRequestResponseEndpoint
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In theory, there’s another thing that must be checked:

"There MUST NOT be any other variables that require substitution.”

Additinaolly, there’s an implicit requirement that the string should parse as a URI and the URI must not be absolute.

Comment thread coserv/discovery.go Outdated
if len(o.ApiEndPointsMap) < 1 {
return ErrEmptyApiEndPoints
}
queryResponse, ok := o.ApiEndPointsMap["CoSERVRequestResponse"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Unsure what queryResponse is supposed to mean?

Perhaps a slightly more evocative name could be requestResponseURI or similar.

@shefali-kamal

Copy link
Copy Markdown
Author

LGTM, thanks!

I have left a couple of easy comments inline.

@thomas-fossati comments are addressed. Please review.

@thomas-fossati thomas-fossati left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for addressing my comments!

@yogeshbdeshpande yogeshbdeshpande self-requested a review June 9, 2026 16:43
Comment thread coserv/discovery.go
ErrNoRequestResponseEndpoint = errors.New("could not find `CoSERVRequestResponse' endpoint")
ErrInvalidRequestResponseEndpoint = errors.New("invalid `CoSERVRequestResponse' endpoint")
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As a reference if you could please add a comment what this structure is used for
and reference any Discovery API document, it is linked to?

Comment thread coserv/discovery.go Outdated

type DiscoveryDocument struct {
Version string `cbor:"1,keyasint" json:"version"`
CapabilitiesList []Capability `cbor:"2,keyasint" json:"capabilities"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The name on Line 29, can mirror the JSON key, ie, it can be
Capabilities instead of CapabilitiesList

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There are methods with those names, which return iterators to the entries. So the same name cannot be used for fields.

Comment thread coserv/discovery.go Outdated
type DiscoveryDocument struct {
Version string `cbor:"1,keyasint" json:"version"`
CapabilitiesList []Capability `cbor:"2,keyasint" json:"capabilities"`
ApiEndPointsMap map[string]string `cbor:"3,keyasint" json:"api-endpoints"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same comment as 29

@yogeshbdeshpande yogeshbdeshpande left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Left few very minor comments, but in General Looks Good to Me, hence I have approved the PR.

DhanusML added 2 commits June 10, 2026 13:14
Implementation of CoSERV well-known response as per
https://datatracker.ietf.org/doc/draft-ietf-rats-coserv/06/.
Also added test cases for discovery document from the draft.

Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
golangci < 2.5.0 uses github.com/tdakkota/asciicheck as
a dependency. But this was moved to github.com/golangci/asciicheck.
So if the former is not available in the cache or in the proxy,
linting tests failed.

golangci v2.5.0 requires go >= 1.24, hence bumped go version.

Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
@shefali-kamal

shefali-kamal commented Jun 11, 2026

Copy link
Copy Markdown
Author

@thomas-fossati and @yogeshbdeshpande thanks for reviewing the PR. All review comments are addressed. Please check and merge if everything looks good. Thanks

@thomas-fossati thomas-fossati merged commit 6c83c1c into veraison:main Jun 11, 2026
5 checks passed
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.

coserv: Implement coserv-well-known-info

4 participants