studio icon indicating copy to clipboard operation
studio copied to clipboard

Custom schema format produces an error

Open jonaslagoni opened this issue 3 years ago • 5 comments

Describe the bug

Custom schemaFormat gives the following error: T[String(...)] is not a function

Use the following AsyncAPI document:

asyncapi: '2.5.0'
info:
  title: Backend service API
  version: '1.0.0'
  description: |
    This is the website backend service that interact with users.
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0

servers:
  development:
    url: 0.0.0.0:1883
    protocol: mqtt
    description: Local development broker

channels:
  management/new/product:
    description: New order being placed
    publish:
      operationId: consumeNewProduct
      message:
        $ref: '#/components/messages/NewProductMessage'

components:
  messages:
    NewProductMessage:
      name: newProductMessage
      title: New product message
      summary: When a new product has been created.
      schemaFormat: application/schema+json;version=draft-2019-09
      payload:
        type: string

jonaslagoni avatar Oct 18 '22 12:10 jonaslagoni

can i help with this issue

JhoanAlvear avatar Oct 21 '22 22:10 JhoanAlvear

@jonaslagoni you need register custom schemaformt with method registerSchemaParser

JhoanAlvear avatar Oct 24 '22 01:10 JhoanAlvear

@JhoanAlvear IMO the Studio should be able to understand AsyncAPI documents with custom schemas, that is not one of the supported ones, without giving an error 🙂

@magicmatatjahu any guidance you can add to solving it?

jonaslagoni avatar Oct 24 '22 17:10 jonaslagoni

@jonaslagoni @JhoanAlvear I understand that given error message is misunderstood, but we shouldn't change error's message based on JS error's message, so we should handle that problem in the parser-js side. We have PR for that https://github.com/asyncapi/parser-js/pull/449. Also when we will merge it https://github.com/asyncapi/studio/pull/434 we will see these errors:

image

So I think that we can close that issue, wdyt?

magicmatatjahu avatar Oct 25 '22 10:10 magicmatatjahu

Up to you if you want to leave it or remove it, technically it's not solved, so I would probably say leave it 😄

jonaslagoni avatar Oct 25 '22 12:10 jonaslagoni

Fixed by https://github.com/asyncapi/studio/pull/434 PR

image

magicmatatjahu avatar Nov 22 '22 10:11 magicmatatjahu