C
C#4w ago
Elykx

Can't override OpenApiSchema

Hello devs, Someone can tell me what is wrong in this code:
.WithOpenApi(
opts =>
{
OpenApiParameter? sourcesParameter = opts.Parameters[0];
sourcesParameter.Description = "Sources";
sourcesParameter.Schema = new()
{
Type = "array",
Items = new OpenApiSchema
{
Type = "string",
Enum = new List<IOpenApiAny>()
{
new OpenApiString("value1"),
new OpenApiString("value2")
}
}
};

return opts;
}
.WithOpenApi(
opts =>
{
OpenApiParameter? sourcesParameter = opts.Parameters[0];
sourcesParameter.Description = "Sources";
sourcesParameter.Schema = new()
{
Type = "array",
Items = new OpenApiSchema
{
Type = "string",
Enum = new List<IOpenApiAny>()
{
new OpenApiString("value1"),
new OpenApiString("value2")
}
}
};

return opts;
}
It seems that i can't override the Schema property in my OpenApi documentation. In debug, the property is correctly overriden, but in my swagger.json, it is not displayed
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server