Reply
New Contributor
Posts: 4
Registered: ‎11-14-2017
Accepted Solution

Callbacks definition gives console error

Hello,

 

I have an error in UI view when defining a callback : 😱 Could not render this component, see the console.

 

In console (Chrome), error is : Cannot convert undefined or null to object.

 

Complete trace is attached.

 

Does anyone can help on this?

 

Thanks

Highlighted
Moderator
Posts: 39
Registered: ‎07-13-2015

Re: Callbacks definition gives console error

Hi!

 

Sorry to hear about the issue with defining callbacks.

If your API is public, can you share it with us?

 

If not, can you share here the relevant portion of the definition? Or could you add our support user (swaggerhub-support) as a collaborator so we can take a look?

 

Thanks!

New Contributor
Posts: 4
Registered: ‎11-14-2017

Re: Callbacks definition gives console error

[ Edited ]

Hi,

 

Here is the definition snippet that causes the issue :

 

  /realtime/events:
    post:
      summary: 'Souscrire aux évènements en temps réel, via des webhooks'
      description: |
        Souscrire aux évènements en temps réel, via des webhooks.
      tags:
        - Device
        - Webhook
        - IoT
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - callbackUrl
                - targetAssets
                - jwt
              properties:
                callbackUrl: # Callback URL
                  type: string
                  format: uri
                  example: https://myserver.com/send/callback/here
                targetAssets:
                  description: Identifiants des Assets pour lesquels il faut transmettre les données.
                  type: array
                  items:
                    type: string
                jwt:
                  type: string
                  description: JSON Web Token fourni par l'application métier afin que le serveur puisse authentifier les requêtes de callback.
      responses:
        '201':
          description: Webhook created
      callbacks: # Callback definition
        alarmEvent: # Event name
          '{$request.body#/callbackUrl}': # The callback URL
            post:
              requestBody: # Contents of the callback message
                required: true
                content:
                  application/json:
                    schema:
                      oneOf:
                        - type: object
                          additionalProperties: false
                          properties:
                            code:
                              type: number
                              description: Code d'erreur
                            message:
                              type: string
                              description: Message d'erreur
                        - type: object
                          description: Objet technique
              responses: 
                '200':
                  description: Your server returns this code if it accepts the callback

 

And a screenshot

 

 Capture1.PNG

 

 

New Contributor
Posts: 4
Registered: ‎11-14-2017

Re: Callbacks definition gives console error

FYI, I got some help from support chat in SwaggerHub : 

 

"

Anastasia Khovrina

It works fine in the open source Editor: http://editor.swagger.io/#/

 

Me

So, it's specific to SwaggerHub?

 

Anastasia Khovrina

It looks like yes, but I will need to consult with our developers regarding this. Also, I will open a new support case for this issue.

"

New Contributor
Posts: 4
Registered: ‎11-14-2017

Re: Callbacks definition gives console error

Waiting for Case 00268781 resolution.