Skip to content

[BUG][AsciiDoc] Pipe Characters in patterns break table layout #24119

Description

@ben-GDV

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Regexp patterns can contain "|" (Pipe Characters), which denotes the Union of two Regexps.
However, when using a Pipe in a pattern and using the OpenAPI AsciiDoc generator to generate AsciiDoc from the OpenAPI specification, then the Pipe character is not escaped and consequently interpreted by AsciiDoc as the table cell delimiter, which breaks the layout of the table of all fields in an object.

openapi-generator version

I am using version 7.12.0 of the openapi-generator-maven-plugin.

OpenAPI declaration file content or url

This snippet can be placed in any object's properties-list to reproduce the issue:

        field
          type: string
          pattern: "^([0-9A-Z]{3})|([0-9A-Z]{5})$"`
Generation Details

language: OpenAPI YAML
Open API version: 3.0.3

Steps to reproduce

In maven's pom.xml file, the generator plugin has the following execution:

<execution> <id>generate-asciidoc</id> <goals> <goal>generate</goal> </goals> <configuration> <generatorName>asciidoc</generatorName> <inputSpec>${project.basedir}/src/main/resources/openapi.yml</inputSpec> <templateDirectory>${project.basedir}/src/main/resources/_templates/asciidoc</templateDirectory> <output>${project.build.directory}/generated-sources/openapi/</output> <configOptions> <resolveRefs>true</resolveRefs> <apiDocs>true</apiDocs> <modelDocs>true</modelDocs> </configOptions> </configuration> </execution>

when I run mvn generate, Maven uses the openapi-asciidoc-generator to produce AsciiDoc files. However, in these files, the pipe character in the pattern is not escaped which breaks the table laypit when I use asciiDoc to turn them into HTML.

Related issues/PRs

I did not find any.

Suggest a fix

the pipe character must be escapted with a "" (backslash character). This allows AsciiDoc to interpret it correctly and to properly render the table.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions