开放式API->;如何在请求或响应体YAML规范中引用类path/jar的Java对象的外部属性名/类型
我的要求是使用类路径java对象中包含的类的属性名称和类型 基本上,$ref将允许我们使用类路径中包含的类,如下所示开放式API->;如何在请求或响应体YAML规范中引用类path/jar的Java对象的外部属性名/类型,yaml,openapi-generator,Yaml,Openapi Generator,我的要求是使用类路径java对象中包含的类的属性名称和类型 基本上,$ref将允许我们使用类路径中包含的类,如下所示 1) **YML File** paths: /users/{id}: parameters: - name: id in: path required: true description: the user identifier, as userId schema: type: string
1) **YML File**
paths:
/users/{id}:
parameters:
- name: id
in: path
required: true
description: the user identifier, as userId
schema:
type: string
get:
responses:
'200':
description: the user being returned
content:
application/json:
schema:
$ref: "**TESTCALSSOFCLASSPATHORJAR**"
properties:
uuid: # the unique user id
type: string
format: uuid
2) <plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>${openapi-generator-maven-plugin.version}</version>
<configuration>
... excluded for simplicity
<importMappings>
<importMapping>TESTCALSSOFCLASSPATHORJAR=path.to.your.TESTCALSSOFCLASSPATHORJAR</importMapping>
</importMappings>
</configuration>
</plugin>
参考了以下文档并进行了大量搜索,但未找到任何解决方案
如果您有任何建议,我们将不胜感激。您能看看这里的答案吗?
paths:
/users/{id}:
parameters:
- name: **id** -> I want to get this prop from TESTCALSSOFCLASSPATHORJAR class
i.e.TESTCALSSOFCLASSPATHORJAR.id
in: path
required: true
description: the user identifier, as userId
schema:
type: string
get:
responses:
'200':
description: the user being returned
content:
application/json:
schema:
$ref: "**TESTCALSSOFCLASSPATHORJAR**"
properties:
uuid: # the unique user id
type: string
format: uuid