あなたはMavenを使用する場合は、あなたがあなたのpom.xmlにこれを追加swagger-maven-plugin
を使用して、クライアント側とサーバー側のドキュメント(YAML、JSONやHTML)を生成することができます。
.....
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<apiSources>
<apiSource>
<springmvc>true</springmvc>
<locations>com.yourcontrollers.package.v1</locations>
<schemes>http,https</schemes>
<host>localhost:8080</host>
<basePath>/api-doc</basePath>
<info>
<title>Your API name</title>
<version>v1</version>
<description> description of your API</description>
<termsOfService>
http://www.yourterms.com
</termsOfService>
<contact>
<email>[email protected]</email>
<name>Your Name</name>
<url>http://www.contact-url.com</url>
</contact>
<license>
<url>http://www.licence-url.com</url>
<name>Commercial</name>
</license>
</info>
<!-- Support classpath or file absolute path here.
1) classpath e.g: "classpath:/markdown.hbs", "classpath:/templates/hello.html"
2) file e.g: "${basedir}/src/main/resources/markdown.hbs",
"${basedir}/src/main/resources/template/hello.html" -->
<templatePath>${basedir}/templates/strapdown.html.hbs</templatePath>
<outputPath>${basedir}/generated/document.html</outputPath>
<swaggerDirectory>generated/swagger-ui</swaggerDirectory>
<securityDefinitions>
<securityDefinition>
<name>basicAuth</name>
<type>basic</type>
</securityDefinition>
</securityDefinitions>
</apiSource>
</apiSources>
</configuration>
</plugin> ........
ダウンロードでき
を*このアドレスの.hbsテンプレート: https://github.com/kongchen/swagger-maven-example
がMVN闊歩を実行します。 JSONドキュメントを生成するには、プロジェクト/生成/闊歩/ディレクトリに生成されます。このアドレスにそれ過去 : http://editor.swagger.io
そして、あなたが欲しい、これまで何を生成する(お好みの技術でサーバー側またはクライアント側API)
方法D oこのURLからswagger.json/spec.jsonファイルをダウンロードしますか? –
ブラウザで完全なURLを入力し、JSONをレスポンスとして取得します。どのファイルをjsonファイルとしてカットアンドペーストすることができますか? –