blob: b64d989402fe851661a71ca1892eec7e3bd9128d [file] [log] [blame]
<!doctype html>
<!--
Minimal Mistakes Jekyll Theme 4.4.1 by Michael Rose
Copyright 2017 Michael Rose - mademistakes.com | @mmistakes
Free for personal and commercial use under the MIT license
https://github.com/mmistakes/minimal-mistakes/blob/master/LICENSE.txt
-->
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<!-- begin SEO -->
<title>Toolkit Quick Start - Apache ServiceComb</title>
<meta name="description" content="Learn how to use toolkit">
<meta name="author" content="">
<meta property="og:locale" content="en">
<meta property="og:site_name" content="Apache ServiceComb">
<meta property="og:title" content="Toolkit Quick Start">
<link rel="canonical" href="https://github.com/pages/apache/incubator-servicecomb-website/docs/products/toolkit/quick-start/">
<meta property="og:url" content="https://github.com/pages/apache/incubator-servicecomb-website/docs/products/toolkit/quick-start/">
<meta property="og:description" content="Learn how to use toolkit">
<meta name="twitter:site" content="@ServiceComb">
<meta name="twitter:title" content="Toolkit Quick Start">
<meta name="twitter:description" content="Learn how to use toolkit">
<meta name="twitter:url" content="">
<meta name="twitter:card" content="summary">
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@type" : "Person",
"name" : "Apache ServiceComb",
"url" : "https://github.com/pages/apache/incubator-servicecomb-website",
"sameAs" : null
}
</script>
<meta name="google-site-verification" content="HvJjNd7vvJ-yjSTHlBiIWEYxp_Hrz-PYEY5Idz9LRcA" />
<!-- end SEO -->
<link href="/feed.xml" type="application/atom+xml" rel="alternate" title="Apache ServiceComb Feed">
<!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
document.documentElement.className = document.documentElement.className.replace(/\bno-js\b/g, '') + ' js ';
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.7.1/clipboard.min.js"></script>
<script src="/assets/vendor/prism/prism.js"></script>
<script type="text/javascript" async
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<script src="https://www.apachecon.com/event-images/snippet.js"></script>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
<!-- For all browsers -->
<link rel="stylesheet" href="/assets/css/main.css">
<link rel="stylesheet" href="/assets/vendor/prism/prism.css">
<!--[if lte IE 9]>
<style>
/* old IE unsupported flexbox fixes */
.greedy-nav .site-title {
padding-right: 3em;
}
.greedy-nav button {
position: absolute;
top: 0;
right: 0;
height: 100%;
}
</style>
<![endif]-->
<meta http-equiv="cleartype" content="on">
<!-- start custom head snippets -->
<!-- insert favicons. use http://realfavicongenerator.net/ -->
<link href="https://fonts.loli.net/css?family=Roboto:400,500,700|Source+Code+Pro" rel="stylesheet">
<script src="/assets/js/custom.js"></script>
<!-- end custom head snippets -->
</head>
<body class="layout--single">
<!--[if lt IE 9]>
<div class="notice--danger align-center" style="margin: 0;">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</div>
<![endif]-->
<div class="masthead" onmouseleave="$('#childrenShow').css('display', 'none')">
<div class="masthead__inner-wrap">
<div class="masthead__menu">
<nav id="site-nav" class="greedy-nav">
<a class="site-title active" href="/"><img src="https://www.apache.org/img/servicecomb.png"></a>
<ul class="visible-links">
<li class="masthead__menu-item" onmouseenter="$('#childrenShow').css('display', 'none')">
<a href="/">Home</a>
</li>
<li class="masthead__menu-item" onmouseenter="$('#childrenShow').css('display', 'none')">
<a href="/developers/">Projects</a>
</li>
<li class="def-nav-li" onmouseenter="$('#childrenShow').css('display', 'block')">
<a href="/docs/users/">Documentation</a>
<ul id="childrenShow" class="def-children-show-en" onmouseleave="$('#childrenShow').css('display', 'none')">
<li><a href="/docs/getting-started/" class="">Getting started</a></li>
<li><a href="/docs/users/" class="">Docs</a></li>
<li><a href="/slides/" class="">Video</a></li>
<li><a href="/faqs/" class="">FAQ</a></li>
</ul>
</li>
<li class="masthead__menu-item" onmouseenter="$('#childrenShow').css('display', 'none')">
<a href="/year-archive/">Blogs</a>
</li>
<li class="masthead__menu-item" onmouseenter="$('#childrenShow').css('display', 'none')">
<a href="/release/">Downloads</a>
</li>
</ul>
<button><div class="navicon"></div></button>
<ul class="hidden-links hidden"></ul>
<div class="nav-lang">
<a href=/cn/docs/products/toolkit/quick-start/>中文</a>
</div>
</nav>
</div>
</div>
</div>
<div id="main" role="main">
<div class="sidebar sticky">
<div class="back-to-home"><a href="/">Home</a> > Toolkit Quick Start</div>
<nav class="nav__list">
<input id="ac-toc" name="accordion-toc" type="checkbox" />
<label for="ac-toc">Toggle Menu</label>
<ul class="nav__items">
<li>
<a href="/docs/getting-started/"><span class="nav__sub-title nav__sub-title-with-url">Getting Started</span></a>
</li>
<li>
<a href="/docs/introduction/"><span class="nav__sub-title nav__sub-title-with-url">Introduction</span></a>
</li>
<li>
<span class="nav__sub-title">Service Center</span>
<ul>
<li><a href="/docs/products/service-center/install/" class="">Install</a></li>
<li><a href="/docs/products/service-center/registration-discovery/" class="">Registration&Discovery</a></li>
</ul>
</li>
<li>
<span class="nav__sub-title">Java Chassis</span>
<ul>
<li><a href="/docs/products/java-chassis/quick-start/" class="">getting started</a></li>
<li><a href="/docs/products/java-chassis/bmi/" class="">Develop microservice application in minutes</a></li>
<li><a href="/docs/products/java-chassis/advance/" class="">Advance microservice development</a></li>
<li><a href="/docs/products/java-chassis/load-balance/" class="">Load Balance</a></li>
<li><a href="/docs/products/java-chassis/flow-control/" class="">Flow Control</a></li>
<li><a href="/docs/products/java-chassis/service-management/" class="">Service Management</a></li>
<li><a href="/docs/products/java-chassis/distributed-tracing/" class="">Distributed Tracing</a></li>
</ul>
</li>
<li>
<span class="nav__sub-title">Mesher</span>
<ul>
<li><a href="/docs/products/mesher/quick-start/" class="">getting started</a></li>
<li><a href="/docs/products/mesher/advance/" class="">mesher Advance</a></li>
<li><a href="/docs/products/mesher/load-balance/" class="">mesher balance</a></li>
<li><a href="/docs/products/mesher/flow-control/" class="">mesher Flow Control</a></li>
<li><a href="/docs/products/mesher/service-management/" class="">mesher Service Management</a></li>
<li><a href="/docs/products/mesher/distributed-tracing/" class="">mesher Distributed Tracing</a></li>
</ul>
</li>
<li>
<span class="nav__sub-title">Toolkit</span>
<ul>
<li><a href="/docs/products/toolkit/quick-start/" class="active">Quick Start</a></li>
<li><a href="/docs/products/toolkit/oas-validator/" class="">OpenAPI V3 Spec validation tools</a></li>
</ul>
</li>
<li>
<span class="nav__sub-title">Syncer</span>
<ul>
<li><a href="/docs/products/syncer/quick-start/" class="">Quick Start</a></li>
<li><a href="/docs/products/syncer/multi-servicecenters/" class="">Different service centers communicate with each other</a></li>
</ul>
</li>
</ul>
</nav>
</div>
<article class="page" itemscope itemtype="http://schema.org/CreativeWork">
<meta itemprop="headline" content="Toolkit Quick Start">
<meta itemprop="description" content="Learn how to use toolkit">
<meta itemprop="dateModified" content="November 12, 2019">
<div class="page__inner-wrap">
<header>
<h1 class="page__title" itemprop="headline">Toolkit Quick Start
</h1>
</header>
<section class="page__content" itemprop="text">
<aside class="sidebar__right">
<nav class="toc">
<!-- <header><h4 class="nav__title"><i class="fa fa-file-text"></i> On This Page</h4></header> -->
<ul class="toc__menu" id="markdown-toc">
<li><a href="#apache-servicecomb-toolkit" id="markdown-toc-apache-servicecomb-toolkit">Apache ServiceComb Toolkit</a></li>
<li><a href="#quick-start" id="markdown-toc-quick-start">Quick Start</a> <ul>
<li><a href="#1-build-tool-and-plugins-from-source" id="markdown-toc-1-build-tool-and-plugins-from-source">1 Build tool and plugins from source</a></li>
<li><a href="#2-use-the-toolkit-maven-plugin-plugin" id="markdown-toc-2-use-the-toolkit-maven-plugin-plugin">2 Use the toolkit-maven-plugin plugin</a></li>
<li><a href="#3-use-the-toolkit-cli" id="markdown-toc-3-use-the-toolkit-cli">3 Use the toolkit cli</a></li>
</ul>
</li>
</ul>
</nav>
</aside>
<h2 id="apache-servicecomb-toolkit">Apache ServiceComb Toolkit</h2>
<p>Apache ServiceComb Toolkit is a contract-based microservice development toolkit. Provides the ability to convert and verify contracts, code, and documents, helping users quickly build microservice projects based on popular microservices frameworks and popular programming models, reducing the cost of microservices entry, enabling users to focus on business development, enhance refactoring and development efficiency.</p>
<h2 id="quick-start">Quick Start</h2>
<h3 id="1-build-tool-and-plugins-from-source">1 Build tool and plugins from source</h3>
<blockquote>
<p>Build environment requirements</p>
<ul>
<li><a href="http://java.oracle.com">Java 8</a></li>
<li><a href="http://maven.apache.org/">Apache maven 3.5.0 or greater</a></li>
</ul>
</blockquote>
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Get the latest source code for toolkit from github</span>
<span class="nv">$ </span>git clone https://github.com/apache/servicecomb-toolkit.git
<span class="nv">$ </span><span class="nb">cd </span>toolkit
<span class="c"># Build package</span>
<span class="nv">$ </span>mvn clean <span class="nb">install</span>
</code></pre></div></div>
<h3 id="2-use-the-toolkit-maven-plugin-plugin">2 Use the toolkit-maven-plugin plugin</h3>
<h4 id="21-configuration">2.1 configuration</h4>
<p>Configured in the pom file of the maven project</p>
<div class="language-xml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">&lt;plugin&gt;</span>
<span class="nt">&lt;groupId&gt;</span>org.apache.servicecomb.toolkit<span class="nt">&lt;/groupId&gt;</span>
<span class="nt">&lt;artifactId&gt;</span>toolkit-maven-plugin<span class="nt">&lt;/artifactId&gt;</span>
<span class="nt">&lt;version&gt;</span>0.2.0-SNAPSHOT<span class="nt">&lt;/version&gt;</span>
<span class="nt">&lt;configuration&gt;</span>
<span class="c">&lt;!-- Set to 'code' to resolve the current project. Set to 'contract' to resolve the contract file for the specified path.If not set, the default is 'code' --&gt;</span>
<span class="nt">&lt;sourceType&gt;</span>code<span class="nt">&lt;/sourceType&gt;</span>
<span class="c">&lt;!-- The type of the contract file is generated. If it is not set, the default is 'yaml' --&gt;</span>
<span class="nt">&lt;contractFileType&gt;</span>yaml<span class="nt">&lt;/contractFileType&gt;</span>
<span class="c">&lt;!-- The type of the generated document. If not set, the default is 'html' --&gt;</span>
<span class="nt">&lt;documentType&gt;</span>html<span class="nt">&lt;/documentType&gt;</span>
<span class="c">&lt;!-- The root directory to save microservice project,contract file and document. If it is not set, the default is the 'target' under the directory where the command is run --&gt;</span>
<span class="nt">&lt;outputDirectory&gt;</span>./target<span class="nt">&lt;/outputDirectory&gt;</span>
<span class="c">&lt;!-- Input contract file path. Valid when sourceType is set to 'contract', must be set --&gt;</span>
<span class="nt">&lt;contractLocation&gt;</span>./contract<span class="nt">&lt;/contractLocation&gt;</span>
<span class="c">&lt;!-- Checked contract file path. Valid when sourceType is set to 'contract', must be set --&gt;</span>
<span class="nt">&lt;sourceContractPath&gt;</span>./target/contract<span class="nt">&lt;/sourceContractPath&gt;</span>
<span class="c">&lt;!-- Sample contract file path, must be set --&gt;</span>
<span class="nt">&lt;destinationContractPath&gt;</span>./contract<span class="nt">&lt;/destinationContractPath&gt;</span>
<span class="c">&lt;!-- Generated microservice project configuration --&gt;</span>
<span class="nt">&lt;service&gt;</span>
<span class="c">&lt;!-- Microservice type,can generated 'provider/consumer/all',the default is 'all' --&gt;</span>
<span class="nt">&lt;serviceType&gt;</span>all<span class="nt">&lt;/serviceType&gt;</span>
<span class="c">&lt;!-- Microservice project 'groupid',optional,the default is 'domain.orgnization.project' --&gt;</span>
<span class="nt">&lt;groupId&gt;</span>domain.orgnization.project<span class="nt">&lt;/groupId&gt;</span>
<span class="c">&lt;!-- Microservice project 'artifactId',optional,the default is 'sample' --&gt;</span>
<span class="nt">&lt;artifactId&gt;</span>sample<span class="nt">&lt;/artifactId&gt;</span>
<span class="c">&lt;!-- Microservice project 'artifactVersion',optional,the default is '0.1.0-SNAPSHOT' --&gt;</span>
<span class="nt">&lt;artifactVersion&gt;</span>0.1.0-SNAPSHOT<span class="nt">&lt;/artifactVersion&gt;</span>
<span class="c">&lt;!-- Microservice project 'packageName',optional,the default is 'domain.orgnization.project.sample' --&gt;</span>
<span class="nt">&lt;packageName&gt;</span>domain.orgnization.project.sample<span class="nt">&lt;/packageName&gt;</span>
<span class="nt">&lt;/service&gt;</span>
<span class="nt">&lt;/configuration&gt;</span>
<span class="nt">&lt;/plugin&gt;</span>
</code></pre></div></div>
<h4 id="22-command">2.2 Command</h4>
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Generating contract, document and microservice project</span>
mvn toolkit:generate
<span class="c"># Verify code and contract consistency</span>
mvn toolkit:verify
</code></pre></div></div>
<h4 id="221-extract-the-microservice-project-openapi-contract-file-and-document-from-the-code">2.2.1 Extract the microservice project, OpenAPI contract file and document from the code</h4>
<p>Configuration(use default configuration if not set <code class="language-plaintext highlighter-rouge">&lt;configuration&gt;</code>)</p>
<p>example</p>
<div class="language-xml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">&lt;plugin&gt;</span>
<span class="nt">&lt;groupId&gt;</span>org.apache.servicecomb.toolkit<span class="nt">&lt;/groupId&gt;</span>
<span class="nt">&lt;artifactId&gt;</span>toolkit-maven-plugin<span class="nt">&lt;/artifactId&gt;</span>
<span class="nt">&lt;version&gt;</span>0.2.0-SNAPSHOT<span class="nt">&lt;/version&gt;</span>
<span class="nt">&lt;configuration&gt;</span>
<span class="c">&lt;!-- Set to 'code' to resolve the current project. Set to 'contract' to resolve the contract file for the specified path.If not set, the default is 'code' --&gt;</span>
<span class="nt">&lt;sourceType&gt;</span>code<span class="nt">&lt;/sourceType&gt;</span>
<span class="c">&lt;!-- The root directory to save contract file and document. If it is not set, the default is the 'target' under the directory where the command is run --&gt;</span>
<span class="nt">&lt;outputDirectory&gt;</span>./target<span class="nt">&lt;/outputDirectory&gt;</span>
<span class="c">&lt;!-- Generated microservice project configuration --&gt;</span>
<span class="nt">&lt;service&gt;</span>
<span class="c">&lt;!-- Microservice type,can generated 'provider/consumer/all',the default is 'all' --&gt;</span>
<span class="nt">&lt;serviceType&gt;</span>all<span class="nt">&lt;/serviceType&gt;</span>
<span class="nt">&lt;/service&gt;</span>
<span class="nt">&lt;/configuration&gt;</span>
<span class="nt">&lt;/plugin&gt;</span>
</code></pre></div></div>
<p>Run in shell</p>
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mvn toolkit:generate
</code></pre></div></div>
<p>When generating contracts from code,support for identifying restful interfaces written by the following annotations (class level)</p>
<blockquote>
<p>RestController, RestSchema, RpcSchema, RequestMapping</p>
</blockquote>
<p>When generating contracts from code,the restful interface method access modifier must be specified as public</p>
<h4 id="222-generate-the-microservice-project-and-document-from-contract">2.2.2 Generate the microservice project and document from contract</h4>
<p>Configuration(use default configuration if not set <code class="language-plaintext highlighter-rouge">&lt;configuration&gt;</code>)</p>
<p>example</p>
<div class="language-xml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">&lt;plugin&gt;</span>
<span class="nt">&lt;groupId&gt;</span>org.apache.servicecomb.toolkit<span class="nt">&lt;/groupId&gt;</span>
<span class="nt">&lt;artifactId&gt;</span>toolkit-maven-plugin<span class="nt">&lt;/artifactId&gt;</span>
<span class="nt">&lt;version&gt;</span>0.2.0-SNAPSHOT<span class="nt">&lt;/version&gt;</span>
<span class="nt">&lt;configuration&gt;</span>
<span class="c">&lt;!-- Set to 'code' to resolve the current project. Set to 'contract' to resolve the contract file for the specified path.If not set, the default is 'code' --&gt;</span>
<span class="nt">&lt;sourceType&gt;</span>contract<span class="nt">&lt;/sourceType&gt;</span>
<span class="c">&lt;!-- The root directory to save contract file and document. If it is not set, the default is the 'target' under the directory where the command is run --&gt;</span>
<span class="nt">&lt;outputDirectory&gt;</span>./target<span class="nt">&lt;/outputDirectory&gt;</span>
<span class="c">&lt;!-- Input contract file path. Valid when sourceType is set to 'contract', must be set --&gt;</span>
<span class="nt">&lt;contractLocation&gt;</span>./contract<span class="nt">&lt;/contractLocation&gt;</span>
<span class="c">&lt;!-- Generated microservice project configuration --&gt;</span>
<span class="nt">&lt;service&gt;</span>
<span class="c">&lt;!-- Microservice type,can generated 'provider/consumer/all',the default is 'all' --&gt;</span>
<span class="nt">&lt;serviceType&gt;</span>provider<span class="nt">&lt;/serviceType&gt;</span>
<span class="nt">&lt;/service&gt;</span>
<span class="nt">&lt;/configuration&gt;</span>
<span class="nt">&lt;/plugin&gt;</span>
</code></pre></div></div>
<p>Run in shell</p>
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mvn toolkit:generate
</code></pre></div></div>
<h4 id="223-contract-verify">2.2.3 Contract verify</h4>
<p>Configuration</p>
<p>example</p>
<div class="language-xml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">&lt;plugin&gt;</span>
<span class="nt">&lt;groupId&gt;</span>org.apache.servicecomb.toolkit<span class="nt">&lt;/groupId&gt;</span>
<span class="nt">&lt;artifactId&gt;</span>toolkit-maven-plugin<span class="nt">&lt;/artifactId&gt;</span>
<span class="nt">&lt;version&gt;</span>0.2.0-SNAPSHOT<span class="nt">&lt;/version&gt;</span>
<span class="nt">&lt;configuration&gt;</span>
<span class="c">&lt;!-- Set to 'code' to resolve the current project. Set to 'contract' to resolve the contract file for the specified path.If not set, the default is 'code' --&gt;</span>
<span class="nt">&lt;sourceType&gt;</span>code<span class="nt">&lt;/sourceType&gt;</span>
<span class="c">&lt;!-- Sample contract file path, must be set --&gt;</span>
<span class="nt">&lt;destinationContractPath&gt;</span>./contract<span class="nt">&lt;/destinationContractPath&gt;</span>
<span class="nt">&lt;/configuration&gt;</span>
<span class="nt">&lt;/plugin&gt;</span>
</code></pre></div></div>
<p>Run in shell</p>
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mvn toolkit:verify
</code></pre></div></div>
<h3 id="3-use-the-toolkit-cli">3 Use the toolkit cli</h3>
<p>The executable jar package is located in the toolkit/cli/target/bin directory</p>
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>java <span class="nt">-jar</span> toolkit-cli-<span class="o">{</span>version<span class="o">}</span>.jar <span class="nb">help</span>
</code></pre></div></div>
<h4 id="31-service-contract-generation-microservice-project">3.1 Service contract generation microservice project</h4>
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>java <span class="nt">-jar</span> toolkit-cli-<span class="o">{</span>version<span class="o">}</span>.jar codegenerate <span class="nt">-m</span> ServiceComb <span class="nt">-i</span> swagger.yaml <span class="nt">-o</span> ./project <span class="nt">-p</span> SpringMVC
</code></pre></div></div>
<blockquote>
<p><strong>codegenerate</strong> Command option</p>
<ul>
<li>-m, –microservice-framework. Specify microservices framework, now supports ServiceComb.<br />
e.g.:-m ServiceComb</li>
<li>-p, –programming-model. Specify programming model, optional JAX-RS, POJO, SpringMVC, SpringBoot.<br />
e.g.:-p SpringMvc</li>
<li>-i, –input. Specifies contract files that follow the OpenAPI specification, supports yaml and json formats, and supports specifying local and network files.<br />
e.g.:-i http://petstore.swagger.io/v2/swagger.json</li>
<li>-o, –output. Generated project code output path.<br />
e.g.:-o ./project</li>
<li>–group-id. Specify the group id of the generated project.<br />
e.g.:–group-id com.demo</li>
<li>–artifact-id. Specify the artifact id of the generated project.<br />
e.g.:–artifact-id springmvc-example</li>
<li>–artifact-version. Specify the artifact version of the generated project. <br />
e.g.:–artifact-version 1.0.0</li>
<li>–api-package : Specify the api package of the generated project. <br />
e.g.:–api-package com.demo.api</li>
<li>–model-package : Specify the model package of the generated project.<br />
e.g.:–model-package com.demo.model</li>
<li>-t, –service-type : Specify microservice type of generated microservice project. optional value is provider,consumer,all <br />
e.g.:–service-type provider</li>
</ul>
</blockquote>
<h4 id="32-service-contract-generation-document">3.2 Service contract generation document</h4>
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>java <span class="nt">-jar</span> toolkit-cli-<span class="o">{</span>version<span class="o">}</span>.jar docgenerate <span class="nt">-i</span> swagger.yaml <span class="nt">-o</span> ./document
</code></pre></div></div>
<blockquote>
<p><strong>docgenerate</strong> Command option</p>
<ul>
<li>-i, –input. Specifies contract files that follow the OpenAPI specification, supports yaml and json formats, and supports specifying local and network files.
e.g:-i http://petstore.swagger.io/v2/swagger.json</li>
<li>-o, –output. Document output path.
e.g:-o ./document</li>
<li>-f, –format. Specifies the output document format, now supports swagger-ui
e.g:-f swagger-ui</li>
</ul>
</blockquote>
<h4 id="33-service-contract-style-checking">3.3 Service contract style checking</h4>
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>java <span class="nt">-jar</span> toolkit-cli-<span class="o">{</span>version<span class="o">}</span>.jar checkstyle oas.yaml
or
<span class="nv">$ </span>java <span class="nt">-jar</span> toolkit-cli-<span class="o">{</span>version<span class="o">}</span>.jar cs oas.yaml
</code></pre></div></div>
<blockquote>
<p><strong>checkstyle</strong> Command argument</p>
<ul>
<li>&lt;file&gt; OpenAPI v3 spec yaml file</li>
</ul>
</blockquote>
<p><a href="/docs/products/toolkit/oas-validator/#style-check-rules">style check rules</a></p>
<h4 id="34-service-contract-compatibility-checking">3.4 Service contract compatibility checking</h4>
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>java <span class="nt">-jar</span> toolkit-cli-<span class="o">{</span>version<span class="o">}</span>.jar checkcompatibility left-oas.yaml right-oas.yaml
or
<span class="nv">$ </span>java <span class="nt">-jar</span> toolkit-cli-<span class="o">{</span>version<span class="o">}</span>.jar cc left-oas.yaml right-oas.yaml
</code></pre></div></div>
<blockquote>
<p><strong>checkcompatibility</strong> Command argument</p>
<ul>
<li>&lt;files&gt; Two OpenAPI v3 spec yaml file</li>
</ul>
</blockquote>
<p><a href="/docs/products/toolkit/oas-validator/#compatibility-check-rules">compatibilty check rules</a></p>
</section>
<footer class="page__meta">
</footer>
</div>
</article>
</div>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<div align="center" style="margin: 0 0;">
<ins class="adsbygoogle"
style="display:block; border-bottom: initial;"
data-ad-client="ca-pub-7328585512091257"
data-ad-slot="3049671934"
data-ad-format="auto"></ins>
</div>
<div class="page__footer">
<footer>
<!-- start custom footer snippets -->
<!-- end custom footer snippets -->
<div class="container">
<div class="row justify-content-md-center">
<div class="col">
<ul>
<p class="header">Events</p>
<a class="acevent" data-format="square" data-mode="dark" data-event="random"></a>
</ul>
</div>
<div class="col">
<ul>
<p class="header">Resources</p>
<li><a href="/docs/getting-started/">Getting started</a></li>
<li><a href="/docs/users/">User Guide</a></li>
<li><a href="/slides/">Slides</a></li>
<li><a href="/users/faq/">Common Questions</a></li>
</ul>
</div>
<div class="col">
<ul>
<p class="header">ASF</p>
<li><a href="http://www.apache.org">Foundation</a></li>
<li><a href="http://www.apache.org/licenses/">License</a></li>
<li><a href="http://www.apache.org/events/current-event">Events</a></li>
<li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
<li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li>
</ul>
</div>
<div class="col">
<ul>
<p class="header">Contribute</p>
<li><a href="http://issues.apache.org/jira/browse/SCB">Report a Doc Issue</a></li>
<li><a href="https://github.com/apache/servicecomb-website/edit/master/_docs/products/toolkit/quick-start.md">Edit This Page on Github</a></li>
<li><a href="/developers/submit-codes/">Code Submit Guide</a></li>
<li><a href="/security">Security</a></li>
</ul>
</div>
<div class="col">
<ul class="social-icons">
<p class="header">Community</p>
<li>
<a href="mailto:dev-subscribe@servicecomb.incubator.apache.org" rel="nofollow"><span class="mail">Mailing List</span></a>
</li>
<li>
<a href="https://github.com/apache?q=ServiceComb" target="_blank"><span class="github">Github</span></a>
</li>
<li>
<a href="https://twitter.com/ServiceComb" target="_blank"><span class="twitter">Twitter</span></a>
</li>
<li>
<a href="/feed.xml" target="_blank"><span class="rss">Feed</span></a>
</li>
</ul>
</div>
</div>
</div>
<div class="page__footer-bottom">
<div>&copy; 2024 Apache ServiceComb. Powered by <a href="http://jekyllrb.com" rel="nofollow">Jekyll</a> &amp; <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
<div>All other marks mentioned may be trademarks or registered trademarks of their respective owners.</div>
</div>
</footer>
</div>
<script src="/assets/js/main.min.js"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-101622733-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>