CardanoSolutions / ogmios

❇️ A WebSocket JSON/RPC bridge for Cardano
https://ogmios.dev
Mozilla Public License 2.0
304 stars 90 forks source link

fault definitions missing from JSON-WSP schema #20

Closed rhyslbw closed 3 years ago

rhyslbw commented 3 years ago

What Git revision are you using?

b3eb7596661be2a5d013a321f0dc8fbec781d492

What operating system are you using, and which version?

Describe what the problem is?

The following response was returned when calling an unknown query:

 {
      version: '1.0',
      fault: { string: 'Invalid request: invalid query.', code: 'client' },
      servicename: 'ogmios',
      type: 'jsonwsp/fault'
    }

... however there is no definition in the schema and therefore unexpected.

What should be the expected behavior?

Faults definitions in the schema, as per https://handwiki.org/wiki/JSON-WSP

KtorZ commented 3 years ago

I am not 100% positive about how to handle /document that one. In principle, faults only occurs when clients submit invalid queries; that can occur pretty much in any request and the behavior is specified by the WSP specification.

However, it could be indeed document as a top-level definition in the json-schema, since the different type of client faults are known already and could be listed. Is this what you're suggesting?

rhyslbw commented 3 years ago

Is this what you're suggesting?

Yes. It means the possible response is then included in any generated code that uses the JSON-WSP schema as a source.

KtorZ commented 3 years ago

Now documented as a top-level definition in the schema (Fault): https://github.com/KtorZ/cardano-ogmios/commit/4fcb0437d7935d71a8c9c1cdf2c75af21a5c5e02