swagger-editor icon indicating copy to clipboard operation
swagger-editor copied to clipboard

Multiline description formatting beyond it's scope

Open NickHargy opened this issue 2 years ago • 3 comments

It's been a while since I looked at this documentation but since then the multi-line descriptions in Swagger Editor seem to not know their place.

It's apparent to me that the .api functionality remains, warnings are thrown as and when they're supposed to be, but the text is all green, all the way up until the parent path is exited.

grafik

...2000 lines later....

grafik

Inconvenient.

I have tried reimporting the file and using different formatting structures; The only work around I have found so far is to use quotation marks, but this is less than ideal in certain situations.

NickHargy avatar Nov 16 '21 12:11 NickHargy

Re: loss of syntax highlighting after specifying a multi-line description in YAML

I've confirmed this is occurring in Swagger Editor 4.0.1. This issue can be replicated easily on https://editor.swagger.io/ using the sample YAML file, in particular when setting a multi-line description for a path item, when specifying a vertical bar (pipe) as the first line of the description, i.e. the block style indicator described here. For such items, the work-around of using quotes does not seem to help restore proper syntax highlighting.

Mike4Online avatar Nov 24 '21 21:11 Mike4Online

Yes, I have the problem too. As mentioned, it can be reproduced on editor.swagger.io.

Here's a minimal YAML file to reproduce.
swagger: "2.0"
info:
  description: |
    This is a sample demonstrating the multi-line syntax highlighting problem
    One more line.
    
    Then another one after an empty one.

  version: "1.0.0"
  title: "Swagger multiline syntax highlight"
paths: {}

Check the version: and title: keys in the screenshot below:

Untitled 3

Compared to what they should look like:

Untitled 4

(Also shows a workaround.)


I thought this bug might be coming from Brace, but I wasn't able to reproduce with Brace 0.11.1. 🤔

This seems oddly relevant though: https://github.com/ajaxorg/ace/pull/3919.


I just figured out that brace ships its own YamlHighlightRules and they are outdated. (Compare for example with the outcome in the PR I mentioned above.)

davidstosik avatar Dec 13 '21 03:12 davidstosik

(Ugly) workaround: Place a lonely "#" as first character in a new line after the string.

Skeeve avatar Dec 14 '21 19:12 Skeeve