Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #5228
Something went wrong while setting issue due date.
Closed
Open
Issue created 5 years ago by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items
  • New related issue

  • Report abuse to administrator

  • New related issue

  • Report abuse to administrator

[BUG] [asciidoc] Unresolvable include path by asciidoctor processor

Closed

[BUG] [asciidoc] Unresolvable include path by asciidoctor processor

Created by: LEZIER-S2

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?

  • Have you validated the input using an OpenAPI validator

  • What's the version of OpenAPI Generator used?

  • Have you search for related issues/PRs?

  • What's the actual output vs expected output?

  • [Optional] Bounty to sponsor the fix

Description

The asciidoc generator create path that cannot be interpreted by asciidoc processor:

  • the specDir and snippetDir attributes generated are not used in asciidoctor include directive

  • the path refers of included file can refers to path parameters wrote with curly braces, that is not supported by asciidoc processor.

openapi-generator version

openapi-generator@4.2.3 ( by dependency of openapi-generator-maven-plugin@4.2.3 )

OpenAPI declaration file content or url

files tree:

$: tree asciidoc
asciidoc/
├── api
│   ├── intro.adoc
│   └── resources
│       └── {id}
│           └── GET
│               ├── implementation.adoc
│               └── spec.adoc
└── snippet
    └── resources
        └── {id}
            └── GET
                ├── GET.json
                ├── http-request.adoc
                └── http-response.adoc

OAS file specification.json:

{
    "openapi": "3.0.1",
    "info": {
        "title": "OpenAPI definition",
        "version": "v0"
    },
    "servers": [
    ],
    "paths": {
        "/resources/{id}": {
            "get": {
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "default response",
                        "content": {
                            "application/json;charset=UTF-8": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
Command line used for generation
java -jar openapi-generator-cli.jar generate \
       -i specification.json \
       -g asciidoc \ 
       -o /tmp/  \ 
       -p specDir=asciidoc/api/ \ 
       -p snippetDir=asciidoc/snippet/
Steps to reproduce
  1. Reproduce the repository and file content. The adoc files can be empty.

  2. Launch the command.

Related issues/PRs

the index.adoc generated:

= OpenAPI definition
team@openapitools.org
v0
:toc: left
:numbered:
:toclevels: 3
:source-highlighter: highlightjs
:keywords: openapi, rest, OpenAPI definition 
:specDir: ./src/docs/asciidoc/api/
:snippetDir: ./src/docs/asciidoc/snippet/
...

[abstract]
...
include::intro.adoc[opts=optional]
...
===== Description 

include::resources/{id}/GET/spec.adoc[opts=optional]

...
===== Samples

include::resources/{id}/GET/http-request.adoc[opts=optional]

include::resources/{id}/GET/http-response.adoc[opts=optional]

* wiremock data link:resources/{id}/GET/GET.json[]

...
===== Implementation

include::resources/{id}/GET/implementation.adoc[opts=optional]

The include paths do not include snippetDir and specDir attributes.

The include path should escape curly brackets of path parameters.

include::{specDir}intro.adoc[opts=optional] include::{specDir}resources/\{id\}/GET/spec.adoc[opts=optional] include::{snippetDir}resources/\{id\}/GET/http-request.adoc[opts=optional] include::{snippetDir}resources/\{id\}/GET/http-response.adoc[opts=optional] wiremock data link:{snippetDir}resources/\{id\}/GET/GET.json[] include::{specDir}resources/\{id\}/GET/implementation.adoc[opts=optional]

Suggest a fix

In AsciidocDocumentationCodegen.java:87 protect parameter path of relativeFileName and then add the attribute for the directory path.

An error occurred while loading designs. Please try again.
Tasks
0
server returned results with length 5, expected length of 9

Linked items
0

Link issues together to show that they're related. Learn more.

Activity


Please register or sign in to reply
0 Assignees
None
Assign to
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
Due date
None
None
None
Time tracking
No estimate or time spent
Confidentiality
Not confidential
Not confidential

You are going to turn on confidentiality. Only project members with at least the Reporter role, the author, and assignees can view or be notified about this issue.

Lock issue
Unlocked
0
0 participants
Reference:

Menu

Explore Projects Groups Snippets