redocly-cli
redocly-cli copied to clipboard
docs: add note about pattern matches on Markdown string fields
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.