Hi everyone,
During last week’s platform call, we had an insightful discussion about the current state of our Swagger documentation. As it stands, our approach to maintaining this documentation is both developer-intensive and prone to inconsistencies. The process relies heavily on developers manually specifying which resources, properties, and schemas should be documented. This manual dependency has, over time, led to gaps in the documentation and a general lack of up-to-date information, making it less robust and reliable keeping in mind that we have modules like appointments and others that don’t get documented by our current strategy.
The consensus from our discussion was that we need a more automated and maintainable approach. Ideally, we envision a solution where the documentation is auto-generated by scanning through our codebase. This would include analyzing resource handlers, controllers, models, and other components—extracting relevant details from Javadoc comments, annotations, or other metadata—to produce a comprehensive specification file for Swagger.
While this sounds ideal, it’s clear that the current Swagger ecosystem doesn’t fully support this functionality out of the box. Libraries like springdoc and springfox offer tools for integrating Swagger with Spring-based applications, but they are highly dependent on adherence to conventional REST practices and extensive use of Swagger-specific annotations such as @Api, @ApiResponse, and @Schema.
Implementing these libraries in our context would require significant changes to our existing codebase, particularly in the core data models and resource handlers, where we would need to annotate everything consistently. This level of change might not be feasible given the size and complexity of our codebase, not to mention the potential impact on legacy systems and backward compatibility.
I’d like to open this up to everyone for ideas and suggestions for libraries, tools, or strategies that could help us bridge this gap. The goal is to reduce the overhead of maintaining the documentation while ensuring accuracy and consistency across the board. If anyone has experience with alternative approaches or libraries that support auto-generation of Swagger specs from code , please share your insights.