Skip to content

fix: cleanComments filter not applied to api.title and api.description in api-endpoint.njk #4064

Open

Description

@R1zoro

Summary

The cleanComments filter in filters.ts (lines 85–93) neutralises */ and /*
to prevent them from escaping JSDoc block comments in generated TypeScript. It is
applied to every method, parameter, and schema description field in
api-endpoint.njk, but is missing from api.title and api.description
at lines 58 and 60.

Expected behaviour

api.title and api.description are sanitised with cleanComments, consistent
with every other description field in the same template.

Actual behaviour

Both fields are rendered raw. The filter already exists and already handles this
case, it is simply not applied to these two fields.

Proposed fix

Two-line change in src/generator/templates/api-endpoint.njk:

Line 58
Before: * {{ api.title }}
After: * {{ api.title | cleanComments | safe }}

Line 60
Before: * {{ api.description | replace("\n", "\n * ") }}
After: * {{ api.description | cleanComments | safe | replace("\n", "\n * ") }}

I'm happy to submit a PR if the fix looks good.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions