Skip to content

New interface for custom schema parser #480

Closed

Description

@magicmatatjahu

It will introduce breaking change so this should be done when rewriting the parser to the IntentAPI and TS

Reason/Context

Currently, custom parsers for the massage's payload (and in the 3.0.0 AsyncAPI version this will be made available to all schemas) have two methods: parse(), which parses the given format into an AsyncAPI JSON Schema, which is later used in ModelAPI (in 2.0.0 version of lib it will be IntentAPI), and getMimeTypes() which returns the mime types that specify the given schema format. We are missing 3 functions validate, which would return possible errors if a given schema has syntax errors.

Description

We should update all custom schema parsers to have that third function and it should be mandatory.

Due to the fact that RAML/OpenAPISchema/AVRO can be described using YAML or JSON we can easily validate them using JSON Schema and AJV and then combine the validation with Spectral from Stoplight (see more #477).

cc @jonaslagoni @smoya

Activity

  1. added
    enhancement
    on Mar 3, 2022
  2. magicmatatjahu commented on Mar 3, 2022

    @magicmatatjahu
    MemberAuthor

    I wonder if there should be also a method that would validate the example based on the schema (use case asyncapi/studio#200). We can of course convert the format to AsyncAPI JSON Schema and validate on that, but I wonder if it would make sense. It should be discussed.

  3. smoya commented on Jun 27, 2022

    @smoya
    Member

    @magicmatatjahu I would love to work on this issue so I can get more knowledge on how Stoplight integrates with the Parser. It would need, however, to happen next week. Hope you are ok with that @magicmatatjahu 🙏

  4. magicmatatjahu commented on Oct 25, 2022

    @magicmatatjahu
    MemberAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions