In the portal, the swagger UI shows an error even when a required field has value

Hi,

I have added a OpenAPI spec as a documentation for one of the API in the Catalogue. One of the required parameters is defined as follows:
"accept-version": { "name": "Accept-Version", "in": "header", "description": "The version of the API", "required": true, "type": "string", "enum": [ "v3" ] }
In the swagger UI from the Portal, when I click on “Execute”, it does not run the “Curl” command. Instead, it turns the input field in a error state(red border), although the value of the input field(dropdown) is “v3”.

Any ideas why the Swagger UI embedded in the Portal does this and how to overcome this?

thanks,
Suman

Can you share your swagger file?

Here is the swagger file that I uploaded:

swagger: '2.0'
info:
  version: 'v3'
  title: Users API
schemes:
  - https
host: httpbin.org
basePath: /api
consumes:
  - application/vnd.api+json
produces:
  - application/vnd.api+json
parameters:
  accept-version:
    name: Accept-Version
    in: header
    description: The version of the API
    required: true
    type: string
    enum:
      - v3
paths:
  '/users/{user_id}':
    get:
      parameters:
        - $ref: '#/parameters/accept-version'
        - name: user_id
          in: path
          required: true
          description: The User's Id
          type: integer
          format: int64
      responses:
        '200':
          description: The details of the user
          schema:
            properties:
              data: 
                $ref: '#/definitions/User'
        '404':
          description: >-
            A user with the provided user ID does not exist.
          schema:
            type: object
            properties:
              errors:
                $ref: '#/definitions/Errors'
definitions:
  Error:
    type: object
    properties:
      id:
        type: string
        description: A unique identifier for this particular occurrence of the problem.
      status:
        type: string
        description: The HTTP status code applicable to this problem.
      code:
        type: string
        description: 'An application-specific error code, expressed as a string value.'
      title:
        type: string
        description: >-
          A short, human-readable summary of the problem which is not specific
          to this occurrance.
      detail:
        type: string
        description: >-
          A human-readable explanation specific to this occurrence of the
          problem.
      source:
        type: object
        properties:
          pointer:
            type: string
            format: json-pointer
            description: >-
              A [JSON Pointer](https://tools.ietf.org/html/rfc6901) to the
              associated entity in the request document.
          parameter:
            type: string
            description: The URI query parameter that caused the error.
  Errors:
    type: array
    items:
      $ref: '#/definitions/Error'
  User:
    type: object
    properties:
      id:
        type: string
        readOnly: true
      type:
        type: string
        enum:
          - 'users'
      attributes:
        type: object
        properties:
          email:
            type: string
          first_name:
            type: string
          last_name:
            type: string
          created_at:
            type: string
            format: date-time
            readOnly: true
          updated_at:
            type: string
            format: date-time
            readOnly: true

Hi,

We reviewed yours api spec and noticed that “enum:” isn’t defined well. Enum should contains array.

Here is working exmaple:

parameters:
  accept-version:
    name: Accept-Version
    in: header
    description: The version of the API
    required: true
    type: string
    enum:
      [v3, v4, v4]