AnsweredAssumed Answered

Example JSON response in swagger spec causes "LinkedHashMap cannot be cast to String" error

Question asked by JasonArmitage on Mar 22, 2016
Latest reply on Mar 22, 2016 by sdetweil2

I'm trying to make the VS created from our APIs have more realistic responses.  But, although my Swagger spec is valid DevTest 9.0 fails to create the transaction.

The part of the spec it appears to fail on (works when removed) looks like: (full spec is attached)

      responses:

        '200':

          description: OK

          schema:

            $ref: '#/definitions/DomainViewDto'

          examples:

            application/json:

              id: 1507

              name: JasonDomain

              description: Jasons Test Domain

              owner: Jason

              roles:

                - name: Writers

                  membersGroup: "Domain_DEV"

      deprecated: false

 

The stack trace looks like:

java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to java.lang.String

  at com.itko.lisa.vse.swagger.helper.SwaggerHelper.getResponses(SwaggerHelper.java:428)

  at com.itko.lisa.vse.swagger.helper.SwaggerHelper.getTransactions(SwaggerHelper.java:238)

  at com.itko.lisa.vse.stateful.protocol.http.FromSwaggerProtocolHandler.beginRecordProcess(FromSwaggerProtocolHandler.java:319)

  at com.itko.lisa.vse.stateful.protocol.http.FromSwaggerProtocolHandler.configure(FromSwaggerProtocolHandler.java:607)

  at com.itko.lisa.vse.stateful.protocol.http.SwaggerDefinitionsPanel.save(SwaggerDefinitionsPanel.java:190)

  at com.itko.lisa.gui.WizardPanel.savePanel(WizardPanel.java:631)

  at com.itko.lisa.gui.WizardPanel.next(WizardPanel.java:432)

Swagger "examples:" is supported as a text example response works well.

      responses:

        '200':

          description: OK

          schema:

            $ref: '#/definitions/DomainViewDto'

          examples:

            application/text: "Hello World"

      deprecated: false

I have tried both importing both YAML and JSON swagger definitions. (Attached)

Attachments

Outcomes