C# Swagger Api文档-型号列表<;Enum>;
这个类应该如何建模以正确解释它C# Swagger Api文档-型号列表<;Enum>;,c#,asp.net,swagger,C#,Asp.net,Swagger,这个类应该如何建模以正确解释它 public myEnum { alpha, bravo, charlie } public class myClass { public List<myEnum> myList { get; set; } } 这也没有意义: { "myEnum": { "id": "myEnum", "properties": { //??? there aren't
public myEnum {
alpha,
bravo,
charlie
}
public class myClass {
public List<myEnum> myList { get; set; }
}
这也没有意义:
{
"myEnum": {
"id": "myEnum",
"properties": {
//??? there aren't any...
}
},
"myClass": {
"id": "myClass",
"properties": {
"myList": {
"type": "List",
"items": {
"$ref": "myEnum"
}
}
}
}
}
这让我想到了这个答案:
{
"myClass": {
"id": "myClass",
"properties": {
"myList": {
"type": "List",
"items": {
"type": "string"
},
"allowableValues": {
"valueType": "LIST",
"values": [
"alpha",
"bravo",
"charlie"
]
}
}
}
}
}
{
"myClass": {
"id": "myClass",
"properties": {
"myList": {
"type": "List",
"items": {
"type": "string"
},
"allowableValues": {
"valueType": "LIST",
"values": [
"alpha",
"bravo",
"charlie"
]
}
}
}
}
}