Skip to content

Proposal for Unparsable Remote References (mainly to support XML.) #624

@damaru-inc

Description

@damaru-inc

Solace has customers who love AsyncAPI but use XML payloads in their messaging systems. Also, the question of whether things like XSD schemas are supported has come up more than once in the Slack channels.

We would like to propose the notion of an Unparsable Remote Reference. These would be, at minimum, URLs represented by simple strings. By Unparsable we mean that in general, AsyncAPI parsers would not be expected to retrieve and/or parse the entities pointed to by these references. Code generators, on the other hand, could use these references.

The use case we are trying to solve immediately is how to provide a URL to an XSD schema, so that a code generator could created a model class from the schema and use it with XML libraries for serializing messages.

One simple way to do this is one that requires no change to the specification nor to the parser. A message could look like this:

messages:
    myXmlMessage:
      payload:
        remoteReference: "https://example.com/myschema.xsd"
      contentType: "application/xml"

(This fragment works fine with the current parser, you can try it in the playground.)

When this message is passed back from the parser, the payload contains an anonymous schema containing the field remoteReference with its value.

An improvement would be to create a parser plugin (similar to the avro parser. That would allow us to also specify the schemaFormat (currently the parser will fail if you try to set the schemaFormat to application/xml - that won't work now because there is no schema parser defined for that format.)

Yet another improvement would be to allow an object representing a schema registry, in cases where it would be desirable to add more fields besides just a URL.

This mechanism would also allow users to use Avro files in their original form (the current avro parser translates to JSON schema), and it could also be used to support protobuf or any other kind of schema.

The name remoteReference was intended to be general enough to be applied to other use cases, not just non-JSON schemas.

Ideally it would be nice to have a standard, documented way to do this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions