Код: Выделить всё
public record Response
{
public ImmutableList? Completes { get; init; } = null;
public ImmutableList? Incompletes { get; init; } = null;
.... // rest of class here
}
Код: Выделить всё
"Response": {
"type": "object",
"properties": {
"Completes": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TypeA"
},
"nullable": true
},
"Incompletes": {
"type": "array",
"items": {
"$ref": "#/components/schemas/#/properties/Completes/items"
},
"nullable": true
}
}
< /code>
Обозначение пути для $ ref of "incopletes" недопустим с токеном "#" в середине пути, для инструментов API Gateway, которые я использую. Вместо этого я хотел бы, чтобы он просто ссылался на фактическую схему вместо предыдущего свойства того же типа, то есть: < /p>
"Response": {
"type": "object",
"properties": {
"Completes": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TypeA"
},
"nullable": true
},
"Incompletes": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TypeA"
},
"nullable": true
}
}
Код: Выделить всё
services.AddOpenApi(ConfigureApiGen);
confgureApigen делает некоторые простые вещи, такие как настройка имен документов и т. Д.>
Подробнее здесь: https://stackoverflow.com/questions/794 ... revious-pr