redocly-cli icon indicating copy to clipboard operation
redocly-cli copied to clipboard

docs: add note about pattern matches on Markdown string fields

Open adamaltman opened this issue 2 years ago • 0 comments

Discovered in: https://github.com/Redocly/openapi-cli/issues/645

When a string field uses YAML string blocks the string may end with a line break (for example, | vs |-).

In the case of assertions, the pattern will see the last character as the line break \n if there is a line break at the end.

We should add a message in the docs to acknowledge that.

We should show that adjusting a pattern to look for an optional ending line break is a possibility, or adding the |- or >- to remove any trailing line break.

The original pattern: pattern: /\.$/ is checking for a string that ends with a full stop.

The revised pattern: pattern: /\.\n?$/ is allowing for an optional line break at the end after the full stop.

adamaltman avatar Apr 18 '22 17:04 adamaltman