I have GET API, which takes Map as a request param. How to define this in Open API 3.0, in yaml format
@GetMapping
public void getDevicesInfo(@RequestParam(required = false) Map parameters)
{
}
Open API is not supporting Map type.
In your YAML
file you need to add additionalProperties
for Map
in Java and use parameters
for @RequestParam
as :
/api/v1/test:
get:
tags:
- test
operationId: getDevicesInfo
parameters:
- name: parameters
in: query
required: false
schema:
type: object
additionalProperties:
type: object
responses:
'200':
description: OK
The generated GET API looks like:
I hope it helps you :)