Skip to content

Warning printed when generating static html docs #3874

@davidsantiago

Description

@davidsantiago
Description

When using language 'html', the generator spits out repeated warnings:

escapeUnsafeCharacters should be overridden in the code generator with proper logic to escape unsafe characters
escapeUnsafeCharacters should be overridden in the code generator with proper logic to escape unsafe characters
escapeUnsafeCharacters should be overridden in the code generator with proper logic to escape unsafe characters

(Many more times than I've quoted here).

Swagger-codegen version

2.2.2-SNAPSHOT

Command line used for generation

Called from gradle tasks with the following options:

  inputSpec = './src/main/resources/spec.yaml'

  output = 'build/api_docs'
  language = 'html'

  additionalProperties = sharedAdditionalProperties
Steps to reproduce

Run the generator on language 'html'.

Suggest a Fix

It appears to be related to this line of code: https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java#L362

The Static HTML generator does not override this method: https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticHtmlGenerator.java

Naively, it looks to me like this function should be implemented, even if only to suppress the warning, which a user can't do anything about. But I definitely don't understand the code injection issue the code is intending to prevent. I looked at the Java and Swift implementations of this method and do not understand it, for example. Otherwise, happy to help push this forward.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions