Skip to content

Bug: Inconsistent yaml for multiline strings from JSDoc comments #1751

Open
@efrenaguilar95

Description

@efrenaguilar95

I ran into an issue when running a git diff automation to ensure swagger.yaml files are generated before a PR is accepted.

Basically

  • automation runs tsoa spec
  • compares to what is in the current commit
  • if there is a diff, developer is asked to include the latest spec as part of their commit

I recently ran into an issue when using yaml files (have not tested with JSON, probably won't be an issue there)

Running locally a multiline string gets generated as:

schemas:
  jsString:
    description: "String that represents a JavaScript string. These strings
      are not stored in the database, but\r
      
      are used in the application code. API developers are advised to use a
      max size of 255 characters for these,\r

      but there is no enforced limit."

Running in a GitHub action generates: (Notice the lack of quotes, escape characters, and the use of a block scalar)

schemas:
  jsString:
    description: >
      String that represents a JavaScript string. These strings
      are not stored in the database, but
      
      are used in the application code. API developers are advised to use a
      max size of 255 characters for these,

      but there is no enforced limit.

For reference, the JSDoc used to create this is:

/**
* String that represents a JavaScript string. These strings are not stored in the database, but
* are used in the application code. API developers are advised to use a max size of 255 characters for these,
* but there is no enforced limit.
*/
export type jsString = string

Not sure if there is a way we can enforce one or the other within tsoa, but it would be very helpful to ensure consistency across build environments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions