-
Notifications
You must be signed in to change notification settings - Fork 6k
HTML output exception: preprocessSwagger(StaticHtmlGenerator.java:186) #6506
Description
Description
When trying to generate html from either valid swagger 2 yaml or json, I get the following exception pasted below. I looked up the code line 186 (it's the "for" loop):
public void preprocessSwagger(Swagger swagger) {
Info info = swagger.getInfo();
info.setDescription(toHtml(info.getDescription()));
info.setTitle(toHtml(info.getTitle()));
Map<String, Model> models = swagger.getDefinitions();
for (Model model : models.values()) {
model.setDescription(toHtml(model.getDescription()));
model.setTitle(toHtml(model.getTitle()));
}
}
But, my swagger has a title and a description.
[main] INFO io.swagger.parser.Swagger20Parser - reading from ./api.oas.2.0.yaml
Exception in thread "main" java.lang.NullPointerException
at io.swagger.codegen.languages.StaticHtmlGenerator.preprocessSwagger(StaticHtmlGenerator.java:186)
at io.swagger.codegen.DefaultGenerator.configureGeneratorProperties(DefaultGenerator.java:134)
at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:687)
at io.swagger.codegen.cmd.Generate.run(Generate.java:285)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
Swagger-codegen version
2.2.3 installed using linux homebrew today
Swagger declaration file content or url
The yaml and json are online here:https://github.com/hmis-api/user-service-api/blob/master/api-markup/api.oas.2.0.json and here: https://github.com/hmis-api/user-service-api/blob/master/api-markup/api.oas.2.0.yaml .
Command line used for generation
/home/eric/.linuxbrew/bin/swagger-codegen generate -i ./api.oas.2.0.yaml -l html -o /home/eric/git/user-service-api/api-markup/
Steps to reproduce
run command
Related issues/PRs
no
Suggest a fix/enhancement
parsing the title and description should even allow a null