How to Load Different Datasets into SwaggerUI?
Apologies if this was already asked, I'm having trouble finding a solution to this and new to Swagger.
I am creating a SwaggUI documentation for various APIs. I want to populate them with examples to test the endpoints. We have different server environments that share the endpoints but require different data for parameters. In this example I am using (sample code only) the examples tag on all three parameters to give different values for qa and rnd servers. However it can be tedious to have to manually select qa for all 3 servers. I was wondering if there was a way to only use 1 dropdown box to set all the parameters to qa value or rnd value? I know theres arrays and dictionaries for swagger but haven't found how to load the array into the parameters.
openapi: 3.0.0
info:
title: Some API
version: 1.0.0
paths:
/logon:
get:
summary: Login user
tags:
- '/logon'
parameters:
- name: Client
in: query
required: true
examples:
rnd:
value: 'rnd client value'
qa:
value: 'qa client value'
schema:
type: string
- name: Service
in: query
required: true
examples:
rnd:
value: 'rnd service value'
qa:
value: 'qa service value'
schema:
type: string
- name: RandomParameter
in: query
required: true
examples:
rnd:
value: 'rnd random value'
qa:
value: 'qa random value'
schema:
type: string
responses:
'200':
description: Success responseI ended up just creating a groovy script using its GStringTemplateEngine to replace ${var} with respective dataset.