swagger2markup: Operation title section does not take basePath into account

Swagger2Markup version: 1.1.0

Problem description: If your API is served up at a URL like https://host/v2, then Swagger lets you define that in the Swagger Object as the basePath attribute. In this case, it would be “/v2”.

The Swagger spec says that you should then define your Paths Object with a relative path that will be appended to basePath.

The path example (or whatever it is called) that is output following the path title in Swagger2Markup, however, only uses the operation’s method and path, and ignores the basePath.

Given the attached sample, the current output in paths.adoc has this:

[[_flubbers_get]]
=== Get all of the flubbers
....
GET /flubbers
....

What I would expect to see is this:

[[_flubbers_get]]
=== Get all of the flubbers
....
GET /v2/flubbers
....

basePath-sample.zip

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 15 (10 by maintainers)

Most upvoted comments

Hi,

you’ve added the property <swagger2markup.basePathPrefixEnabled>true</swagger2markup.basePathPrefixEnabled> to the wrong section (global properties). You have to add the property to the configuration section of the plugin.

<configuration>
    <swaggerInput>${swagger.input}</swaggerInput>
    <outputDir>${generated.asciidoc.directory}</outputDir>
    <config>
        <swagger2markup.markupLanguage>ASCIIDOC</swagger2markup.markupLanguage>
        <!-- <swagger2markup.pathsGroupedBy>TAGS</swagger2markup.pathsGroupedBy> -->
        <swagger2markup.extensions.dynamicOverview.contentPath>${project.basedir}/src/docs/asciidoc/extensions/overview</swagger2markup.extensions.dynamicOverview.contentPath>
        <swagger2markup.extensions.dynamicDefinitions.contentPath>${project.basedir}/src/docs/asciidoc/extensions/definitions</swagger2markup.extensions.dynamicDefinitions.contentPath>
        <swagger2markup.extensions.dynamicPaths.contentPath>${project.basedir}/src/docs/asciidoc/extensions/paths</swagger2markup.extensions.dynamicPaths.contentPath>
        <swagger2markup.extensions.dynamicSecurity.contentPath>${project.basedir}src/docs/asciidoc/extensions/security</swagger2markup.extensions.dynamicSecurity.contentPath>
        <swagger2markup.basePathPrefixEnabled>true</swagger2markup.basePathPrefixEnabled>
    </config>
</configuration>