I am using Swagger data annotations (x.EnableAnnotations();) and everything is working as intended in the AspNetCore app's controllers. I am able to use annotations like SwaggerOperation and SwaggerResponse to document my controllers.
Now I want to annotate my classes. Something like
public class Record : Base
{
[SwaggerSchema(WriteOnly = true)]
public string AppId { get; set; }
}
My classes are in a different project from the AspNetCore app. They are DTOs and they are in their own class library. The issue is when I try install Swashbuckle.AspNetCore.Annotations in the class library I get an error in my Blazor client app that references my DTO class library.
I think the actual issue is that Swashbuckle.AspNetCore.Annotations cannot be referenced into a class library project, so doesn't work there, yet pops up on the Blazor app side.
That said I can't imagine I am the only one who has DTOs outside their main AspNetCore app.
What am I missing? Is there some other way to annotate classes in Swagger that should be used in a situation like this?