![](/img/trans.png)
[英]Open api 3.0 java code generator - How to generate instantiated lists?
[英]How to define Map objects in Open API 3.0, for GET API
我有 GET API,它將 Map 作為請求參數。 如何在 Open API 3.0 中以 yaml 格式定義它
@GetMapping
public void getDevicesInfo(@RequestParam(required = false) Map parameters)
{
}
Open API 不支持 Map 類型。
在您的YAML
文件中,您需要在 Java 中為Map
添加additionalProperties
並使用@RequestParam
parameters
為:
/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
生成的 GET API 如下所示:
我希望它可以幫助你:)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.