Skip to content

Add some description/examples to swagger #15

Description

@artemkdr

I think it would be better to add some description/examples to both end-points.
As it becomes more complex (for /fill end-point) and not evident now how to pass an image for example.

Also swagger shows the scheme: API.Models.Requests.FillRequest.Field, but we don't have any info about the fields, for example:

  • type - what values are accepted
  • scale - 0..100 or 0..1
  • etc

So probably it's possible to reflect the validation rules automatically in swagger somehow.
Try to add data annotations tags to FillRequest.Field model and to check it swagger shows them:
https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.dataannotations?view=net-8.0

Normally you can do the descriptions via XML comments, it generates a swagger xml file with the documentation.
You can also do it via data annotations (not sure about examples though):
https://learn.microsoft.com/en-us/aspnet/core/tutorials/getting-started-with-swashbuckle?view=aspnetcore-8.0&tabs=visual-studio

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions