Default values in the Swagger file not populated in Developer Portal.

Not applicable

The default values for fields defined in the swagger file are not populated in devportal . This however works in swagger editor. Is this a known issue? How do I resolve this? Details below.


YAML

/GetTicketListService:

post:

summary: Get ticket list

description: Ask for a list of Open tickets within Verizon by the ITIL Ticket Type with the latest CTI, status and priority.

parameters:

-

name: version

in: formData

description: Service version of the request. **Example:** **v1 or V1**.

required: true

type: string

maxLength: 2

default: v1

-

name: transactionID

in: formData

description: Alpha numeric unique identifier to uniquely identify each request from the customer system.

required: true

type: string

maxLength: 50

default: EOutHPSXIM51226

Developer Portal:

3918-image002.png


Swagger Editor:

3919-image001-1.png

0 1 1,789
1 REPLY 1

The `default` value is one of the trickier parts of the OpenAPI Spec. From the official OAS documentation:

Declares the value of the parameter that the server will use if none is provided, for example a "count" to control the number of results per page might default to 100 if not supplied by the client in the request.

In the editor, the value may be shown as default, but that is to indicate the server-value. In SmartDocs, the `default` value isn't used because it is constructing a request from the client perspective, in which case `default` has no meaning.

Ron wrote an excellent blog post about this this last year. The 3.0 version of the spec is considering `example` as a more obvious approach to suggested values in documentation and tools, but that hasn't been finalized yet.