zalando / intellij-swagger

A plugin to help you easily edit Swagger and OpenAPI specification files inside IntelliJ IDEA

Home Page:https://plugins.jetbrains.com/plugin/8347

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow the use of maven variables

jwedel opened this issue · comments

Context

We use the maven project version @project.version@ within the swagger spec:

swagger: "2.0"
info:
  description:
    Foo Bar
  version: @project.version@
  title: "My Service"

And we have resource filtering enabled:

         <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
         </resource>
      </resources> 

Current Behavior:

  • IntelliJ properly shows the version when using CTRL-Mouse-hover
  • The swagger plugin however show the following error:
Could not generate Swagger UI
			YAML decoding problem: while scanning for the next token
			found character @ '@' that cannot start any token. (Do not use @ for indentation)
			in 'reader', line 8, column 12:
			version: @project.version@

Expected Behavior:

  • The plugin should allow using maven variables

Hi @jwedel, you could put the maven variable into quotes like this

swagger: "2.0"
info:
  description:
    Foo Bar
  version: "@project.version@"
  title: "My Service"

With this the swagger ui generated from IntelliJ will display the version as @project.version@ and not the version from your POM file.

Works! Thanks 🙏