Swagger-ui: "$ref" links in examples should not try to be resolved

Created on 17 May 2018  路  2Comments  路  Source: swagger-api/swagger-ui

  • OS: windows 10
  • Browser: any (tested on firefox)
  • Version: 60.0 (firefox)
  • Method of installation: dist assets
  • Swagger-UI version: 3.14.2
  • Swagger/OpenAPI version: OpenAPI 3.0

Example Swagger/OpenAPI definition:

openapi: 3.0.0
info:
  title: Test Api
  version: '1.0'
paths:
  /services:
    get:
      summary: Returns a list of all available services
      operationId: serviceListRequest
      tags:
        - Services
      responses:
        '200':
          description: An array of services
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                    name:
                      type: string
                    roles:
                      type: array
                      items:
                        type: object
                        properties:
                          value:
                            type: string
                          $ref:
                            type: string
                          display:
                            type: string
                example:
                  - id: 1244d92f-332e-4eca-90a9-3e7d4627cf7a
                    name: Licensing groups
                    roles:
                      - value: 00000000023459FE
                        $ref: /http://api.example.org/users/00000000023459FE
                        display: Jessica Brandenburg

Error

2018-05-17_10h10_47

Expected behavior

$ref links should not be resolved in examples.
Would be nice to have any workaround for it.

--
Thanks,
Alex

rendering specification lock-bot swagger-js bug

Most helpful comment

Thanks for the report @arrcher - my Swagger Client fix for this will be picked up in the next version of Swagger UI 馃帀

All 2 comments

This seems like a change that's okay to make (Example Object value fields don't directly support references).

@webron, any thoughts?

Edit: he said "yeah, it shouldn鈥檛 resolve it."

Thanks for the report @arrcher - my Swagger Client fix for this will be picked up in the next version of Swagger UI 馃帀

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bebraw picture bebraw  路  32Comments

peter004 picture peter004  路  49Comments

azamatsulaiman picture azamatsulaiman  路  34Comments

replaysMike picture replaysMike  路  120Comments

valdemon picture valdemon  路  37Comments