RepreZen / KaiZen-OpenAPI-Editor

Eclipse Editor for the Swagger-OpenAPI Description Language
Eclipse Public License 1.0
115 stars 12 forks source link

Auto-Format: Wrap string scalars to line width #66

Open tedepstein opened 8 years ago

tedepstein commented 8 years ago

YEdit has a line width setting in auto-format, but it does not seem to be using this to break strings across lines.

At a minimum, I would like this to break strings that use the > folded string indicator:

   /estimates/price:
      get:
         summary: Price Estimates
         description: >
            The Price Estimates endpoint returns an estimated price range for each product offered at a given location. The price estimate is provided as a formatted string with the full price range and the localized currency symbol.<br><br>The response also includes low and high estimates, and the [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code for situations requiring currency conversion. When surge is active for a particular product, its surge_multiplier will be greater than 1, but the price estimate already factors in this multiplier.

This should become:

   /estimates/price:
      get:
         summary: Price Estimates
         description: >
            The Price Estimates endpoint returns an estimated price range for 
            each product offered at a given location. The price estimate is 
            provided as a formatted string with the full price range and the 
            localized currency symbol.<br><br>The response also includes low 
            and high estimates, and the
            [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code 
            for situations requiring currency conversion. When surge is active
             for a particular product, its surge_multiplier will be greater 
             than 1, but the price estimate already factors in this multiplier.

It would also be helpful to have the option to convert inline strings to block-style wrapped strings, where the inline string exceeds the line length. So the example below would be auto-formatted the same as in the example above:

   /estimates/price:
      get:
         summary: Price Estimates
         description: The Price Estimates endpoint returns an estimated price range for each product offered at a given location. The price estimate is provided as a formatted string with the full price range and the localized currency symbol.<br><br>The response also includes low and high estimates, and the [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code for situations requiring currency conversion. When surge is active for a particular product, its surge_multiplier will be greater than 1, but the price estimate already factors in this multiplier.

NOTE: My knowledge of YAML is somewhat incomplete, so it's possible that I'm misunderstanding some of the rules. If someone thinks this looks incomplete or off-target, please chime in.

tedepstein commented 8 years ago

This should be a feature of YEdit, not specific to SwagEdit. Reported on YEdit here:

https://github.com/oyse/yedit/issues/35