DnsServer icon indicating copy to clipboard operation
DnsServer copied to clipboard

FEAT: Generate OpenAPI Spec

Open djarbz opened this issue 3 months ago • 8 comments

Having documentation on the API endpoints and usage is fantastic, but if there were a generated OpenAPI spec, we could create tooling to easily interact with the API rather than needing to manually code each endpoint.

djarbz avatar Oct 03 '25 21:10 djarbz

Thanks for the request. This may take long time to implement since creating a doc in new format will take a week or two of full time daily work which is something that is not currently feasible.

ShreyasZare avatar Oct 04 '25 07:10 ShreyasZare

Out of curiosity, are there not tooling that can generate a spec from the running codebase?

I know at least on the java side, tools like springdoc exists which generates a openapi spec at runtime from the running code.

ruifung avatar Nov 17 '25 02:11 ruifung

@ruifung I use Swagger for my Golang APIs. All it takes is a bit of documentation at the function level.

djarbz avatar Nov 17 '25 02:11 djarbz

I meant for dotnet, because a short while ago I dabbled with the idea of writing a more comprehensive pulumi provider for T-DNS... and promptly shelved it because translating that API markdown file into golang is not something I feel like doing manually at the time.

ruifung avatar Nov 17 '25 02:11 ruifung

It looks like ASP.NET Core has native support for the OpenAPI Spec. https://learn.microsoft.com/en-us/aspnet/core/fundamentals/openapi/overview?view=aspnetcore-10.0&preserve-view=true

djarbz avatar Nov 17 '25 03:11 djarbz

It looks like ASP.NET Core has native support for the OpenAPI Spec. https://learn.microsoft.com/en-us/aspnet/core/fundamentals/openapi/overview?view=aspnetcore-10.0&preserve-view=true

I have tried using that but it seems to work only with standard way of writing ASP.NET apps and not the way its being used in the DNS server.

ShreyasZare avatar Nov 17 '25 10:11 ShreyasZare

Another tissue is that the API is not faithful to the RESTful principles. Some API endpoints are specifically designed for the dashboard. Therefore they contain state for the dashboards. In order to be able to use pure RESTful OpenAPI specs, there is some extra work to be done between the backend and frontend communication, roles and responsibilities.

zbalkan avatar Nov 22 '25 20:11 zbalkan

Another tissue is that the API is not faithful to the RESTful principles. Some API endpoints are specifically designed for the dashboard. Therefore they contain state for the dashboards. In order to be able to use pure RESTful OpenAPI specs, there is some extra work to be done between the backend and frontend communication, roles and responsibilities.

True. The project does not implement REST API. Its just a simple HTTP API that works with GET or POST for most calls.

ShreyasZare avatar Nov 23 '25 11:11 ShreyasZare