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

Clarification of the meaning of '?' in a request #456

Closed
tromey opened this issue Jan 22, 2024 · 1 comment
Closed

Clarification of the meaning of '?' in a request #456

tromey opened this issue Jan 22, 2024 · 1 comment

Comments

@tromey
Copy link

tromey commented Jan 22, 2024

We got a bug report against the gdb DAP implementation. You can see the thread here: https://sourceware.org/pipermail/gdb/2024-January/051056.html

The bug seems to be that the client in this case sends:

{"arguments": null, "command": "configurationDone", "seq": 2, "type":  "request"}

My question is -- is this valid? The configurationDone request does say:

interface ConfigurationDoneRequest extends Request {
  command: 'configurationDone';

  arguments?: ConfigurationDoneArguments;
}

However, the real meaning of the ? does not seem to be spelled out anywhere. Is null an allowable value here? I wrote the gdb adapter to assume that optional values would simply be omitted -- but it's no problem to change if null is valid.

I think it would be good to be explicit about this.

@connor4312
Copy link
Member

No, this is not valid. The point of truth for DAP is its JSON schema. In JSON schema, null is not a valid replacement for optional object properties. You can test this in any JSON scheme validator by trying to validate {"foo":null} with a schema like.

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type":"object",
    "properties": { "foo": { "type": "string" } }
}

(It is also not a valid replacement for optional object properties in TypeScript, which is how the interfaces are shown on the specification page)

This is a bug in the client.

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

No branches or pull requests

2 participants