OpenAPITools / OpenAPITools/openapi-generator
[REQ] Add mapping for openapi.html in OpenApiServlet
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
The interface Generator which every Generator has to implement (like the DefaultGenerator) contains one generate() method that returns List<File>
I think it would be great to be able to generate a String or a List<String>, at least as far as documentation is concerned (e.g. HTML docs). That way one could make a servlet that returns the html static docs without saving them to the filesystem.
I've tried directly accessing the public String compileTemplate(TemplatingExecutor executor, Map<String, Object> bundle, String templateFile) in the MustacheEngineAdapter, but it is not possibile unless you generate the bundle using methods that are package scoped inside the DefaultGenerator.
An alternative solution would be to make the OpenApiServlet recognize the type "html" (in addition to the current json and yaml) and return the html generated docs to the caller, eliminating the need to implement a custom servlet.
Generator
public interface Generator {
Generator opts(ClientOptInput var1);
List<File> generate();
}
MustacheEngineAdapter
public String compileTemplate(TemplatingExecutor executor, Map<String, Object> bundle, String templateFile) throws IOException {...}
DefaultGenerator
Map<String, Object> buildSupportFileBundle(List<OperationsMap> allOperations, List<ModelMap> allModels) {...}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing OpenApiServlet's existing json and yaml response handling, then inspect Generator, DefaultGenerator, and MustacheEngineAdapter to understand how the documentation bundle and templates are produced. Done means agreeing on an approach and supporting an html response without requiring filesystem output or a custom servlet; the issue does not name tests or specific implementation files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, documentation
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100