I am having trouble including an info object in my swagger output json file. I am using the swagger-maven-plugin from https://github.com/swagger-api/swagger-core. Here is what I have tried...
I have tried including an info object in my pom.xml like this...
<plugin> <groupId>io.swagger.core.v3</groupId> <artifactId>swagger-maven-plugin</artifactId> <version>2.0.9</version> <configuration> <outputFileName>openapi</outputFileName> <outputPath>${project.build.directory}/openapi-json</outputPath> <outputFormat>JSONANDYAML</outputFormat> <resourcePackages> <package>packageName</package> </resourcePackages> <info> <version> 1.0 </version> <title> Swagger Pet Sample App Config File </title> <description> This is a sample server Petstore server. You can find out more about Swagger. </description> <termsOfService>http://swagger.io/terms/ </termsOfService> <license> <name> Apache2.0 </name> <url> http://www.apache.org/licenses/LICENSE-2.0.html </url> </license> <contact> <email> george@aol.com </email> </contact> </info> <prettyPrint>TRUE</prettyPrint> </configuration> <executions> <execution> <phase>compile</phase> <goals> <goal>resolve</goal> </goals> </execution> </executions> </plugin> </plugins>
I have also tried adding an openapi-configuration.yaml file in my path. The file looks like this. I copied this file from the plugin repo Readme page, so the contents are different than in my first approach above.
resourcePackages:
- packageName
prettyPrint: true
cacheTTL: 0
openAPI:
info:
version: '1.0'
title: Swagger Pet Sample App Config File
description: 'This is a sample server Petstore server. You can find out more
about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net,
#swagger](http://swagger.io/irc/). For this sample, you can use the api key
`special-key` to test the authorizat ion filters.'
termsOfService: http://swagger.io/terms/
contact:
email: apiteam@swagger.io
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
Neither of these approaches work.
What am I missing? Cheers.