Forum Discussion

developpef's avatar
developpef
New Contributor
7 years ago
Solved

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

  • developpef's avatar
    developpef
    7 years ago

    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.

    "

5 Replies

  • 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!

    • developpef's avatar
      developpef
      New Contributor

      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

       

       

       

       

      • developpef's avatar
        developpef
        New Contributor

        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.

        "