0

I am working on a project using JSON-LD as input and output format in Kafka. Now, I would like to define the messages with AsyncAPI for our documentation. But I am running into issue modeling attributes like @id or @type. The AsyncAPI provides an error as soon as I add the "@" sign. According to the JSON-LD standard, JSON-LD is a valid JSON. So, it should work with AsyncAPI correct? Or where is my misunderstanding?

We found the following errors in your AsyncAPI document: bad indentation of a mapping entry at line 17, column 11: @id: ^

jonaslagoni
  • 663
  • 7
  • 23
Stburcher
  • 64
  • 12

1 Answers1

0

TLDR: Just because it is allowed to do, does not mean tooling support it. The way to support this is by creating a feature request in the parser.

While JSON-LD might be a valid JSON and definitely allowed to be used, the tooling needs to know how to interpret it. The specification has a set of required Schema formats for which all tooling must support and others that are recommended. JSON-LD is unfortunately at the moment, not part of that list, which is why you find the missing support.

I suspect that you use something like the AsyncAPI playground which is giving you this error?

In that case, the root course of the problem is that beneath everything the parser, that parses the AsyncAPI document, does not recognize the format for which you provided. You can read more about it here: https://github.com/asyncapi/parser-js#custom-message-parsers

For simplicity, any payload schema you define, may it be RAML, OpenAPI schema, AVRO, or any other, even JSON-LD, is behind the scene converted to JSON Schema. The reason for this is because the complexity in tooling would be too much if they needed to understand all these different formats.

So, while it may be possible to define the payload with JSON-LD, it does not necessarily mean that tooling support it.

Therefore, do you mind adding a feature request for the parser for this feature?

jonaslagoni
  • 663
  • 7
  • 23