我使用 Swagger Core 2.0.2 for Java 来生成 OpenAPI 文档。其中,我有以下课程SomeDTO:
@Schema(name = "SomeDTO", description = "some description")
public class SomeDTO {
@Schema(description = "description of name")
private String name;
@Schema(required = true, description = "description of OtherDTO")
private OtherDTO otherDTO;
}
Run Code Online (Sandbox Code Playgroud)
OtherDTO 描述如下:
public class OtherDTO {
@Schema(required = true)
private String someField;
private String someOtherField;
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,无论是description也不是required上述场otherDTO场有任何影响。
结果openapi.json如下所示:
"components": {
"schemas": {
"SomeDTO" : {
"type": "object",
"properties": {
"name": …Run Code Online (Sandbox Code Playgroud) 我正在从seaborn的数据框中创建一个线图,我想向该图添加一条水平线。效果很好,但是我无法在图例中添加水平线。
这是一个最小的可验证示例:
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
x = np.array([2, 2, 4, 4])
y = np.array([5, 10, 10, 15])
isBool = np.array([True, False, True, False])
data = pd.DataFrame(np.column_stack((x, y, isBool)), columns=["x", "y", "someBoolean"])
print(data)
ax = sns.lineplot(x="x", y="y", hue="someBoolean", data=data)
plt.axhline(y=7, c='red', linestyle='dashed', label="horizontal")
plt.legend(("some name", "some other name", "horizontal"))
plt.show()
Run Code Online (Sandbox Code Playgroud)
结果如下图:
“某些名称”和“某些其他名称”的图例正确显示,但“水平”图例只是空白。我尝试简单地使用, plt.legend()但图例由数据集中看似随机的值组成。
有任何想法吗?