├── docs ├── doc └── _config.yml ├── src ├── main │ ├── resources │ │ ├── static │ │ │ ├── swagger │ │ │ │ ├── css │ │ │ │ │ ├── typography.css │ │ │ │ │ ├── reset.css │ │ │ │ │ └── style.css │ │ │ │ ├── images │ │ │ │ │ ├── expand.gif │ │ │ │ │ ├── favicon.ico │ │ │ │ │ ├── collapse.gif │ │ │ │ │ ├── throbber.gif │ │ │ │ │ ├── logo_small.png │ │ │ │ │ ├── wordnik_api.png │ │ │ │ │ ├── explorer_icons.png │ │ │ │ │ ├── favicon-16x16.png │ │ │ │ │ ├── favicon-32x32.png │ │ │ │ │ └── pet_store_api.png │ │ │ │ ├── fonts │ │ │ │ │ ├── DroidSans.ttf │ │ │ │ │ └── DroidSans-Bold.ttf │ │ │ │ ├── lib │ │ │ │ │ ├── highlight.9.1.0.pack_extended.js │ │ │ │ │ ├── object-assign-pollyfill.js │ │ │ │ │ ├── jquery.slideto.min.js │ │ │ │ │ ├── jquery.wiggle.min.js │ │ │ │ │ ├── jquery.ba-bbq.min.js │ │ │ │ │ ├── swagger-oauth.js │ │ │ │ │ └── highlight.9.1.0.pack.js │ │ │ │ ├── o2c.html │ │ │ │ ├── lang │ │ │ │ │ ├── translator.js │ │ │ │ │ ├── ko-kr.js │ │ │ │ │ ├── zh-cn.js │ │ │ │ │ ├── ja.js │ │ │ │ │ ├── tr.js │ │ │ │ │ ├── pl.js │ │ │ │ │ ├── pt.js │ │ │ │ │ ├── en.js │ │ │ │ │ ├── ru.js │ │ │ │ │ ├── ca.js │ │ │ │ │ ├── geo.js │ │ │ │ │ ├── it.js │ │ │ │ │ ├── es.js │ │ │ │ │ ├── fr.js │ │ │ │ │ └── el.js │ │ │ │ └── index.html │ │ │ ├── fonts │ │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ │ └── glyphicons-halflings-regular.woff2 │ │ │ ├── css │ │ │ │ └── custom.css │ │ │ ├── js │ │ │ │ └── index.js │ │ │ ├── index.html │ │ │ └── example.json │ │ └── application.properties │ └── java │ │ └── com │ │ └── burnetzhong │ │ ├── domain │ │ ├── refs │ │ │ ├── RefFormat.java │ │ │ ├── RefType.java │ │ │ └── GenericRef.java │ │ ├── HttpMethod.java │ │ ├── auth │ │ │ ├── SecuritySchemeDefinition.java │ │ │ ├── In.java │ │ │ ├── BasicAuthDefinition.java │ │ │ ├── AbstractSecuritySchemeDefinition.java │ │ │ ├── ApiKeyAuthDefinition.java │ │ │ ├── AuthorizationValue.java │ │ │ └── OAuth2Definition.java │ │ ├── Model.java │ │ ├── Scheme.java │ │ ├── RefPath.java │ │ ├── RefResponse.java │ │ ├── SecurityScope.java │ │ ├── License.java │ │ ├── Contact.java │ │ ├── AbstractModel.java │ │ ├── ExternalDocs.java │ │ ├── Tag.java │ │ ├── Xml.java │ │ ├── ArrayModel.java │ │ ├── SecurityRequirement.java │ │ ├── Response.java │ │ ├── RefModel.java │ │ ├── ComposedModel.java │ │ ├── Info.java │ │ ├── Path.java │ │ ├── ModelImpl.java │ │ └── Operation.java │ │ ├── ApiParliamentApplication.java │ │ ├── repo │ │ └── SwaggerDocRepo.java │ │ └── controller │ │ ├── SwaggerPublish.java │ │ └── DocumentUI.java └── test │ └── java │ └── com │ └── burnetzhong │ └── ApiParliamentApplicationTests.java ├── .gitignore ├── pom.xml ├── README.md └── LICENSE /docs/doc: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-tactile -------------------------------------------------------------------------------- /src/main/resources/static/swagger/css/typography.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/main/resources/static/swagger/images/expand.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnettzhong/parliament/HEAD/src/main/resources/static/swagger/images/expand.gif -------------------------------------------------------------------------------- /src/main/resources/static/swagger/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnettzhong/parliament/HEAD/src/main/resources/static/swagger/images/favicon.ico -------------------------------------------------------------------------------- /src/main/resources/static/swagger/fonts/DroidSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnettzhong/parliament/HEAD/src/main/resources/static/swagger/fonts/DroidSans.ttf -------------------------------------------------------------------------------- /src/main/resources/static/swagger/images/collapse.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnettzhong/parliament/HEAD/src/main/resources/static/swagger/images/collapse.gif -------------------------------------------------------------------------------- /src/main/resources/static/swagger/images/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnettzhong/parliament/HEAD/src/main/resources/static/swagger/images/throbber.gif -------------------------------------------------------------------------------- /src/main/resources/static/swagger/images/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnettzhong/parliament/HEAD/src/main/resources/static/swagger/images/logo_small.png -------------------------------------------------------------------------------- /src/main/resources/static/swagger/images/wordnik_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnettzhong/parliament/HEAD/src/main/resources/static/swagger/images/wordnik_api.png -------------------------------------------------------------------------------- /src/main/resources/static/swagger/fonts/DroidSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnettzhong/parliament/HEAD/src/main/resources/static/swagger/fonts/DroidSans-Bold.ttf -------------------------------------------------------------------------------- /src/main/resources/static/swagger/images/explorer_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnettzhong/parliament/HEAD/src/main/resources/static/swagger/images/explorer_icons.png -------------------------------------------------------------------------------- /src/main/resources/static/swagger/images/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnettzhong/parliament/HEAD/src/main/resources/static/swagger/images/favicon-16x16.png -------------------------------------------------------------------------------- /src/main/resources/static/swagger/images/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnettzhong/parliament/HEAD/src/main/resources/static/swagger/images/favicon-32x32.png -------------------------------------------------------------------------------- /src/main/resources/static/swagger/images/pet_store_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnettzhong/parliament/HEAD/src/main/resources/static/swagger/images/pet_store_api.png -------------------------------------------------------------------------------- /src/main/resources/static/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnettzhong/parliament/HEAD/src/main/resources/static/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /src/main/resources/static/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnettzhong/parliament/HEAD/src/main/resources/static/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /src/main/resources/static/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnettzhong/parliament/HEAD/src/main/resources/static/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /src/main/resources/static/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnettzhong/parliament/HEAD/src/main/resources/static/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/refs/RefFormat.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain.refs; 2 | 3 | /** 4 | * Created by russellb337 on 7/1/15. 5 | */ 6 | public enum RefFormat { 7 | URL, 8 | RELATIVE, 9 | INTERNAL 10 | } 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | .mvn 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | 12 | ### IntelliJ IDEA ### 13 | .idea 14 | *.iws 15 | *.iml 16 | *.ipr 17 | 18 | # Log file 19 | *.log -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/HttpMethod.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain; 2 | 3 | /** 4 | * Created by russellb337 on 7/10/15. 5 | */ 6 | public enum HttpMethod { 7 | POST, 8 | GET, 9 | PUT, 10 | PATCH, 11 | DELETE, 12 | HEAD, 13 | OPTIONS 14 | } 15 | -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #MongoDB configuration 2 | spring.data.mongodb.host = localhost 3 | spring.data.mongodb.database = parliament 4 | spring.data.mongodb.port = 27017 5 | 6 | #Ignore null value in response 7 | spring.jackson.serialization-inclusion=non_null 8 | 9 | #Server 10 | server.port = 8080 -------------------------------------------------------------------------------- /src/main/resources/static/swagger/lib/highlight.9.1.0.pack_extended.js: -------------------------------------------------------------------------------- 1 | "use strict";!function(){var h,l;h=hljs.configure,hljs.configure=function(l){var i=l.highlightSizeThreshold;hljs.highlightSizeThreshold=i===+i?i:null,h.call(this,l)},l=hljs.highlightBlock,hljs.highlightBlock=function(h){var i=h.innerHTML,g=hljs.highlightSizeThreshold;(null==g||g>i.length)&&l.call(hljs,h)}}(); -------------------------------------------------------------------------------- /src/main/resources/static/swagger/lib/object-assign-pollyfill.js: -------------------------------------------------------------------------------- 1 | "function"!=typeof Object.assign&&!function(){Object.assign=function(n){"use strict";if(void 0===n||null===n)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(n),o=1;o { 16 | 17 | Swagger findByBasePath(String basePath); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/resources/static/swagger/lib/jquery.wiggle.min.js: -------------------------------------------------------------------------------- 1 | jQuery.fn.wiggle=function(e){var a={speed:50,wiggles:3,travel:5,callback:null},e=jQuery.extend(a,e);return this.each(function(){var a=this,l=(jQuery(this).wrap('
').css("position","relative"),0);for(i=1;i<=e.wiggles;i++)jQuery(this).animate({left:"-="+e.travel},e.speed).animate({left:"+="+2*e.travel},2*e.speed).animate({left:"-="+e.travel},e.speed,function(){l++,jQuery(a).parent().hasClass("wiggle-wrap")&&jQuery(a).parent().replaceWith(a),l==e.wiggles&&jQuery.isFunction(e.callback)&&e.callback()})})}; -------------------------------------------------------------------------------- /src/main/resources/static/swagger/o2c.html: -------------------------------------------------------------------------------- 1 | 21 | -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/auth/SecuritySchemeDefinition.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain.auth; 2 | 3 | import com.fasterxml.jackson.annotation.JsonAnyGetter; 4 | import com.fasterxml.jackson.annotation.JsonAnySetter; 5 | 6 | import java.util.Map; 7 | 8 | public interface SecuritySchemeDefinition { 9 | String getType(); 10 | 11 | void setType(String type); 12 | 13 | @JsonAnyGetter 14 | Map getVendorExtensions(); 15 | 16 | @JsonAnySetter 17 | void setVendorExtension(String name, Object value); 18 | 19 | String getDescription(); 20 | 21 | void setDescription(String description); 22 | } -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/refs/RefType.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain.refs; 2 | 3 | /** 4 | * Created by russellb337 on 7/1/15. 5 | */ 6 | public enum RefType { 7 | DEFINITION("#/definitions/"), 8 | PARAMETER("#/parameters/"), 9 | PATH("#/paths/"), 10 | RESPONSE("#/responses/"); 11 | 12 | private final String internalPrefix; 13 | 14 | private RefType(final String prefix) { 15 | this.internalPrefix = prefix; 16 | } 17 | 18 | /** 19 | * The prefix in an internal reference of this type. 20 | */ 21 | public String getInternalPrefix() { 22 | return internalPrefix; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/resources/static/js/index.js: -------------------------------------------------------------------------------- 1 | var apiList = new Vue({ 2 | el: '#api-list', 3 | data: { 4 | apis: [] 5 | }, 6 | mounted: function () { 7 | console.log("done"); 8 | $.ajax({ 9 | url: 'api/', 10 | datatype: 'json', 11 | type: "get", 12 | contentType: "application/json", 13 | success: function (data) { 14 | $.each(data, function(i, v){ 15 | apiList.apis.push(v); 16 | 17 | }); 18 | }, 19 | error: function () { 20 | alert("An error during data retrieving. Please, try again later"); 21 | } 22 | }); 23 | } 24 | }); 25 | -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/Model.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain; 2 | 3 | 4 | 5 | import java.util.Map; 6 | 7 | public interface Model { 8 | String getTitle(); 9 | 10 | void setTitle(String title); 11 | 12 | String getDescription(); 13 | 14 | void setDescription(String description); 15 | 16 | Map getProperties(); 17 | 18 | void setProperties(Map properties); 19 | 20 | Object getExample(); 21 | 22 | void setExample(Object example); 23 | 24 | ExternalDocs getExternalDocs(); 25 | 26 | String getReference(); 27 | 28 | void setReference(String reference); 29 | 30 | Object clone(); 31 | 32 | Map getVendorExtensions(); 33 | } 34 | -------------------------------------------------------------------------------- /src/main/resources/static/swagger/css/reset.css: -------------------------------------------------------------------------------- 1 | a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:"";content:none}table{border-collapse:collapse;border-spacing:0} -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/Scheme.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain; 2 | 3 | import com.fasterxml.jackson.annotation.JsonCreator; 4 | import com.fasterxml.jackson.annotation.JsonValue; 5 | 6 | public enum Scheme { 7 | HTTP("http"), 8 | HTTPS("https"), 9 | WS("ws"), 10 | WSS("wss"); 11 | 12 | private final String value; 13 | 14 | private Scheme(String value) { 15 | this.value = value; 16 | } 17 | 18 | @JsonCreator 19 | public static Scheme forValue(String value) { 20 | for (Scheme item : Scheme.values()) { 21 | if (item.toValue().equalsIgnoreCase(value)) { 22 | return item; 23 | } 24 | } 25 | return null; 26 | } 27 | 28 | @JsonValue 29 | public String toValue() { 30 | return value; 31 | } 32 | } -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/auth/In.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain.auth; 2 | 3 | import com.fasterxml.jackson.annotation.JsonCreator; 4 | import com.fasterxml.jackson.annotation.JsonValue; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | public enum In { 10 | HEADER, QUERY; 11 | 12 | private static Map names = new HashMap(); 13 | 14 | @JsonCreator 15 | public static In forValue(String value) { 16 | return names.get(value.toLowerCase()); 17 | } 18 | 19 | @JsonValue 20 | public String toValue() { 21 | for (Map.Entry entry : names.entrySet()) { 22 | if (entry.getValue() == this) { 23 | return entry.getKey(); 24 | } 25 | } 26 | 27 | return null; // or fail 28 | } 29 | 30 | static { 31 | names.put("header", HEADER); 32 | names.put("query", QUERY); 33 | } 34 | } -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/controller/SwaggerPublish.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.controller; 2 | 3 | import com.burnetzhong.domain.Swagger; 4 | import com.burnetzhong.repo.SwaggerDocRepo; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.RequestBody; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestMethod; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | /** 12 | * Project: zhcore 13 | * 14 | * @Comments 15 | * @Author Zhong Han 16 | * @Created Date 2017/4/5 17 | */ 18 | @RestController 19 | @RequestMapping(path = "/swagger") 20 | public class SwaggerPublish { 21 | 22 | @Autowired 23 | private SwaggerDocRepo swaggerDocRepo; 24 | 25 | @RequestMapping(path = "/publish", method = RequestMethod.POST, consumes = "application/json;charset=utf-8" ) 26 | public void publish(@RequestBody Swagger swagger){ 27 | Swagger original = swaggerDocRepo.findByBasePath(swagger.getBasePath()); 28 | 29 | // MongoDB docs cannot contain "$" when update, so we must delete old one and save the new one. 30 | if(null != original) { 31 | swaggerDocRepo.delete(original.getId()); 32 | } 33 | 34 | swaggerDocRepo.save(swagger); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/auth/BasicAuthDefinition.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain.auth; 2 | 3 | public class BasicAuthDefinition extends AbstractSecuritySchemeDefinition { 4 | private String type = "basic"; 5 | 6 | public BasicAuthDefinition() { 7 | } 8 | 9 | public String getType() { 10 | return type; 11 | } 12 | 13 | public void setType(String type) { 14 | this.type = type; 15 | } 16 | 17 | @Override 18 | public int hashCode() { 19 | final int prime = 31; 20 | int result = super.hashCode(); 21 | result = prime * result + ((type == null) ? 0 : type.hashCode()); 22 | return result; 23 | } 24 | 25 | @Override 26 | public boolean equals(Object obj) { 27 | if (this == obj) { 28 | return true; 29 | } 30 | if (obj == null) { 31 | return false; 32 | } 33 | if (!super.equals(obj)) { 34 | return false; 35 | } 36 | if (getClass() != obj.getClass()) { 37 | return false; 38 | } 39 | BasicAuthDefinition other = (BasicAuthDefinition) obj; 40 | if (type == null) { 41 | if (other.type != null) { 42 | return false; 43 | } 44 | } else if (!type.equals(other.type)) { 45 | return false; 46 | } 47 | return true; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/controller/DocumentUI.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.controller; 2 | 3 | import com.burnetzhong.domain.Swagger; 4 | import com.burnetzhong.repo.SwaggerDocRepo; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.PathVariable; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestMethod; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * Project: zhcore 15 | * 16 | * @Comments 17 | * @Author Zhong Han 18 | * @Created Date 2017/4/6 19 | */ 20 | 21 | @RestController 22 | @RequestMapping(path = "/api") 23 | public class DocumentUI { 24 | 25 | @Autowired 26 | private SwaggerDocRepo swaggerDocRepo; 27 | 28 | 29 | @RequestMapping(path = "/", method = RequestMethod.GET) 30 | public List getSwaggers(){ 31 | List swaggers = (List) swaggerDocRepo.findAll(); 32 | return swaggers; 33 | } 34 | 35 | @RequestMapping(path = "/{basePath}", method = RequestMethod.GET) 36 | public Swagger getByBasePath(@PathVariable String basePath){ 37 | if(!basePath.startsWith("/")){ 38 | basePath = "/" + basePath; 39 | } 40 | Swagger swagger = swaggerDocRepo.findByBasePath(basePath); 41 | return swagger; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/resources/static/swagger/lang/translator.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Translator for documentation pages. 5 | * 6 | * To enable translation you should include one of language-files in your index.html 7 | * after . 8 | * For example - 9 | * 10 | * If you wish to translate some new texts you should do two things: 11 | * 1. Add a new phrase pair ("New Phrase": "New Translation") into your language file (for example lang/ru.js). It will be great if you add it in other language files too. 12 | * 2. Mark that text it templates this way New Phrase or . 13 | * The main thing here is attribute data-sw-translate. Only inner html, title-attribute and value-attribute are going to translate. 14 | * 15 | */ 16 | window.SwaggerTranslator = { 17 | 18 | _words:[], 19 | 20 | translate: function(sel) { 21 | var $this = this; 22 | sel = sel || '[data-sw-translate]'; 23 | 24 | $(sel).each(function() { 25 | $(this).html($this._tryTranslate($(this).html())); 26 | 27 | $(this).val($this._tryTranslate($(this).val())); 28 | $(this).attr('title', $this._tryTranslate($(this).attr('title'))); 29 | }); 30 | }, 31 | 32 | _tryTranslate: function(word) { 33 | return this._words[$.trim(word)] !== undefined ? this._words[$.trim(word)] : word; 34 | }, 35 | 36 | learn: function(wordsMap) { 37 | this._words = wordsMap; 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/RefPath.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | import com.burnetzhong.domain.refs.GenericRef; 5 | import com.burnetzhong.domain.refs.RefFormat; 6 | import com.burnetzhong.domain.refs.RefType; 7 | 8 | /** 9 | * Created by Helmsdown on 7/8/15. 10 | * 11 | * This class extends directly from Path for now. At some future date we will need 12 | * to make {@link com.burnetzhong.domain.Path} an interface to follow the pattern established by 13 | * {@link com.burnetzhong.domain.Model}, {@link com.burnetzhong.domain.properties.Object} and {@link com.burnetzhong.domain.parameters.Parameter} 14 | */ 15 | public class RefPath extends Path { 16 | 17 | private GenericRef genericRef; 18 | 19 | public RefPath() { 20 | } 21 | 22 | public RefPath(String ref) { 23 | set$ref(ref); 24 | } 25 | 26 | public void set$ref(String ref) { 27 | this.genericRef = new GenericRef(RefType.PATH, ref); 28 | } 29 | 30 | public String get$ref() { 31 | return genericRef.getRef(); 32 | } 33 | 34 | @Override 35 | public boolean equals(Object o) { 36 | if (this == o) return true; 37 | if (o == null || getClass() != o.getClass()) return false; 38 | 39 | RefPath refPath = (RefPath) o; 40 | 41 | return !(genericRef != null ? !genericRef.equals(refPath.genericRef) : refPath.genericRef != null); 42 | 43 | } 44 | 45 | @Override 46 | public int hashCode() { 47 | return genericRef != null ? genericRef.hashCode() : 0; 48 | } 49 | 50 | @JsonIgnore 51 | public RefFormat getRefFormat() { 52 | return this.genericRef.getFormat(); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/RefResponse.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | import com.burnetzhong.domain.refs.GenericRef; 5 | import com.burnetzhong.domain.refs.RefFormat; 6 | import com.burnetzhong.domain.refs.RefType; 7 | 8 | /** 9 | * Created by Helmsdown on 7/8/15. 10 | * 11 | * This class extends directly from Response for now. At some future date we will need 12 | * to make {@link com.burnetzhong.domain.Response} an interface to follow the pattern established by 13 | * {@link com.burnetzhong.domain.Model}, {@link com.burnetzhong.domain.properties.Object} and {@link com.burnetzhong.domain.parameters.Parameter} 14 | */ 15 | public class RefResponse extends Response { 16 | 17 | private GenericRef genericRef; 18 | 19 | public RefResponse() { 20 | } 21 | 22 | public RefResponse(String ref) { 23 | set$ref(ref); 24 | } 25 | 26 | public void set$ref(String ref) { 27 | this.genericRef = new GenericRef(RefType.RESPONSE, ref); 28 | } 29 | 30 | public String get$ref() { 31 | return genericRef.getRef(); 32 | } 33 | 34 | @JsonIgnore 35 | public String getSimpleRef() { 36 | return genericRef.getSimpleRef(); 37 | } 38 | 39 | @Override 40 | public boolean equals(Object o) { 41 | if (this == o) return true; 42 | if (o == null || getClass() != o.getClass()) return false; 43 | 44 | RefResponse refResponse = (RefResponse) o; 45 | 46 | return !(genericRef != null ? !genericRef.equals(refResponse.genericRef) : refResponse.genericRef != null); 47 | 48 | } 49 | 50 | @Override 51 | public int hashCode() { 52 | return genericRef != null ? genericRef.hashCode() : 0; 53 | } 54 | 55 | @JsonIgnore 56 | public RefFormat getRefFormat() { 57 | return this.genericRef.getFormat(); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/resources/static/swagger/lang/ko-kr.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"경고:폐기예정됨", 6 | "Implementation Notes":"구현 노트", 7 | "Response Class":"응답 클래스", 8 | "Status":"상태", 9 | "Parameters":"매개변수들", 10 | "Parameter":"매개변수", 11 | "Value":"값", 12 | "Description":"설명", 13 | "Parameter Type":"매개변수 타입", 14 | "Data Type":"데이터 타입", 15 | "Response Messages":"응답 메세지", 16 | "HTTP Status Code":"HTTP 상태 코드", 17 | "Reason":"원인", 18 | "Response Model":"응답 모델", 19 | "Request URL":"요청 URL", 20 | "Response Body":"응답 본문", 21 | "Response Code":"응답 코드", 22 | "Response Headers":"응답 헤더", 23 | "Hide Response":"응답 숨기기", 24 | "Headers":"헤더", 25 | "Try it out!":"써보기!", 26 | "Show/Hide":"보이기/숨기기", 27 | "List Operations":"목록 작업", 28 | "Expand Operations":"전개 작업", 29 | "Raw":"원본", 30 | "can't parse JSON. Raw result":"JSON을 파싱할수 없음. 원본결과:", 31 | "Model Schema":"모델 스키마", 32 | "Model":"모델", 33 | "apply":"적용", 34 | "Username":"사용자 이름", 35 | "Password":"암호", 36 | "Terms of service":"이용약관", 37 | "Created by":"작성자", 38 | "See more at":"추가정보:", 39 | "Contact the developer":"개발자에게 문의", 40 | "api version":"api버전", 41 | "Response Content Type":"응답Content Type", 42 | "fetching resource":"리소스 가져오기", 43 | "fetching resource list":"리소스 목록 가져오기", 44 | "Explore":"탐색", 45 | "Show Swagger Petstore Example Apis":"Swagger Petstore 예제 보기", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"서버로부터 읽어들일수 없습니다. access-control-origin 설정이 올바르지 않을수 있습니다.", 47 | "Please specify the protocol for":"다음을 위한 프로토콜을 정하세요", 48 | "Can't read swagger JSON from":"swagger JSON 을 다음으로 부터 읽을수 없습니다", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"리소스 정보 불러오기 완료. Swagger UI 랜더링", 50 | "Unable to read api":"api를 읽을 수 없습니다.", 51 | "from path":"다음 경로로 부터", 52 | "server returned":"서버 응답함." 53 | }); 54 | -------------------------------------------------------------------------------- /src/main/resources/static/swagger/lang/zh-cn.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"警告:已过时", 6 | "Implementation Notes":"实现备注", 7 | "Response Class":"响应类", 8 | "Status":"状态", 9 | "Parameters":"参数", 10 | "Parameter":"参数", 11 | "Value":"值", 12 | "Description":"描述", 13 | "Parameter Type":"参数类型", 14 | "Data Type":"数据类型", 15 | "Response Messages":"响应消息", 16 | "HTTP Status Code":"HTTP状态码", 17 | "Reason":"原因", 18 | "Response Model":"响应模型", 19 | "Request URL":"请求URL", 20 | "Response Body":"响应体", 21 | "Response Code":"响应码", 22 | "Response Headers":"响应头", 23 | "Hide Response":"隐藏响应", 24 | "Headers":"头", 25 | "Try it out!":"试一下!", 26 | "Show/Hide":"显示/隐藏", 27 | "List Operations":"显示操作", 28 | "Expand Operations":"展开操作", 29 | "Raw":"原始", 30 | "can't parse JSON. Raw result":"无法解析JSON. 原始结果", 31 | "Example Value":"示例", 32 | "Click to set as parameter value":"点击设置参数", 33 | "Model Schema":"模型架构", 34 | "Model":"模型", 35 | "apply":"应用", 36 | "Username":"用户名", 37 | "Password":"密码", 38 | "Terms of service":"服务条款", 39 | "Created by":"创建者", 40 | "See more at":"查看更多:", 41 | "Contact the developer":"联系开发者", 42 | "api version":"api版本", 43 | "Response Content Type":"响应Content Type", 44 | "Parameter content type:":"参数类型:", 45 | "fetching resource":"正在获取资源", 46 | "fetching resource list":"正在获取资源列表", 47 | "Explore":"浏览", 48 | "Show Swagger Petstore Example Apis":"显示 Swagger Petstore 示例 Apis", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"无法从服务器读取。可能没有正确设置access-control-origin。", 50 | "Please specify the protocol for":"请指定协议:", 51 | "Can't read swagger JSON from":"无法读取swagger JSON于", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"已加载资源信息。正在渲染Swagger UI", 53 | "Unable to read api":"无法读取api", 54 | "from path":"从路径", 55 | "server returned":"服务器返回" 56 | }); 57 | -------------------------------------------------------------------------------- /src/main/resources/static/swagger/lang/ja.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"警告: 廃止予定", 6 | "Implementation Notes":"実装メモ", 7 | "Response Class":"レスポンスクラス", 8 | "Status":"ステータス", 9 | "Parameters":"パラメータ群", 10 | "Parameter":"パラメータ", 11 | "Value":"値", 12 | "Description":"説明", 13 | "Parameter Type":"パラメータタイプ", 14 | "Data Type":"データタイプ", 15 | "Response Messages":"レスポンスメッセージ", 16 | "HTTP Status Code":"HTTPステータスコード", 17 | "Reason":"理由", 18 | "Response Model":"レスポンスモデル", 19 | "Request URL":"リクエストURL", 20 | "Response Body":"レスポンスボディ", 21 | "Response Code":"レスポンスコード", 22 | "Response Headers":"レスポンスヘッダ", 23 | "Hide Response":"レスポンスを隠す", 24 | "Headers":"ヘッダ", 25 | "Try it out!":"実際に実行!", 26 | "Show/Hide":"表示/非表示", 27 | "List Operations":"操作一覧", 28 | "Expand Operations":"操作の展開", 29 | "Raw":"未加工", 30 | "can't parse JSON. Raw result":"JSONへ解釈できません. 未加工の結果", 31 | "Example Value":"値の例", 32 | "Model Schema":"モデルスキーマ", 33 | "Model":"モデル", 34 | "Click to set as parameter value":"パラメータ値と設定するにはクリック", 35 | "apply":"実行", 36 | "Username":"ユーザ名", 37 | "Password":"パスワード", 38 | "Terms of service":"サービス利用規約", 39 | "Created by":"Created by", 40 | "See more at":"詳細を見る", 41 | "Contact the developer":"開発者に連絡", 42 | "api version":"APIバージョン", 43 | "Response Content Type":"レスポンス コンテンツタイプ", 44 | "Parameter content type:":"パラメータコンテンツタイプ:", 45 | "fetching resource":"リソースの取得", 46 | "fetching resource list":"リソース一覧の取得", 47 | "Explore":"調査", 48 | "Show Swagger Petstore Example Apis":"SwaggerペットストアAPIの表示", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"サーバから読み込めません. 適切なaccess-control-origin設定を持っていない可能性があります.", 50 | "Please specify the protocol for":"プロトコルを指定してください", 51 | "Can't read swagger JSON from":"次からswagger JSONを読み込めません", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"リソース情報の読み込みが完了しました. Swagger UIを描画しています", 53 | "Unable to read api":"APIを読み込めません", 54 | "from path":"次のパスから", 55 | "server returned":"サーバからの返答" 56 | }); 57 | -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/SecurityScope.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain; 2 | 3 | public class SecurityScope { 4 | private String name; 5 | private String description; 6 | 7 | public SecurityScope() { 8 | } 9 | 10 | public SecurityScope(String name, String description) { 11 | this.name = name; 12 | this.description = description; 13 | } 14 | 15 | public SecurityScope name(String name) { 16 | this.setName(name); 17 | return this; 18 | } 19 | 20 | public SecurityScope description(String description) { 21 | this.setDescription(description); 22 | return this; 23 | } 24 | 25 | public String getName() { 26 | return name; 27 | } 28 | 29 | public void setName(String name) { 30 | this.name = name; 31 | } 32 | 33 | public String getDescription() { 34 | return description; 35 | } 36 | 37 | public void setDescription(String description) { 38 | this.description = description; 39 | } 40 | 41 | @Override 42 | public int hashCode() { 43 | final int prime = 31; 44 | int result = 1; 45 | result = prime * result 46 | + ((description == null) ? 0 : description.hashCode()); 47 | result = prime * result + ((name == null) ? 0 : name.hashCode()); 48 | return result; 49 | } 50 | 51 | @Override 52 | public boolean equals(Object obj) { 53 | if (this == obj) { 54 | return true; 55 | } 56 | if (obj == null) { 57 | return false; 58 | } 59 | if (getClass() != obj.getClass()) { 60 | return false; 61 | } 62 | SecurityScope other = (SecurityScope) obj; 63 | if (description == null) { 64 | if (other.description != null) { 65 | return false; 66 | } 67 | } else if (!description.equals(other.description)) { 68 | return false; 69 | } 70 | if (name == null) { 71 | if (other.name != null) { 72 | return false; 73 | } 74 | } else if (!name.equals(other.name)) { 75 | return false; 76 | } 77 | return true; 78 | } 79 | } -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/auth/AbstractSecuritySchemeDefinition.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain.auth; 2 | 3 | import com.fasterxml.jackson.annotation.JsonAnyGetter; 4 | import com.fasterxml.jackson.annotation.JsonAnySetter; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | 10 | public abstract class AbstractSecuritySchemeDefinition implements SecuritySchemeDefinition { 11 | 12 | private final Map vendorExtensions = new HashMap(); 13 | 14 | private String description; 15 | 16 | @JsonAnyGetter 17 | public Map getVendorExtensions() { 18 | return vendorExtensions; 19 | } 20 | 21 | @JsonAnySetter 22 | public void setVendorExtension(String name, Object value) { 23 | if (name.startsWith("x-")) { 24 | vendorExtensions.put(name, value); 25 | } 26 | } 27 | 28 | public String getDescription() { 29 | return description; 30 | } 31 | 32 | public void setDescription(String description) { 33 | this.description = description; 34 | } 35 | 36 | @Override 37 | public int hashCode() { 38 | final int prime = 31; 39 | int result = 1; 40 | result = prime * result + ((description == null) ? 0 : description.hashCode()); 41 | result = prime * result + ((vendorExtensions == null) ? 0 : vendorExtensions.hashCode()); 42 | return result; 43 | } 44 | 45 | @Override 46 | public boolean equals(Object obj) { 47 | if (this == obj) { 48 | return true; 49 | } 50 | if (obj == null) { 51 | return false; 52 | } 53 | if (getClass() != obj.getClass()) { 54 | return false; 55 | } 56 | AbstractSecuritySchemeDefinition other = (AbstractSecuritySchemeDefinition) obj; 57 | if (description == null) { 58 | if (other.description != null) { 59 | return false; 60 | } 61 | } else if (!description.equals(other.description)) { 62 | return false; 63 | } 64 | if (vendorExtensions == null) { 65 | if (other.vendorExtensions != null) { 66 | return false; 67 | } 68 | } else if (!vendorExtensions.equals(other.vendorExtensions)) { 69 | return false; 70 | } 71 | return true; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/resources/static/swagger/lang/tr.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Uyarı: Deprecated", 6 | "Implementation Notes":"Gerçekleştirim Notları", 7 | "Response Class":"Dönen Sınıf", 8 | "Status":"Statü", 9 | "Parameters":"Parametreler", 10 | "Parameter":"Parametre", 11 | "Value":"Değer", 12 | "Description":"Açıklama", 13 | "Parameter Type":"Parametre Tipi", 14 | "Data Type":"Veri Tipi", 15 | "Response Messages":"Dönüş Mesajı", 16 | "HTTP Status Code":"HTTP Statü Kodu", 17 | "Reason":"Gerekçe", 18 | "Response Model":"Dönüş Modeli", 19 | "Request URL":"İstek URL", 20 | "Response Body":"Dönüş İçeriği", 21 | "Response Code":"Dönüş Kodu", 22 | "Response Headers":"Dönüş Üst Bilgileri", 23 | "Hide Response":"Dönüşü Gizle", 24 | "Headers":"Üst Bilgiler", 25 | "Try it out!":"Dene!", 26 | "Show/Hide":"Göster/Gizle", 27 | "List Operations":"Operasyonları Listele", 28 | "Expand Operations":"Operasyonları Aç", 29 | "Raw":"Ham", 30 | "can't parse JSON. Raw result":"JSON çözümlenemiyor. Ham sonuç", 31 | "Model Schema":"Model Şema", 32 | "Model":"Model", 33 | "apply":"uygula", 34 | "Username":"Kullanıcı Adı", 35 | "Password":"Parola", 36 | "Terms of service":"Servis şartları", 37 | "Created by":"Oluşturan", 38 | "See more at":"Daha fazlası için", 39 | "Contact the developer":"Geliştirici ile İletişime Geçin", 40 | "api version":"api versiyon", 41 | "Response Content Type":"Dönüş İçerik Tipi", 42 | "fetching resource":"kaynak getiriliyor", 43 | "fetching resource list":"kaynak listesi getiriliyor", 44 | "Explore":"Keşfet", 45 | "Show Swagger Petstore Example Apis":"Swagger Petstore Örnek Api'yi Gör", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Sunucudan okuma yapılamıyor. Sunucu access-control-origin ayarlarınızı kontrol edin.", 47 | "Please specify the protocol for":"Lütfen istenen adres için protokol belirtiniz", 48 | "Can't read swagger JSON from":"Swagger JSON bu kaynaktan okunamıyor", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Kaynak baglantısı tamamlandı. Swagger UI gösterime hazırlanıyor", 50 | "Unable to read api":"api okunamadı", 51 | "from path":"yoldan", 52 | "server returned":"sunucuya dönüldü" 53 | }); 54 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.burnetzhong 7 | Parliament 8 | 1.0.0 9 | jar 10 | 11 | Parliament 12 | API governance for Spring Boot 13 | 14 | 15 | org.springframework.boot 16 | spring-boot-starter-parent 17 | 1.4.4.RELEASE 18 | 19 | 20 | 21 | 22 | UTF-8 23 | UTF-8 24 | 1.8 25 | 26 | 27 | 28 | 29 | 30 | org.springframework.cloud 31 | spring-cloud-starter-parent 32 | Camden.SR5 33 | pom 34 | import 35 | 36 | 37 | 38 | 39 | 40 | 41 | org.springframework.boot 42 | spring-boot-starter 43 | 44 | 45 | 46 | org.springframework.boot 47 | spring-boot-starter-web 48 | 49 | 50 | 51 | org.springframework.boot 52 | spring-boot-starter-data-mongodb 53 | 54 | 55 | 56 | org.springframework.boot 57 | spring-boot-starter-test 58 | test 59 | 60 | 61 | 62 | 63 | 64 | 65 | org.springframework.boot 66 | spring-boot-maven-plugin 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/License.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain; 2 | 3 | import com.fasterxml.jackson.annotation.JsonAnyGetter; 4 | import com.fasterxml.jackson.annotation.JsonAnySetter; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | public class License { 10 | private final Map vendorExtensions = new HashMap(); 11 | private String name; 12 | private String url; 13 | 14 | public License name(String name) { 15 | setName(name); 16 | return this; 17 | } 18 | 19 | public License url(String url) { 20 | setUrl(url); 21 | return this; 22 | } 23 | 24 | public String getName() { 25 | return name; 26 | } 27 | 28 | public void setName(String name) { 29 | this.name = name; 30 | } 31 | 32 | public String getUrl() { 33 | return url; 34 | } 35 | 36 | public void setUrl(String url) { 37 | this.url = url; 38 | } 39 | 40 | @JsonAnyGetter 41 | public Map getVendorExtensions() { 42 | return vendorExtensions; 43 | } 44 | 45 | @JsonAnySetter 46 | public void setVendorExtension(String name, Object value) { 47 | if (name.startsWith("x-")) { 48 | vendorExtensions.put(name, value); 49 | } 50 | } 51 | 52 | @Override 53 | public int hashCode() { 54 | final int prime = 31; 55 | int result = 1; 56 | result = prime * result + ((name == null) ? 0 : name.hashCode()); 57 | result = prime * result + ((url == null) ? 0 : url.hashCode()); 58 | return result; 59 | } 60 | 61 | @Override 62 | public boolean equals(Object obj) { 63 | if (this == obj) { 64 | return true; 65 | } 66 | if (obj == null) { 67 | return false; 68 | } 69 | if (getClass() != obj.getClass()) { 70 | return false; 71 | } 72 | License other = (License) obj; 73 | if (name == null) { 74 | if (other.name != null) { 75 | return false; 76 | } 77 | } else if (!name.equals(other.name)) { 78 | return false; 79 | } 80 | if (url == null) { 81 | if (other.url != null) { 82 | return false; 83 | } 84 | } else if (!url.equals(other.url)) { 85 | return false; 86 | } 87 | return true; 88 | } 89 | } -------------------------------------------------------------------------------- /src/main/resources/static/swagger/lang/pl.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Uwaga: Wycofane", 6 | "Implementation Notes":"Uwagi Implementacji", 7 | "Response Class":"Klasa Odpowiedzi", 8 | "Status":"Status", 9 | "Parameters":"Parametry", 10 | "Parameter":"Parametr", 11 | "Value":"Wartość", 12 | "Description":"Opis", 13 | "Parameter Type":"Typ Parametru", 14 | "Data Type":"Typ Danych", 15 | "Response Messages":"Wiadomości Odpowiedzi", 16 | "HTTP Status Code":"Kod Statusu HTTP", 17 | "Reason":"Przyczyna", 18 | "Response Model":"Model Odpowiedzi", 19 | "Request URL":"URL Wywołania", 20 | "Response Body":"Treść Odpowiedzi", 21 | "Response Code":"Kod Odpowiedzi", 22 | "Response Headers":"Nagłówki Odpowiedzi", 23 | "Hide Response":"Ukryj Odpowiedź", 24 | "Headers":"Nagłówki", 25 | "Try it out!":"Wypróbuj!", 26 | "Show/Hide":"Pokaż/Ukryj", 27 | "List Operations":"Lista Operacji", 28 | "Expand Operations":"Rozwiń Operacje", 29 | "Raw":"Nieprzetworzone", 30 | "can't parse JSON. Raw result":"nie można przetworzyć pliku JSON. Nieprzetworzone dane", 31 | "Model Schema":"Schemat Modelu", 32 | "Model":"Model", 33 | "apply":"użyj", 34 | "Username":"Nazwa użytkownika", 35 | "Password":"Hasło", 36 | "Terms of service":"Warunki używania", 37 | "Created by":"Utworzone przez", 38 | "See more at":"Zobacz więcej na", 39 | "Contact the developer":"Kontakt z deweloperem", 40 | "api version":"wersja api", 41 | "Response Content Type":"Typ Zasobu Odpowiedzi", 42 | "fetching resource":"ładowanie zasobu", 43 | "fetching resource list":"ładowanie listy zasobów", 44 | "Explore":"Eksploruj", 45 | "Show Swagger Petstore Example Apis":"Pokaż Przykładowe Api Swagger Petstore", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Brak połączenia z serwerem. Może on nie mieć odpowiednich ustawień access-control-origin.", 47 | "Please specify the protocol for":"Proszę podać protokół dla", 48 | "Can't read swagger JSON from":"Nie można odczytać swagger JSON z", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Ukończono Ładowanie Informacji o Zasobie. Renderowanie Swagger UI", 50 | "Unable to read api":"Nie można odczytać api", 51 | "from path":"ze ścieżki", 52 | "server returned":"serwer zwrócił" 53 | }); 54 | -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/Contact.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain; 2 | 3 | public class Contact { 4 | private String name; 5 | private String url; 6 | private String email; 7 | 8 | public Contact name(String name) { 9 | this.setName(name); 10 | return this; 11 | } 12 | 13 | public Contact url(String url) { 14 | this.setUrl(url); 15 | return this; 16 | } 17 | 18 | public Contact email(String email) { 19 | this.setEmail(email); 20 | return this; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public void setName(String name) { 28 | this.name = name; 29 | } 30 | 31 | public String getUrl() { 32 | return url; 33 | } 34 | 35 | public void setUrl(String url) { 36 | this.url = url; 37 | } 38 | 39 | public String getEmail() { 40 | return email; 41 | } 42 | 43 | public void setEmail(String email) { 44 | this.email = email; 45 | } 46 | 47 | @Override 48 | public int hashCode() { 49 | final int prime = 31; 50 | int result = 1; 51 | result = prime * result + ((email == null) ? 0 : email.hashCode()); 52 | result = prime * result + ((name == null) ? 0 : name.hashCode()); 53 | result = prime * result + ((url == null) ? 0 : url.hashCode()); 54 | return result; 55 | } 56 | 57 | @Override 58 | public boolean equals(Object obj) { 59 | if (this == obj) { 60 | return true; 61 | } 62 | if (obj == null) { 63 | return false; 64 | } 65 | if (getClass() != obj.getClass()) { 66 | return false; 67 | } 68 | Contact other = (Contact) obj; 69 | if (email == null) { 70 | if (other.email != null) { 71 | return false; 72 | } 73 | } else if (!email.equals(other.email)) { 74 | return false; 75 | } 76 | if (name == null) { 77 | if (other.name != null) { 78 | return false; 79 | } 80 | } else if (!name.equals(other.name)) { 81 | return false; 82 | } 83 | if (url == null) { 84 | if (other.url != null) { 85 | return false; 86 | } 87 | } else if (!url.equals(other.url)) { 88 | return false; 89 | } 90 | return true; 91 | } 92 | } -------------------------------------------------------------------------------- /src/main/resources/static/swagger/lang/pt.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Aviso: Depreciado", 6 | "Implementation Notes":"Notas de Implementação", 7 | "Response Class":"Classe de resposta", 8 | "Status":"Status", 9 | "Parameters":"Parâmetros", 10 | "Parameter":"Parâmetro", 11 | "Value":"Valor", 12 | "Description":"Descrição", 13 | "Parameter Type":"Tipo de parâmetro", 14 | "Data Type":"Tipo de dados", 15 | "Response Messages":"Mensagens de resposta", 16 | "HTTP Status Code":"Código de status HTTP", 17 | "Reason":"Razão", 18 | "Response Model":"Modelo resposta", 19 | "Request URL":"URL requisição", 20 | "Response Body":"Corpo da resposta", 21 | "Response Code":"Código da resposta", 22 | "Response Headers":"Cabeçalho da resposta", 23 | "Headers":"Cabeçalhos", 24 | "Hide Response":"Esconder resposta", 25 | "Try it out!":"Tente agora!", 26 | "Show/Hide":"Mostrar/Esconder", 27 | "List Operations":"Listar operações", 28 | "Expand Operations":"Expandir operações", 29 | "Raw":"Cru", 30 | "can't parse JSON. Raw result":"Falha ao analisar JSON. Resulto cru", 31 | "Model Schema":"Modelo esquema", 32 | "Model":"Modelo", 33 | "apply":"Aplicar", 34 | "Username":"Usuário", 35 | "Password":"Senha", 36 | "Terms of service":"Termos do serviço", 37 | "Created by":"Criado por", 38 | "See more at":"Veja mais em", 39 | "Contact the developer":"Contate o desenvolvedor", 40 | "api version":"Versão api", 41 | "Response Content Type":"Tipo de conteúdo da resposta", 42 | "fetching resource":"busca recurso", 43 | "fetching resource list":"buscando lista de recursos", 44 | "Explore":"Explorar", 45 | "Show Swagger Petstore Example Apis":"Show Swagger Petstore Example Apis", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Não é possível ler do servidor. Pode não ter as apropriadas configurações access-control-origin", 47 | "Please specify the protocol for":"Por favor especifique o protocolo", 48 | "Can't read swagger JSON from":"Não é possível ler o JSON Swagger de", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Carregar informação de recurso finalizada. Renderizando Swagger UI", 50 | "Unable to read api":"Não foi possível ler api", 51 | "from path":"do caminho", 52 | "server returned":"servidor retornou" 53 | }); 54 | -------------------------------------------------------------------------------- /src/main/resources/static/swagger/lang/en.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Warning: Deprecated", 6 | "Implementation Notes":"Implementation Notes", 7 | "Response Class":"Response Class", 8 | "Status":"Status", 9 | "Parameters":"Parameters", 10 | "Parameter":"Parameter", 11 | "Value":"Value", 12 | "Description":"Description", 13 | "Parameter Type":"Parameter Type", 14 | "Data Type":"Data Type", 15 | "Response Messages":"Response Messages", 16 | "HTTP Status Code":"HTTP Status Code", 17 | "Reason":"Reason", 18 | "Response Model":"Response Model", 19 | "Request URL":"Request URL", 20 | "Response Body":"Response Body", 21 | "Response Code":"Response Code", 22 | "Response Headers":"Response Headers", 23 | "Hide Response":"Hide Response", 24 | "Headers":"Headers", 25 | "Try it out!":"Try it out!", 26 | "Show/Hide":"Show/Hide", 27 | "List Operations":"List Operations", 28 | "Expand Operations":"Expand Operations", 29 | "Raw":"Raw", 30 | "can't parse JSON. Raw result":"can't parse JSON. Raw result", 31 | "Example Value":"Example Value", 32 | "Model Schema":"Model Schema", 33 | "Model":"Model", 34 | "Click to set as parameter value":"Click to set as parameter value", 35 | "apply":"apply", 36 | "Username":"Username", 37 | "Password":"Password", 38 | "Terms of service":"Terms of service", 39 | "Created by":"Created by", 40 | "See more at":"See more at", 41 | "Contact the developer":"Contact the developer", 42 | "api version":"api version", 43 | "Response Content Type":"Response Content Type", 44 | "Parameter content type:":"Parameter content type:", 45 | "fetching resource":"fetching resource", 46 | "fetching resource list":"fetching resource list", 47 | "Explore":"Explore", 48 | "Show Swagger Petstore Example Apis":"Show Swagger Petstore Example Apis", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Can't read from server. It may not have the appropriate access-control-origin settings.", 50 | "Please specify the protocol for":"Please specify the protocol for", 51 | "Can't read swagger JSON from":"Can't read swagger JSON from", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"Finished Loading Resource Information. Rendering Swagger UI", 53 | "Unable to read api":"Unable to read api", 54 | "from path":"from path", 55 | "server returned":"server returned" 56 | }); 57 | -------------------------------------------------------------------------------- /src/main/resources/static/swagger/lang/ru.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Предупреждение: Устарело", 6 | "Implementation Notes":"Заметки", 7 | "Response Class":"Пример ответа", 8 | "Status":"Статус", 9 | "Parameters":"Параметры", 10 | "Parameter":"Параметр", 11 | "Value":"Значение", 12 | "Description":"Описание", 13 | "Parameter Type":"Тип параметра", 14 | "Data Type":"Тип данных", 15 | "HTTP Status Code":"HTTP код", 16 | "Reason":"Причина", 17 | "Response Model":"Структура ответа", 18 | "Request URL":"URL запроса", 19 | "Response Body":"Тело ответа", 20 | "Response Code":"HTTP код ответа", 21 | "Response Headers":"Заголовки ответа", 22 | "Hide Response":"Спрятать ответ", 23 | "Headers":"Заголовки", 24 | "Response Messages":"Что может прийти в ответ", 25 | "Try it out!":"Попробовать!", 26 | "Show/Hide":"Показать/Скрыть", 27 | "List Operations":"Операции кратко", 28 | "Expand Operations":"Операции подробно", 29 | "Raw":"В сыром виде", 30 | "can't parse JSON. Raw result":"Не удается распарсить ответ:", 31 | "Example Value":"Пример", 32 | "Model Schema":"Структура", 33 | "Model":"Описание", 34 | "Click to set as parameter value":"Нажмите, чтобы испльзовать в качестве значения параметра", 35 | "apply":"применить", 36 | "Username":"Имя пользователя", 37 | "Password":"Пароль", 38 | "Terms of service":"Условия использования", 39 | "Created by":"Разработано", 40 | "See more at":"Еще тут", 41 | "Contact the developer":"Связаться с разработчиком", 42 | "api version":"Версия API", 43 | "Response Content Type":"Content Type ответа", 44 | "Parameter content type:":"Content Type параметра:", 45 | "fetching resource":"Получение ресурса", 46 | "fetching resource list":"Получение ресурсов", 47 | "Explore":"Показать", 48 | "Show Swagger Petstore Example Apis":"Показать примеры АПИ", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Не удается получить ответ от сервера. Возможно, проблема с настройками доступа", 50 | "Please specify the protocol for":"Пожалуйста, укажите протокол для", 51 | "Can't read swagger JSON from":"Не получается прочитать swagger json из", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"Загрузка информации о ресурсах завершена. Рендерим", 53 | "Unable to read api":"Не удалось прочитать api", 54 | "from path":"по адресу", 55 | "server returned":"сервер сказал" 56 | }); 57 | -------------------------------------------------------------------------------- /src/main/resources/static/swagger/lang/ca.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Advertència: Obsolet", 6 | "Implementation Notes":"Notes d'implementació", 7 | "Response Class":"Classe de la Resposta", 8 | "Status":"Estatus", 9 | "Parameters":"Paràmetres", 10 | "Parameter":"Paràmetre", 11 | "Value":"Valor", 12 | "Description":"Descripció", 13 | "Parameter Type":"Tipus del Paràmetre", 14 | "Data Type":"Tipus de la Dada", 15 | "Response Messages":"Missatges de la Resposta", 16 | "HTTP Status Code":"Codi d'Estatus HTTP", 17 | "Reason":"Raó", 18 | "Response Model":"Model de la Resposta", 19 | "Request URL":"URL de la Sol·licitud", 20 | "Response Body":"Cos de la Resposta", 21 | "Response Code":"Codi de la Resposta", 22 | "Response Headers":"Capçaleres de la Resposta", 23 | "Hide Response":"Amagar Resposta", 24 | "Try it out!":"Prova-ho!", 25 | "Show/Hide":"Mostrar/Amagar", 26 | "List Operations":"Llista Operacions", 27 | "Expand Operations":"Expandir Operacions", 28 | "Raw":"Cru", 29 | "can't parse JSON. Raw result":"no puc analitzar el JSON. Resultat cru", 30 | "Example Value":"Valor d'Exemple", 31 | "Model Schema":"Esquema del Model", 32 | "Model":"Model", 33 | "apply":"aplicar", 34 | "Username":"Nom d'usuari", 35 | "Password":"Contrasenya", 36 | "Terms of service":"Termes del servei", 37 | "Created by":"Creat per", 38 | "See more at":"Veure més en", 39 | "Contact the developer":"Contactar amb el desenvolupador", 40 | "api version":"versió de la api", 41 | "Response Content Type":"Tipus de Contingut de la Resposta", 42 | "fetching resource":"recollint recurs", 43 | "fetching resource list":"recollins llista de recursos", 44 | "Explore":"Explorant", 45 | "Show Swagger Petstore Example Apis":"Mostrar API d'Exemple Swagger Petstore", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"No es pot llegir del servidor. Potser no teniu la configuració de control d'accés apropiada.", 47 | "Please specify the protocol for":"Si us plau, especifiqueu el protocol per a", 48 | "Can't read swagger JSON from":"No es pot llegir el JSON de swagger des de", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Finalitzada la càrrega del recurs informatiu. Renderitzant Swagger UI", 50 | "Unable to read api":"No es pot llegir l'api", 51 | "from path":"des de la ruta", 52 | "server returned":"el servidor ha retornat" 53 | }); 54 | -------------------------------------------------------------------------------- /src/main/resources/static/swagger/lang/geo.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"ყურადღება: აღარ გამოიყენება", 6 | "Implementation Notes":"იმპლემენტაციის აღწერა", 7 | "Response Class":"რესპონს კლასი", 8 | "Status":"სტატუსი", 9 | "Parameters":"პარამეტრები", 10 | "Parameter":"პარამეტრი", 11 | "Value":"მნიშვნელობა", 12 | "Description":"აღწერა", 13 | "Parameter Type":"პარამეტრის ტიპი", 14 | "Data Type":"მონაცემის ტიპი", 15 | "Response Messages":"პასუხი", 16 | "HTTP Status Code":"HTTP სტატუსი", 17 | "Reason":"მიზეზი", 18 | "Response Model":"რესპონს მოდელი", 19 | "Request URL":"მოთხოვნის URL", 20 | "Response Body":"პასუხის სხეული", 21 | "Response Code":"პასუხის კოდი", 22 | "Response Headers":"პასუხის ჰედერები", 23 | "Hide Response":"დამალე პასუხი", 24 | "Headers":"ჰედერები", 25 | "Try it out!":"ცადე !", 26 | "Show/Hide":"გამოჩენა/დამალვა", 27 | "List Operations":"ოპერაციების სია", 28 | "Expand Operations":"ოპერაციები ვრცლად", 29 | "Raw":"ნედლი", 30 | "can't parse JSON. Raw result":"JSON-ის დამუშავება ვერ მოხერხდა. ნედლი პასუხი", 31 | "Example Value":"მაგალითი", 32 | "Model Schema":"მოდელის სტრუქტურა", 33 | "Model":"მოდელი", 34 | "Click to set as parameter value":"პარამეტრისთვის მნიშვნელობის მისანიჭებლად, დააკლიკე", 35 | "apply":"გამოყენება", 36 | "Username":"მოხმარებელი", 37 | "Password":"პაროლი", 38 | "Terms of service":"მომსახურების პირობები", 39 | "Created by":"შექმნა", 40 | "See more at":"ნახე ვრცლად", 41 | "Contact the developer":"დაუკავშირდი დეველოპერს", 42 | "api version":"api ვერსია", 43 | "Response Content Type":"პასუხის კონტენტის ტიპი", 44 | "Parameter content type:":"პარამეტრის კონტენტის ტიპი:", 45 | "fetching resource":"რესურსების მიღება", 46 | "fetching resource list":"რესურსების სიის მიღება", 47 | "Explore":"ნახვა", 48 | "Show Swagger Petstore Example Apis":"ნახე Swagger Petstore სამაგალითო Api", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"სერვერთან დაკავშირება ვერ ხერხდება. შეამოწმეთ access-control-origin.", 50 | "Please specify the protocol for":"მიუთითეთ პროტოკოლი", 51 | "Can't read swagger JSON from":"swagger JSON წაკითხვა ვერ მოხერხდა", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"რესურსების ჩატვირთვა სრულდება. Swagger UI რენდერდება", 53 | "Unable to read api":"api წაკითხვა ვერ მოხერხდა", 54 | "from path":"მისამართიდან", 55 | "server returned":"სერვერმა დააბრუნა" 56 | }); 57 | -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/auth/ApiKeyAuthDefinition.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain.auth; 2 | 3 | public class ApiKeyAuthDefinition extends AbstractSecuritySchemeDefinition { 4 | private String type = "apiKey"; 5 | private String name; 6 | private In in; 7 | 8 | public ApiKeyAuthDefinition() { 9 | } 10 | 11 | public ApiKeyAuthDefinition(String name, In in) { 12 | super(); 13 | this.setName(name); 14 | this.setIn(in); 15 | } 16 | 17 | public ApiKeyAuthDefinition name(String name) { 18 | this.setName(name); 19 | return this; 20 | } 21 | 22 | public ApiKeyAuthDefinition in(In in) { 23 | this.setIn(in); 24 | return this; 25 | } 26 | 27 | public String getName() { 28 | return name; 29 | } 30 | 31 | public void setName(String name) { 32 | this.name = name; 33 | } 34 | 35 | public In getIn() { 36 | return in; 37 | } 38 | 39 | public void setIn(In in) { 40 | this.in = in; 41 | } 42 | 43 | public String getType() { 44 | return type; 45 | } 46 | 47 | public void setType(String type) { 48 | this.type = type; 49 | } 50 | 51 | @Override 52 | public int hashCode() { 53 | final int prime = 31; 54 | int result = super.hashCode(); 55 | result = prime * result + ((in == null) ? 0 : in.hashCode()); 56 | result = prime * result + ((name == null) ? 0 : name.hashCode()); 57 | result = prime * result + ((type == null) ? 0 : type.hashCode()); 58 | return result; 59 | } 60 | 61 | @Override 62 | public boolean equals(Object obj) { 63 | if (this == obj) { 64 | return true; 65 | } 66 | if (obj == null) { 67 | return false; 68 | } 69 | if (!super.equals(obj)) { 70 | return false; 71 | } 72 | if (getClass() != obj.getClass()) { 73 | return false; 74 | } 75 | ApiKeyAuthDefinition other = (ApiKeyAuthDefinition) obj; 76 | if (in != other.in) { 77 | return false; 78 | } 79 | if (name == null) { 80 | if (other.name != null) { 81 | return false; 82 | } 83 | } else if (!name.equals(other.name)) { 84 | return false; 85 | } 86 | if (type == null) { 87 | if (other.type != null) { 88 | return false; 89 | } 90 | } else if (!type.equals(other.type)) { 91 | return false; 92 | } 93 | return true; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/main/resources/static/swagger/lang/it.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Attenzione: Deprecato", 6 | "Implementation Notes":"Note di implementazione", 7 | "Response Class":"Classe della risposta", 8 | "Status":"Stato", 9 | "Parameters":"Parametri", 10 | "Parameter":"Parametro", 11 | "Value":"Valore", 12 | "Description":"Descrizione", 13 | "Parameter Type":"Tipo di parametro", 14 | "Data Type":"Tipo di dato", 15 | "Response Messages":"Messaggi della risposta", 16 | "HTTP Status Code":"Codice stato HTTP", 17 | "Reason":"Motivo", 18 | "Response Model":"Modello di risposta", 19 | "Request URL":"URL della richiesta", 20 | "Response Body":"Corpo della risposta", 21 | "Response Code":"Oggetto della risposta", 22 | "Response Headers":"Intestazioni della risposta", 23 | "Hide Response":"Nascondi risposta", 24 | "Try it out!":"Provalo!", 25 | "Show/Hide":"Mostra/Nascondi", 26 | "List Operations":"Mostra operazioni", 27 | "Expand Operations":"Espandi operazioni", 28 | "Raw":"Grezzo (raw)", 29 | "can't parse JSON. Raw result":"non è possibile parsare il JSON. Risultato grezzo (raw).", 30 | "Model Schema":"Schema del modello", 31 | "Model":"Modello", 32 | "apply":"applica", 33 | "Username":"Nome utente", 34 | "Password":"Password", 35 | "Terms of service":"Condizioni del servizio", 36 | "Created by":"Creato da", 37 | "See more at":"Informazioni aggiuntive:", 38 | "Contact the developer":"Contatta lo sviluppatore", 39 | "api version":"versione api", 40 | "Response Content Type":"Tipo di contenuto (content type) della risposta", 41 | "fetching resource":"recuperando la risorsa", 42 | "fetching resource list":"recuperando lista risorse", 43 | "Explore":"Esplora", 44 | "Show Swagger Petstore Example Apis":"Mostra le api di esempio di Swagger Petstore", 45 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Non è possibile leggere dal server. Potrebbe non avere le impostazioni di controllo accesso origine (access-control-origin) appropriate.", 46 | "Please specify the protocol for":"Si prega di specificare il protocollo per", 47 | "Can't read swagger JSON from":"Impossibile leggere JSON swagger da:", 48 | "Finished Loading Resource Information. Rendering Swagger UI":"Lettura informazioni risorse termianta. Swagger UI viene mostrata", 49 | "Unable to read api":"Impossibile leggere la api", 50 | "from path":"da cartella", 51 | "server returned":"il server ha restituito" 52 | }); 53 | -------------------------------------------------------------------------------- /src/main/resources/static/swagger/lang/es.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Advertencia: Obsoleto", 6 | "Implementation Notes":"Notas de implementación", 7 | "Response Class":"Clase de la Respuesta", 8 | "Status":"Status", 9 | "Parameters":"Parámetros", 10 | "Parameter":"Parámetro", 11 | "Value":"Valor", 12 | "Description":"Descripción", 13 | "Parameter Type":"Tipo del Parámetro", 14 | "Data Type":"Tipo del Dato", 15 | "Response Messages":"Mensajes de la Respuesta", 16 | "HTTP Status Code":"Código de Status HTTP", 17 | "Reason":"Razón", 18 | "Response Model":"Modelo de la Respuesta", 19 | "Request URL":"URL de la Solicitud", 20 | "Response Body":"Cuerpo de la Respuesta", 21 | "Response Code":"Código de la Respuesta", 22 | "Response Headers":"Encabezados de la Respuesta", 23 | "Hide Response":"Ocultar Respuesta", 24 | "Try it out!":"Pruébalo!", 25 | "Show/Hide":"Mostrar/Ocultar", 26 | "List Operations":"Listar Operaciones", 27 | "Expand Operations":"Expandir Operaciones", 28 | "Raw":"Crudo", 29 | "can't parse JSON. Raw result":"no puede parsear el JSON. Resultado crudo", 30 | "Example Value":"Valor de Ejemplo", 31 | "Model Schema":"Esquema del Modelo", 32 | "Model":"Modelo", 33 | "apply":"aplicar", 34 | "Username":"Nombre de usuario", 35 | "Password":"Contraseña", 36 | "Terms of service":"Términos de Servicio", 37 | "Created by":"Creado por", 38 | "See more at":"Ver más en", 39 | "Contact the developer":"Contactar al desarrollador", 40 | "api version":"versión de la api", 41 | "Response Content Type":"Tipo de Contenido (Content Type) de la Respuesta", 42 | "fetching resource":"buscando recurso", 43 | "fetching resource list":"buscando lista del recurso", 44 | "Explore":"Explorar", 45 | "Show Swagger Petstore Example Apis":"Mostrar Api Ejemplo de Swagger Petstore", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"No se puede leer del servidor. Tal vez no tiene la configuración de control de acceso de origen (access-control-origin) apropiado.", 47 | "Please specify the protocol for":"Por favor, especificar el protocola para", 48 | "Can't read swagger JSON from":"No se puede leer el JSON de swagger desde", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Finalizada la carga del recurso de Información. Mostrando Swagger UI", 50 | "Unable to read api":"No se puede leer la api", 51 | "from path":"desde ruta", 52 | "server returned":"el servidor retornó" 53 | }); 54 | -------------------------------------------------------------------------------- /src/main/resources/static/swagger/lang/fr.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Avertissement : Obsolète", 6 | "Implementation Notes":"Notes d'implémentation", 7 | "Response Class":"Classe de la réponse", 8 | "Status":"Statut", 9 | "Parameters":"Paramètres", 10 | "Parameter":"Paramètre", 11 | "Value":"Valeur", 12 | "Description":"Description", 13 | "Parameter Type":"Type du paramètre", 14 | "Data Type":"Type de données", 15 | "Response Messages":"Messages de la réponse", 16 | "HTTP Status Code":"Code de statut HTTP", 17 | "Reason":"Raison", 18 | "Response Model":"Modèle de réponse", 19 | "Request URL":"URL appelée", 20 | "Response Body":"Corps de la réponse", 21 | "Response Code":"Code de la réponse", 22 | "Response Headers":"En-têtes de la réponse", 23 | "Hide Response":"Cacher la réponse", 24 | "Headers":"En-têtes", 25 | "Try it out!":"Testez !", 26 | "Show/Hide":"Afficher/Masquer", 27 | "List Operations":"Liste des opérations", 28 | "Expand Operations":"Développer les opérations", 29 | "Raw":"Brut", 30 | "can't parse JSON. Raw result":"impossible de décoder le JSON. Résultat brut", 31 | "Example Value":"Exemple la valeur", 32 | "Model Schema":"Définition du modèle", 33 | "Model":"Modèle", 34 | "apply":"appliquer", 35 | "Username":"Nom d'utilisateur", 36 | "Password":"Mot de passe", 37 | "Terms of service":"Conditions de service", 38 | "Created by":"Créé par", 39 | "See more at":"Voir plus sur", 40 | "Contact the developer":"Contacter le développeur", 41 | "api version":"version de l'api", 42 | "Response Content Type":"Content Type de la réponse", 43 | "fetching resource":"récupération de la ressource", 44 | "fetching resource list":"récupération de la liste de ressources", 45 | "Explore":"Explorer", 46 | "Show Swagger Petstore Example Apis":"Montrer les Apis de l'exemple Petstore de Swagger", 47 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Impossible de lire à partir du serveur. Il se peut que les réglages access-control-origin ne soient pas appropriés.", 48 | "Please specify the protocol for":"Veuillez spécifier un protocole pour", 49 | "Can't read swagger JSON from":"Impossible de lire le JSON swagger à partir de", 50 | "Finished Loading Resource Information. Rendering Swagger UI":"Chargement des informations terminé. Affichage de Swagger UI", 51 | "Unable to read api":"Impossible de lire l'api", 52 | "from path":"à partir du chemin", 53 | "server returned":"réponse du serveur" 54 | }); 55 | -------------------------------------------------------------------------------- /src/main/resources/static/swagger/lang/el.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Προειδοποίηση: Έχει αποσυρθεί", 6 | "Implementation Notes":"Σημειώσεις Υλοποίησης", 7 | "Response Class":"Απόκριση", 8 | "Status":"Κατάσταση", 9 | "Parameters":"Παράμετροι", 10 | "Parameter":"Παράμετρος", 11 | "Value":"Τιμή", 12 | "Description":"Περιγραφή", 13 | "Parameter Type":"Τύπος Παραμέτρου", 14 | "Data Type":"Τύπος Δεδομένων", 15 | "Response Messages":"Μηνύματα Απόκρισης", 16 | "HTTP Status Code":"Κωδικός Κατάστασης HTTP", 17 | "Reason":"Αιτιολογία", 18 | "Response Model":"Μοντέλο Απόκρισης", 19 | "Request URL":"URL Αιτήματος", 20 | "Response Body":"Σώμα Απόκρισης", 21 | "Response Code":"Κωδικός Απόκρισης", 22 | "Response Headers":"Επικεφαλίδες Απόκρισης", 23 | "Hide Response":"Απόκρυψη Απόκρισης", 24 | "Headers":"Επικεφαλίδες", 25 | "Try it out!":"Δοκιμάστε το!", 26 | "Show/Hide":"Εμφάνιση/Απόκρυψη", 27 | "List Operations":"Λίστα Λειτουργιών", 28 | "Expand Operations":"Ανάπτυξη Λειτουργιών", 29 | "Raw":"Ακατέργαστο", 30 | "can't parse JSON. Raw result":"αδυναμία ανάλυσης JSON. Ακατέργαστο αποτέλεσμα", 31 | "Example Value":"Παράδειγμα Τιμής", 32 | "Model Schema":"Σχήμα Μοντέλου", 33 | "Model":"Μοντέλο", 34 | "Click to set as parameter value":"Πατήστε για να θέσετε τιμή παραμέτρου", 35 | "apply":"εφαρμογή", 36 | "Username":"Όνομα χρήση", 37 | "Password":"Κωδικός πρόσβασης", 38 | "Terms of service":"Όροι χρήσης", 39 | "Created by":"Δημιουργήθηκε από", 40 | "See more at":"Δείτε περισσότερα στο", 41 | "Contact the developer":"Επικοινωνήστε με τον προγραμματιστή", 42 | "api version":"έκδοση api", 43 | "Response Content Type":"Τύπος Περιεχομένου Απόκρισης", 44 | "Parameter content type:":"Τύπος περιεχομένου παραμέτρου:", 45 | "fetching resource":"παραλαβή πόρου", 46 | "fetching resource list":"παραλαβή λίστας πόρων", 47 | "Explore":"Εξερεύνηση", 48 | "Show Swagger Petstore Example Apis":"Εμφάνιση Api Δειγμάτων Petstore του Swagger", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Αδυναμία ανάγνωσης από τον εξυπηρετητή. Μπορεί να μην έχει κατάλληλες ρυθμίσεις για access-control-origin.", 50 | "Please specify the protocol for":"Παρακαλώ προσδιορίστε το πρωτόκολλο για", 51 | "Can't read swagger JSON from":"Αδυναμία ανάγνωσης swagger JSON από", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"Ολοκλήρωση Φόρτωσης Πληροφορικών Πόρου. Παρουσίαση Swagger UI", 53 | "Unable to read api":"Αδυναμία ανάγνωσης api", 54 | "from path":"από το μονοπάτι", 55 | "server returned":"ο εξυπηρετηρής επέστρεψε" 56 | }); 57 | -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/auth/AuthorizationValue.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain.auth; 2 | 3 | public class AuthorizationValue { 4 | private String value, type, keyName; 5 | 6 | public AuthorizationValue() { 7 | } 8 | 9 | public AuthorizationValue(String keyName, String value, String type) { 10 | this.setKeyName(keyName); 11 | this.setValue(value); 12 | this.setType(type); 13 | } 14 | 15 | public AuthorizationValue value(String value) { 16 | this.value = value; 17 | return this; 18 | } 19 | 20 | public AuthorizationValue type(String type) { 21 | this.type = type; 22 | return this; 23 | } 24 | 25 | public AuthorizationValue keyName(String keyName) { 26 | this.keyName = keyName; 27 | return this; 28 | } 29 | 30 | public String getValue() { 31 | return value; 32 | } 33 | 34 | public void setValue(String value) { 35 | this.value = value; 36 | } 37 | 38 | public String getType() { 39 | return type; 40 | } 41 | 42 | public void setType(String type) { 43 | this.type = type; 44 | } 45 | 46 | public String getKeyName() { 47 | return keyName; 48 | } 49 | 50 | public void setKeyName(String keyName) { 51 | this.keyName = keyName; 52 | } 53 | 54 | @Override 55 | public int hashCode() { 56 | final int prime = 31; 57 | int result = 1; 58 | result = prime * result + ((keyName == null) ? 0 : keyName.hashCode()); 59 | result = prime * result + ((type == null) ? 0 : type.hashCode()); 60 | result = prime * result + ((value == null) ? 0 : value.hashCode()); 61 | return result; 62 | } 63 | 64 | @Override 65 | public boolean equals(Object obj) { 66 | if (this == obj) { 67 | return true; 68 | } 69 | if (obj == null) { 70 | return false; 71 | } 72 | if (getClass() != obj.getClass()) { 73 | return false; 74 | } 75 | AuthorizationValue other = (AuthorizationValue) obj; 76 | if (keyName == null) { 77 | if (other.keyName != null) { 78 | return false; 79 | } 80 | } else if (!keyName.equals(other.keyName)) { 81 | return false; 82 | } 83 | if (type == null) { 84 | if (other.type != null) { 85 | return false; 86 | } 87 | } else if (!type.equals(other.type)) { 88 | return false; 89 | } 90 | if (value == null) { 91 | if (other.value != null) { 92 | return false; 93 | } 94 | } else if (!value.equals(other.value)) { 95 | return false; 96 | } 97 | return true; 98 | } 99 | } -------------------------------------------------------------------------------- /src/main/resources/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Parliament Server 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 40 | 41 | 42 |
43 | 44 |
45 |

46 | API base path list: 47 |

48 |
49 |
50 |
51 | 60 |
61 |
62 | 63 |
64 | 65 | 66 |
67 |
68 |
69 |

Copyright © burnnetzhong 2017

70 |
71 | 72 |
73 | 74 |
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/AbstractModel.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain; 2 | 3 | import com.fasterxml.jackson.annotation.JsonAnyGetter; 4 | import com.fasterxml.jackson.annotation.JsonAnySetter; 5 | import com.fasterxml.jackson.annotation.JsonIgnore; 6 | 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | 10 | public abstract class AbstractModel implements Model { 11 | private ExternalDocs externalDocs; 12 | private String reference; 13 | private String title; 14 | private final Map vendorExtensions = new HashMap(); 15 | 16 | @Override 17 | public ExternalDocs getExternalDocs() { 18 | return externalDocs; 19 | } 20 | 21 | public void setExternalDocs(ExternalDocs value) { 22 | externalDocs = value; 23 | } 24 | 25 | @Override 26 | public String getTitle() { 27 | return title; 28 | } 29 | 30 | @Override 31 | public void setTitle(String title) { 32 | this.title = title; 33 | } 34 | 35 | @JsonAnyGetter 36 | public Map getVendorExtensions() { 37 | return vendorExtensions; 38 | } 39 | 40 | @JsonAnySetter 41 | public void setVendorExtension(String name, Object value) { 42 | if (name.startsWith("x-")) { 43 | vendorExtensions.put(name, value); 44 | } 45 | } 46 | 47 | public void cloneTo(Object clone) { 48 | AbstractModel cloned = (AbstractModel) clone; 49 | cloned.externalDocs = this.externalDocs; 50 | } 51 | 52 | public Object clone() { 53 | return null; 54 | } 55 | 56 | @Override 57 | public int hashCode() { 58 | final int prime = 31; 59 | int result = 1; 60 | result = prime * result 61 | + ((externalDocs == null) ? 0 : externalDocs.hashCode()); 62 | result = prime * result 63 | + ((vendorExtensions == null) ? 0 : vendorExtensions.hashCode()); 64 | return result; 65 | } 66 | 67 | @Override 68 | public boolean equals(Object obj) { 69 | if (this == obj) { 70 | return true; 71 | } 72 | if (obj == null) { 73 | return false; 74 | } 75 | if (getClass() != obj.getClass()) { 76 | return false; 77 | } 78 | AbstractModel other = (AbstractModel) obj; 79 | if (externalDocs == null) { 80 | if (other.externalDocs != null) { 81 | return false; 82 | } 83 | } else if (!externalDocs.equals(other.externalDocs)) { 84 | return false; 85 | } 86 | if (vendorExtensions == null) { 87 | if (other.vendorExtensions != null) { 88 | return false; 89 | } 90 | } else if (!vendorExtensions.equals(other.vendorExtensions)) { 91 | return false; 92 | } 93 | return true; 94 | } 95 | 96 | @JsonIgnore 97 | @Override 98 | public String getReference() { 99 | return reference; 100 | } 101 | 102 | @Override 103 | public void setReference(String reference) { 104 | this.reference = reference; 105 | } 106 | 107 | 108 | } 109 | -------------------------------------------------------------------------------- /src/main/resources/static/swagger/css/style.css: -------------------------------------------------------------------------------- 1 | .swagger-section #header a#logo{font-size:1.5em;font-weight:700;text-decoration:none;padding:20px 0 20px 40px}#text-head{font-size:80px;font-family:Roboto,sans-serif;color:#fff;float:right;margin-right:20%}.navbar-fixed-top .navbar-brand,.navbar-fixed-top .navbar-nav,.navbar-header{height:auto}.navbar-inverse{background-color:#000;border-color:#000}#navbar-brand{margin-left:20%}.navtext{font-size:10px}.h1,h1{font-size:60px}.navbar-default .navbar-header .navbar-brand{color:#a2dfee}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a{color:#393939;font-family:Arvo,serif;font-size:1.5em}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a:hover{color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2{color:#525252;padding-left:0;display:block;clear:none;float:left;font-family:Arvo,serif;font-weight:700}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#0a0a0a}.container1{width:1500px;margin:auto;margin-top:0;background-repeat:no-repeat;background-position:-40px -20px;margin-bottom:210px}.container-inner{width:1200px;margin:auto;background-color:hsla(192,8%,88%,.75);padding-bottom:40px;padding-top:40px;border-radius:15px}.header-content{padding:0;width:1000px}.title1{font-size:80px;font-family:Vollkorn,serif;color:#404040;text-align:center;padding-top:40px;padding-bottom:100px}#icon{margin-top:-18px}.subtext{font-size:25px;font-style:italic;color:#08b;text-align:right;padding-right:250px}.bg-primary{background-color:#00468b}.navbar-default .nav>li>a,.navbar-default .nav>li>a:focus,.navbar-default .nav>li>a:focus:hover,.navbar-default .nav>li>a:hover{color:#08b}.text-faded{font-size:25px;font-family:Vollkorn,serif}.section-heading{font-family:Vollkorn,serif;font-size:45px;padding-bottom:10px}hr{border-color:#00468b;padding-bottom:10px}.description{margin-top:20px;padding-bottom:200px}.description li{font-family:Vollkorn,serif;font-size:25px;color:#525252;margin-left:28%;padding-top:5px}.gap{margin-top:200px}.troubleshootingtext{color:hsla(0,0%,100%,.7);padding-left:30%}.troubleshootingtext li{list-style-type:circle;font-size:25px;padding-bottom:5px}.overlay{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1}.block.response_body.json:hover{cursor:pointer}.backdrop{color:blue}#myModal{height:100%}.modal-backdrop{bottom:0;position:fixed}.curl{padding:10px;font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;font-size:.9em;max-height:400px;margin-top:5px;overflow-y:auto;background-color:#fcf6db;border:1px solid #e5e0c6;border-radius:4px}.curl_title{font-size:1.1em;margin:0;padding:15px 0 5px;font-family:Open Sans,Helvetica Neue,Arial,sans-serif;font-weight:500;line-height:1.1}.footer{display:none}.swagger-section .swagger-ui-wrap h2{padding:0}h2{margin:0;margin-bottom:5px}.markdown p,.swagger-section .swagger-ui-wrap .code{font-size:15px;font-family:Arvo,serif}.swagger-section .swagger-ui-wrap b{font-family:Arvo,serif}#signin:hover{cursor:pointer}.dropdown-menu{padding:15px}.navbar-right .dropdown-menu{left:0;right:auto}#signinbutton{width:100%;height:32px;font-size:13px;font-weight:700;color:#08b}.navbar-default .nav>li .details{color:#000;text-transform:none;font-size:15px;font-weight:400;font-family:Open Sans,sans-serif;font-style:italic;line-height:20px;top:-2px}.navbar-default .nav>li .details:hover{color:#000}#signout{width:100%;height:32px;font-size:13px;font-weight:700;color:#08b} -------------------------------------------------------------------------------- /src/main/resources/static/swagger/lib/jquery.ba-bbq.min.js: -------------------------------------------------------------------------------- 1 | !function(e,t){function n(e){return"string"==typeof e}function r(e){var t=g.call(arguments,1);return function(){return e.apply(this,t.concat(g.call(arguments)))}}function o(e){return e.replace(/^[^#]*#?(.*)$/,"$1")}function a(e){return e.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}function i(r,o,a,i,c){var u,s,p,h,d;return i!==f?(p=a.match(r?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/),d=p[3]||"",2===c&&n(i)?s=i.replace(r?R:E,""):(h=l(p[2]),i=n(i)?l[r?A:w](i):i,s=2===c?i:1===c?e.extend({},i,h):e.extend({},h,i),s=b(s),r&&(s=s.replace(m,y))),u=p[1]+(r?"#":s||!p[1]?"?":"")+s+d):u=o(a!==f?a:t[S][q]),u}function c(e,t,r){return t===f||"boolean"==typeof t?(r=t,t=b[e?A:w]()):t=n(t)?t.replace(e?R:E,""):t,l(t,r)}function u(t,r,o,a){return n(o)||"object"==typeof o||(a=o,o=r,r=f),this.each(function(){var n=e(this),i=r||v()[(this.nodeName||"").toLowerCase()]||"",c=i&&n.attr(i)||"";n.attr(i,b[t](c,o,a))})}var f,s,l,p,h,d,v,m,g=Array.prototype.slice,y=decodeURIComponent,b=e.param,$=e.bbq=e.bbq||{},x=e.event.special,j="hashchange",w="querystring",A="fragment",N="elemUrlAttr",S="location",q="href",C="src",E=/^.*\?|#.*$/g,R=/^.*\#/,U={};b[w]=r(i,0,a),b[A]=s=r(i,1,o),s.noEscape=function(t){t=t||"";var n=e.map(t.split(""),encodeURIComponent);m=new RegExp(n.join("|"),"g")},s.noEscape(",/"),e.deparam=l=function(t,n){var r={},o={"true":!0,"false":!1,"null":null};return e.each(t.replace(/\+/g," ").split("&"),function(t,a){var i,c=a.split("="),u=y(c[0]),s=r,l=0,p=u.split("]["),h=p.length-1;if(/\[/.test(p[0])&&/\]$/.test(p[h])?(p[h]=p[h].replace(/\]$/,""),p=p.shift().split("[").concat(p),h=p.length-1):h=0,2===c.length)if(i=y(c[1]),n&&(i=i&&!isNaN(i)?+i:"undefined"===i?f:o[i]!==f?o[i]:i),h)for(;l<=h;l++)u=""===p[l]?s.length:p[l],s=s[u]=l').hide().insertAfter("body")[0].contentWindow,s=function(){return r(a.document[i][u])},(f=function(e,t){if(e!==t){var n=a.document;n.open().close(),n[i].hash="#"+e}})(r()))}var o,a,f,s,p={};return p.start=function(){if(!o){var a=r();f||n(),function l(){var n=r(),p=s(a);n!==a?(f(a=n,p),e(t).trigger(c)):p!==a&&(t[i][u]=t[i][u].replace(/#.*/,"")+"#"+p),o=setTimeout(l,e[c+"Delay"])}()}},p.stop=function(){a||(o&&clearTimeout(o),o=0)},p}()}(jQuery,this); -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/refs/GenericRef.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain.refs; 2 | 3 | /** 4 | * A class the encapsulates logic that is common to RefModel, RefParameter, and RefProperty. 5 | */ 6 | public class GenericRef { 7 | 8 | private final RefFormat format; 9 | private final RefType type; 10 | private final String ref; 11 | private final String simpleRef; 12 | 13 | public GenericRef(RefType type, String ref) { 14 | this.format = computeRefFormat(ref); 15 | this.type = type; 16 | 17 | if (format == RefFormat.INTERNAL && !ref.startsWith("#/")) { 18 | /* this is an internal path that did not start with a #/, we must be in some of ModelResolver code 19 | while currently relies on the ability to create RefModel/RefProperty objects via a constructor call like 20 | 1) new RefModel("Animal")..and expects get$ref to return #/definitions/Animal 21 | 2) new RefModel("http://blah.com/something/file.json")..and expects get$ref to turn the URL 22 | */ 23 | this.ref = type.getInternalPrefix() + ref; 24 | } else { 25 | this.ref = ref; 26 | } 27 | 28 | this.simpleRef = computeSimpleRef(this.ref, format, type); 29 | } 30 | 31 | public RefFormat getFormat() { 32 | return format; 33 | } 34 | 35 | public RefType getType() { 36 | return type; 37 | } 38 | 39 | public String getRef() { 40 | return ref; 41 | } 42 | 43 | public String getSimpleRef() { 44 | return simpleRef; 45 | } 46 | 47 | @Override 48 | public boolean equals(Object o) { 49 | if (this == o) { 50 | return true; 51 | } 52 | if (o == null || getClass() != o.getClass()) { 53 | return false; 54 | } 55 | 56 | GenericRef that = (GenericRef) o; 57 | 58 | if (format != that.format) { 59 | return false; 60 | } 61 | if (type != that.type) { 62 | return false; 63 | } 64 | if (ref != null ? !ref.equals(that.ref) : that.ref != null) { 65 | return false; 66 | } 67 | return !(simpleRef != null ? !simpleRef.equals(that.simpleRef) : that.simpleRef != null); 68 | 69 | } 70 | 71 | @Override 72 | public int hashCode() { 73 | int result = format != null ? format.hashCode() : 0; 74 | result = 31 * result + (type != null ? type.hashCode() : 0); 75 | result = 31 * result + (ref != null ? ref.hashCode() : 0); 76 | result = 31 * result + (simpleRef != null ? simpleRef.hashCode() : 0); 77 | return result; 78 | } 79 | 80 | private static String computeSimpleRef(String ref, RefFormat format, RefType type) { 81 | String result = ref; 82 | //simple refs really only apply to internal refs 83 | if (format == RefFormat.INTERNAL) { 84 | String prefix = type.getInternalPrefix(); 85 | result = ref.substring(prefix.length()); 86 | } 87 | 88 | return result; 89 | } 90 | 91 | private static RefFormat computeRefFormat(String ref) { 92 | RefFormat result = RefFormat.INTERNAL; 93 | if (ref.startsWith("http")) { 94 | result = RefFormat.URL; 95 | } else if (ref.startsWith("#/")) { 96 | result = RefFormat.INTERNAL; 97 | } else if (ref.startsWith(".") || ref.startsWith("/")) { 98 | result = RefFormat.RELATIVE; 99 | } 100 | 101 | return result; 102 | } 103 | 104 | } 105 | -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/ExternalDocs.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain; 2 | 3 | import com.fasterxml.jackson.annotation.JsonAnyGetter; 4 | import com.fasterxml.jackson.annotation.JsonAnySetter; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | /** 10 | * Container for a External Documentation Object. 11 | */ 12 | public class ExternalDocs { 13 | /** 14 | * A short description of the target documentation. GFM syntax can be used for rich text representation. 15 | */ 16 | private String description; 17 | 18 | /** 19 | * Required. The URL for the target documentation. Value MUST be in the format of a URL. 20 | */ 21 | private String url; 22 | 23 | private final Map vendorExtensions = new HashMap(); 24 | 25 | public ExternalDocs() { 26 | } 27 | 28 | public ExternalDocs(String description, String url) { 29 | this.setDescription(description); 30 | this.setUrl(url); 31 | } 32 | 33 | public ExternalDocs description(String description) { 34 | this.setDescription(description); 35 | return this; 36 | } 37 | 38 | public ExternalDocs url(String url) { 39 | this.setUrl(url); 40 | return this; 41 | } 42 | 43 | public String getDescription() { 44 | return description; 45 | } 46 | 47 | public void setDescription(String description) { 48 | this.description = description; 49 | } 50 | 51 | public String getUrl() { 52 | return url; 53 | } 54 | 55 | public void setUrl(String url) { 56 | this.url = url; 57 | } 58 | 59 | @JsonAnyGetter 60 | public Map getVendorExtensions() { 61 | return vendorExtensions; 62 | } 63 | 64 | @JsonAnySetter 65 | public void setVendorExtension(String name, Object value) { 66 | if (name.startsWith("x-")) { 67 | vendorExtensions.put(name, value); 68 | } 69 | } 70 | 71 | @Override 72 | public int hashCode() { 73 | final int prime = 31; 74 | int result = 1; 75 | result = prime * result 76 | + ((description == null) ? 0 : description.hashCode()); 77 | result = prime * result + ((url == null) ? 0 : url.hashCode()); 78 | result = prime * result 79 | + ((vendorExtensions == null) ? 0 : vendorExtensions.hashCode()); 80 | return result; 81 | } 82 | 83 | @Override 84 | public boolean equals(Object obj) { 85 | if (this == obj) { 86 | return true; 87 | } 88 | if (obj == null) { 89 | return false; 90 | } 91 | if (getClass() != obj.getClass()) { 92 | return false; 93 | } 94 | ExternalDocs other = (ExternalDocs) obj; 95 | if (description == null) { 96 | if (other.description != null) { 97 | return false; 98 | } 99 | } else if (!description.equals(other.description)) { 100 | return false; 101 | } 102 | if (url == null) { 103 | if (other.url != null) { 104 | return false; 105 | } 106 | } else if (!url.equals(other.url)) { 107 | return false; 108 | } 109 | if (vendorExtensions == null) { 110 | if (other.vendorExtensions != null) { 111 | return false; 112 | } 113 | } else if (!vendorExtensions.equals(other.vendorExtensions)) { 114 | return false; 115 | } 116 | return true; 117 | } 118 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Parliament 2 | 3 | Parliament is an API document center for microservice architecture based on [SpringFox](http://springfox.github.io/springfox/) and [Swagger](http://swagger.io/). It aims to manage all APIs of individual microservices in one place. 4 | 5 | The idea comes from [GrokOla](http://www.grokola.com/) who provides a featured Wiki for dev teams. If you find Parliament is not enough for you, please take a look at [GrokOla](http://www.grokola.com/). 6 | 7 | ## How to run Parliament server 8 | 9 | ### Prerequisites 10 | This project is implemented using Spring Boot, and MongoDB for database. 11 | - Java 1.8 12 | - Maven 13 | - MongoDB 14 | 15 | 16 | ### Config Database 17 | Modify MongoDB configurations in application.properties: 18 | 19 | spring.data.mongodb.host = _MongoDB address_ 20 | spring.data.mongodb.database = _MongoDB database name_ 21 | spring.data.mongodb.port = _MongoDB port_ 22 | 23 | ### Build and Start up 24 | Use following command to start: 25 | 26 | mvn package && java -jar target/Parliament-1.0.0.jar 27 | 28 | ## Publish API information 29 | This section is only for Spring Boot application. 30 | 31 | To publish API information to Parliament server, please use: 32 | - springfox-swagger2 from SpringFox 33 | - khs-spring-boot-publish-swagger-starter which build from [https://github.com/burnettzhong/khs-spring-boot-publish-swagger-starter](https://github.com/burnettzhong/khs-spring-boot-publish-swagger-starter) 34 | 35 | CAUTION: for _khs-spring-boot-publish-swagger-starter_, please do not use original one from Keyhole Software, since there are several bugs. I have created pull request to them, if they merge my code, I will update this section. 36 | 37 | 1. Build and add khs-spring-boot-publish-swagger-starter dependency, run following command: 38 | 39 | 40 | git clone https://github.com/burnettzhong/khs-spring-boot-publish-swagger-starter 41 | cd khs-spring-boot-publish-swagger-starter 42 | mvn clean install 43 | 44 | 45 | 2. Add maven dependencies 46 | 47 | 48 | io.springfox 49 | springfox-swagger2 50 | 2.6.1 51 | 52 | 53 | com.keyholesoftware 54 | khs-spring-boot-publish-swagger-starter 55 | 1.0.2 56 | 57 | 58 | 3. Configure your Spring Boot application for Swagger and push API information to Parliament server. 59 | Simply add **@EnableSwagger2** and **@PublishSwagger** annotations. 60 | 61 | 62 | @EnableSwagger2 63 | @PublishSwagger 64 | public class ServiceApplication { 65 | ... 66 | } 67 | 68 | For more information about Swagger2 usage, please visit [Springfox Reference Documentation](http://springfox.github.io/springfox/docs/current/). 69 | 70 | 4. Add the following properties your application.yml file: 71 | 72 | 73 | swagger: 74 | publish: 75 | publish-url: http://{_Parliament server address_}/swagger/publish/ 76 | swagger-url: http://127.0.0.1:${server.port}/v2/api-docs 77 | 78 | 79 | That's all! Now you can start your Spring Boot application, the API information will be published to Parliament Server automatically. 80 | 81 | ### Visit API information 82 | 83 | Open http://{_Parliament Server address_}/index.html, you will see a list of all your microservices, then you can see more details if click on them. 84 | 85 | License 86 | -------------------- 87 | 88 | Copyright 2017 Han Zhong - [@burnettzhong](https://github.com/burnettzhong) 89 | 90 | Licensed under the Apache License, Version 2.0 (the "License"); 91 | you may not use this file except in compliance with the License. 92 | You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) 93 | 94 | -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/Tag.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain; 2 | 3 | import com.fasterxml.jackson.annotation.JsonAnyGetter; 4 | import com.fasterxml.jackson.annotation.JsonAnySetter; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | public class Tag { 10 | private final Map vendorExtensions = new HashMap(); 11 | private String name; 12 | private String description; 13 | private ExternalDocs externalDocs; 14 | 15 | public Tag name(String name) { 16 | setName(name); 17 | return this; 18 | } 19 | 20 | public Tag description(String description) { 21 | setDescription(description); 22 | return this; 23 | } 24 | 25 | public Tag externalDocs(ExternalDocs externalDocs) { 26 | setExternalDocs(externalDocs); 27 | return this; 28 | } 29 | 30 | public String getName() { 31 | return name; 32 | } 33 | 34 | public void setName(String name) { 35 | this.name = name; 36 | } 37 | 38 | public String getDescription() { 39 | return description; 40 | } 41 | 42 | public void setDescription(String description) { 43 | this.description = description; 44 | } 45 | 46 | public ExternalDocs getExternalDocs() { 47 | return externalDocs; 48 | } 49 | 50 | public void setExternalDocs(ExternalDocs externalDocs) { 51 | this.externalDocs = externalDocs; 52 | } 53 | 54 | @JsonAnyGetter 55 | public Map getVendorExtensions() { 56 | return vendorExtensions; 57 | } 58 | 59 | @JsonAnySetter 60 | public void setVendorExtension(String name, Object value) { 61 | if (name.startsWith("x-")) { 62 | vendorExtensions.put(name, value); 63 | } 64 | } 65 | 66 | @Override 67 | public String toString() { 68 | StringBuilder b = new StringBuilder(); 69 | b.append("Tag {\n"); 70 | b.append("\tname: ").append(getName()).append("\n"); 71 | b.append("\tdescription: ").append(getDescription()).append("\n"); 72 | b.append("\texternalDocs: ").append(getExternalDocs()).append("\n"); 73 | b.append("\textensions:").append(vendorExtensions.toString()); 74 | b.append("}"); 75 | return b.toString(); 76 | } 77 | 78 | @Override 79 | public int hashCode() { 80 | final int prime = 31; 81 | int result = 1; 82 | result = prime * result 83 | + ((description == null) ? 0 : description.hashCode()); 84 | result = prime * result 85 | + ((externalDocs == null) ? 0 : externalDocs.hashCode()); 86 | result = prime * result + ((name == null) ? 0 : name.hashCode()); 87 | return result; 88 | } 89 | 90 | @Override 91 | public boolean equals(Object obj) { 92 | if (this == obj) { 93 | return true; 94 | } 95 | if (obj == null) { 96 | return false; 97 | } 98 | if (getClass() != obj.getClass()) { 99 | return false; 100 | } 101 | Tag other = (Tag) obj; 102 | if (description == null) { 103 | if (other.description != null) { 104 | return false; 105 | } 106 | } else if (!description.equals(other.description)) { 107 | return false; 108 | } 109 | if (externalDocs == null) { 110 | if (other.externalDocs != null) { 111 | return false; 112 | } 113 | } else if (!externalDocs.equals(other.externalDocs)) { 114 | return false; 115 | } 116 | if (name == null) { 117 | if (other.name != null) { 118 | return false; 119 | } 120 | } else if (!name.equals(other.name)) { 121 | return false; 122 | } 123 | return true; 124 | } 125 | } -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/Xml.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain; 2 | 3 | public class Xml { 4 | /* 5 | "name": { "type": "string"}, 6 | "namespace": { "type": "string" }, 7 | "prefix": { "type": "string" }, 8 | "attribute": { "type": "boolean" }, 9 | "wrapped": { "type": "boolean" } 10 | */ 11 | private String name; 12 | private String namespace; 13 | private String prefix; 14 | private Boolean attribute; 15 | private Boolean wrapped; 16 | 17 | public Xml name(String name) { 18 | this.setName(name); 19 | return this; 20 | } 21 | 22 | public Xml namespace(String namespace) { 23 | this.setNamespace(namespace); 24 | return this; 25 | } 26 | 27 | public Xml prefix(String prefix) { 28 | this.setPrefix(prefix); 29 | return this; 30 | } 31 | 32 | public Xml attribute(Boolean attribute) { 33 | this.setAttribute(attribute); 34 | return this; 35 | } 36 | 37 | public Xml wrapped(Boolean wrapped) { 38 | this.setWrapped(wrapped); 39 | return this; 40 | } 41 | 42 | public String getName() { 43 | return this.name; 44 | } 45 | 46 | public void setName(String name) { 47 | this.name = name; 48 | } 49 | 50 | public String getNamespace() { 51 | return this.namespace; 52 | } 53 | 54 | public void setNamespace(String namespace) { 55 | this.namespace = namespace; 56 | } 57 | 58 | public String getPrefix() { 59 | return this.prefix; 60 | } 61 | 62 | public void setPrefix(String prefix) { 63 | this.prefix = prefix; 64 | } 65 | 66 | public Boolean getAttribute() { 67 | return this.attribute; 68 | } 69 | 70 | public void setAttribute(Boolean attribute) { 71 | this.attribute = attribute; 72 | } 73 | 74 | public Boolean getWrapped() { 75 | return this.wrapped; 76 | } 77 | 78 | public void setWrapped(Boolean wrapped) { 79 | this.wrapped = wrapped; 80 | } 81 | 82 | @Override 83 | public int hashCode() { 84 | final int prime = 31; 85 | int result = 1; 86 | result = prime * result + ((attribute == null) ? 0 : attribute.hashCode()); 87 | result = prime * result + ((name == null) ? 0 : name.hashCode()); 88 | result = prime * result + ((namespace == null) ? 0 : namespace.hashCode()); 89 | result = prime * result + ((prefix == null) ? 0 : prefix.hashCode()); 90 | result = prime * result + ((wrapped == null) ? 0 : wrapped.hashCode()); 91 | return result; 92 | } 93 | 94 | @Override 95 | public boolean equals(Object obj) { 96 | if (this == obj) { 97 | return true; 98 | } 99 | if (obj == null) { 100 | return false; 101 | } 102 | if (getClass() != obj.getClass()) { 103 | return false; 104 | } 105 | Xml other = (Xml) obj; 106 | if (attribute == null) { 107 | if (other.attribute != null) { 108 | return false; 109 | } 110 | } else if (!attribute.equals(other.attribute)) { 111 | return false; 112 | } 113 | if (name == null) { 114 | if (other.name != null) { 115 | return false; 116 | } 117 | } else if (!name.equals(other.name)) { 118 | return false; 119 | } 120 | if (namespace == null) { 121 | if (other.namespace != null) { 122 | return false; 123 | } 124 | } else if (!namespace.equals(other.namespace)) { 125 | return false; 126 | } 127 | if (prefix == null) { 128 | if (other.prefix != null) { 129 | return false; 130 | } 131 | } else if (!prefix.equals(other.prefix)) { 132 | return false; 133 | } 134 | if (wrapped == null) { 135 | if (other.wrapped != null) { 136 | return false; 137 | } 138 | } else if (!wrapped.equals(other.wrapped)) { 139 | return false; 140 | } 141 | return true; 142 | } 143 | } -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/ArrayModel.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain; 2 | 3 | 4 | import java.util.Map; 5 | 6 | public class ArrayModel extends AbstractModel { 7 | private Map properties; 8 | private String type; 9 | private String description; 10 | private Object items; 11 | private Object example; 12 | 13 | public ArrayModel() { 14 | this.type = "array"; 15 | } 16 | 17 | public ArrayModel description(String description) { 18 | this.setDescription(description); 19 | return this; 20 | } 21 | 22 | public ArrayModel items(Object items) { 23 | this.setItems(items); 24 | return this; 25 | } 26 | 27 | public String getType() { 28 | return type; 29 | } 30 | 31 | public void setType(String type) { 32 | this.type = type; 33 | } 34 | 35 | public String getDescription() { 36 | return description; 37 | } 38 | 39 | public void setDescription(String description) { 40 | this.description = description; 41 | } 42 | 43 | public Object getItems() { 44 | return items; 45 | } 46 | 47 | public void setItems(Object items) { 48 | this.items = items; 49 | } 50 | 51 | public Map getProperties() { 52 | return properties; 53 | } 54 | 55 | public void setProperties(Map properties) { 56 | this.properties = properties; 57 | } 58 | 59 | public Object getExample() { 60 | return example; 61 | } 62 | 63 | public void setExample(Object example) { 64 | this.example = example; 65 | } 66 | 67 | public Object clone() { 68 | ArrayModel cloned = new ArrayModel(); 69 | super.cloneTo(cloned); 70 | 71 | cloned.properties = this.properties; 72 | cloned.type = this.type; 73 | cloned.description = this.description; 74 | cloned.items = this.items; 75 | cloned.example = this.example; 76 | 77 | return cloned; 78 | } 79 | 80 | @Override 81 | public int hashCode() { 82 | final int prime = 31; 83 | int result = super.hashCode(); 84 | result = prime * result 85 | + ((description == null) ? 0 : description.hashCode()); 86 | result = prime * result + ((example == null) ? 0 : example.hashCode()); 87 | result = prime * result + ((items == null) ? 0 : items.hashCode()); 88 | result = prime * result 89 | + ((properties == null) ? 0 : properties.hashCode()); 90 | result = prime * result + ((type == null) ? 0 : type.hashCode()); 91 | return result; 92 | } 93 | 94 | @Override 95 | public boolean equals(Object obj) { 96 | if (this == obj) { 97 | return true; 98 | } 99 | if (!super.equals(obj)) { 100 | return false; 101 | } 102 | if (getClass() != obj.getClass()) { 103 | return false; 104 | } 105 | ArrayModel other = (ArrayModel) obj; 106 | if (description == null) { 107 | if (other.description != null) { 108 | return false; 109 | } 110 | } else if (!description.equals(other.description)) { 111 | return false; 112 | } 113 | if (example == null) { 114 | if (other.example != null) { 115 | return false; 116 | } 117 | } else if (!example.equals(other.example)) { 118 | return false; 119 | } 120 | if (items == null) { 121 | if (other.items != null) { 122 | return false; 123 | } 124 | } else if (!items.equals(other.items)) { 125 | return false; 126 | } 127 | if (properties == null) { 128 | if (other.properties != null) { 129 | return false; 130 | } 131 | } else if (!properties.equals(other.properties)) { 132 | return false; 133 | } 134 | if (type == null) { 135 | if (other.type != null) { 136 | return false; 137 | } 138 | } else if (!type.equals(other.type)) { 139 | return false; 140 | } 141 | return true; 142 | } 143 | } -------------------------------------------------------------------------------- /src/main/resources/static/swagger/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Swagger UI 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 93 | 94 | 95 | 96 | 101 | 102 |
 
103 |
104 | 105 | 106 | -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/SecurityRequirement.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain; 2 | 3 | import com.fasterxml.jackson.annotation.JsonAnyGetter; 4 | import com.fasterxml.jackson.annotation.JsonAnySetter; 5 | import com.fasterxml.jackson.annotation.JsonIgnore; 6 | 7 | import java.util.ArrayList; 8 | import java.util.HashMap; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | public class SecurityRequirement { 13 | private String name; 14 | private List scopes; 15 | // private final Map vendorExtensions = new HashMap(); 16 | private Map> requirements = new HashMap>(); 17 | 18 | public SecurityRequirement() { 19 | } 20 | 21 | @Deprecated 22 | public SecurityRequirement(String name) { 23 | setName(name); 24 | } 25 | 26 | public SecurityRequirement scope(String scope) { 27 | this.addScope(scope); 28 | return this; 29 | } 30 | 31 | public SecurityRequirement requirement(String name, List scopes) { 32 | if(requirements == null) { 33 | requirements = new HashMap>(); 34 | } 35 | 36 | if(scopes == null) { 37 | scopes = new ArrayList(); 38 | } 39 | 40 | requirements.put(name, scopes); 41 | return this; 42 | } 43 | 44 | public SecurityRequirement requirement(String name) { 45 | return requirement(name, null); 46 | } 47 | 48 | @JsonIgnore 49 | @Deprecated 50 | public String getName() { 51 | return name; 52 | } 53 | 54 | @Deprecated 55 | public void setName(String name) { 56 | this.name = name; 57 | } 58 | 59 | @Deprecated 60 | public List getScopes() { 61 | return scopes; 62 | } 63 | 64 | @Deprecated 65 | public void setScopes(List scopes) { 66 | this.scopes = scopes; 67 | } 68 | 69 | public void addScope(String scope) { 70 | if (scopes == null) { 71 | scopes = new ArrayList(); 72 | } 73 | scopes.add(scope); 74 | } 75 | 76 | 77 | 78 | // @JsonAnyGetter 79 | // public Map getVendorExtensions() { 80 | // return vendorExtensions; 81 | // } 82 | // 83 | // @JsonAnySetter 84 | // public void setVendorExtension(String name, Object value) { 85 | // if (name.startsWith("x-")) { 86 | // vendorExtensions.put(name, value); 87 | // } 88 | // } 89 | 90 | @JsonAnyGetter 91 | public Map> getRequirements() { 92 | return requirements; 93 | } 94 | 95 | @JsonAnySetter 96 | public void setRequirements(String name, List scopes) { 97 | requirements.put(name, scopes); 98 | } 99 | 100 | @Override 101 | public int hashCode() { 102 | final int prime = 31; 103 | int result = 1; 104 | result = prime * result + ((name == null) ? 0 : name.hashCode()); 105 | result = prime * result + ((scopes == null) ? 0 : scopes.hashCode()); 106 | // result = prime * result 107 | // + ((vendorExtensions == null) ? 0 : vendorExtensions.hashCode()); 108 | result = prime * result 109 | + ((requirements == null) ? 0 : requirements.hashCode()); 110 | return result; 111 | } 112 | 113 | @Override 114 | public boolean equals(Object obj) { 115 | if (this == obj) { 116 | return true; 117 | } 118 | if (obj == null) { 119 | return false; 120 | } 121 | if (getClass() != obj.getClass()) { 122 | return false; 123 | } 124 | SecurityRequirement other = (SecurityRequirement) obj; 125 | if (name == null) { 126 | if (other.name != null) { 127 | return false; 128 | } 129 | } else if (!name.equals(other.name)) { 130 | return false; 131 | } 132 | if (scopes == null) { 133 | if (other.scopes != null) { 134 | return false; 135 | } 136 | } else if (!scopes.equals(other.scopes)) { 137 | return false; 138 | } 139 | // if (vendorExtensions == null) { 140 | // if (other.vendorExtensions != null) { 141 | // return false; 142 | // } 143 | // } else if (!vendorExtensions.equals(other.vendorExtensions)) { 144 | // return false; 145 | // } 146 | if (requirements == null) { 147 | if (other.requirements != null) { 148 | return false; 149 | } 150 | } else if (!requirements.equals(other.requirements)) { 151 | return false; 152 | } 153 | return true; 154 | } 155 | } -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/auth/OAuth2Definition.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain.auth; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public class OAuth2Definition extends AbstractSecuritySchemeDefinition { 7 | private String type = "oauth2"; 8 | private String authorizationUrl; 9 | private String tokenUrl; 10 | private String flow; 11 | private Map scopes; 12 | 13 | public OAuth2Definition() { 14 | } 15 | 16 | public OAuth2Definition implicit(String authorizationUrl) { 17 | this.setAuthorizationUrl(authorizationUrl); 18 | this.setFlow("implicit"); 19 | return this; 20 | } 21 | 22 | public OAuth2Definition password(String tokenUrl) { 23 | this.setTokenUrl(tokenUrl); 24 | this.setFlow("password"); 25 | return this; 26 | } 27 | 28 | public OAuth2Definition application(String tokenUrl) { 29 | this.setTokenUrl(tokenUrl); 30 | this.setFlow("application"); 31 | return this; 32 | } 33 | 34 | public OAuth2Definition accessCode(String authorizationUrl, String tokenUrl) { 35 | this.setTokenUrl(tokenUrl); 36 | this.setAuthorizationUrl(authorizationUrl); 37 | this.setFlow("accessCode"); 38 | return this; 39 | } 40 | 41 | public OAuth2Definition scope(String name, String description) { 42 | this.addScope(name, description); 43 | return this; 44 | } 45 | 46 | public String getAuthorizationUrl() { 47 | return authorizationUrl; 48 | } 49 | 50 | public void setAuthorizationUrl(String authorizationUrl) { 51 | this.authorizationUrl = authorizationUrl; 52 | } 53 | 54 | public String getTokenUrl() { 55 | return tokenUrl; 56 | } 57 | 58 | public void setTokenUrl(String tokenUrl) { 59 | this.tokenUrl = tokenUrl; 60 | } 61 | 62 | public String getFlow() { 63 | return flow; 64 | } 65 | 66 | public void setFlow(String flow) { 67 | this.flow = flow; 68 | } 69 | 70 | public Map getScopes() { 71 | return scopes; 72 | } 73 | 74 | public void setScopes(Map scopes) { 75 | this.scopes = scopes; 76 | } 77 | 78 | public void addScope(String name, String description) { 79 | if (this.scopes == null) { 80 | this.scopes = new HashMap(); 81 | } 82 | this.scopes.put(name, description); 83 | } 84 | 85 | public String getType() { 86 | return type; 87 | } 88 | 89 | public void setType(String type) { 90 | this.type = type; 91 | } 92 | 93 | @Override 94 | public int hashCode() { 95 | final int prime = 31; 96 | int result = super.hashCode(); 97 | result = prime * result 98 | + ((authorizationUrl == null) ? 0 : authorizationUrl.hashCode()); 99 | result = prime * result + ((flow == null) ? 0 : flow.hashCode()); 100 | result = prime * result + ((scopes == null) ? 0 : scopes.hashCode()); 101 | result = prime * result + ((tokenUrl == null) ? 0 : tokenUrl.hashCode()); 102 | result = prime * result + ((type == null) ? 0 : type.hashCode()); 103 | return result; 104 | } 105 | 106 | @Override 107 | public boolean equals(Object obj) { 108 | if (this == obj) { 109 | return true; 110 | } 111 | if (obj == null) { 112 | return false; 113 | } 114 | if (!super.equals(obj)) { 115 | return false; 116 | } 117 | if (getClass() != obj.getClass()) { 118 | return false; 119 | } 120 | OAuth2Definition other = (OAuth2Definition) obj; 121 | if (authorizationUrl == null) { 122 | if (other.authorizationUrl != null) { 123 | return false; 124 | } 125 | } else if (!authorizationUrl.equals(other.authorizationUrl)) { 126 | return false; 127 | } 128 | if (flow == null) { 129 | if (other.flow != null) { 130 | return false; 131 | } 132 | } else if (!flow.equals(other.flow)) { 133 | return false; 134 | } 135 | if (scopes == null) { 136 | if (other.scopes != null) { 137 | return false; 138 | } 139 | } else if (!scopes.equals(other.scopes)) { 140 | return false; 141 | } 142 | if (tokenUrl == null) { 143 | if (other.tokenUrl != null) { 144 | return false; 145 | } 146 | } else if (!tokenUrl.equals(other.tokenUrl)) { 147 | return false; 148 | } 149 | if (type == null) { 150 | if (other.type != null) { 151 | return false; 152 | } 153 | } else if (!type.equals(other.type)) { 154 | return false; 155 | } 156 | return true; 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/Response.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain; 2 | 3 | import com.fasterxml.jackson.annotation.JsonAnyGetter; 4 | import com.fasterxml.jackson.annotation.JsonAnySetter; 5 | 6 | import java.util.HashMap; 7 | import java.util.LinkedHashMap; 8 | import java.util.Map; 9 | 10 | public class Response { 11 | private String description; 12 | private Object schema; 13 | private Map examples; 14 | private Map headers; 15 | private final Map vendorExtensions = new HashMap(); 16 | 17 | public Response schema(Object property) { 18 | this.setSchema(property); 19 | return this; 20 | } 21 | 22 | public Response description(String description) { 23 | this.setDescription(description); 24 | return this; 25 | } 26 | 27 | public Response example(String type, Object example) { 28 | if (examples == null) { 29 | examples = new HashMap(); 30 | } 31 | examples.put(type, example); 32 | return this; 33 | } 34 | 35 | public Response header(String name, Object property) { 36 | addHeader(name, property); 37 | return this; 38 | } 39 | 40 | public Response headers(Map headers) { 41 | this.headers = headers; 42 | return this; 43 | } 44 | 45 | public Response vendorExtension(String key, Object obj) { 46 | this.setVendorExtension(key, obj); 47 | return this; 48 | } 49 | 50 | public String getDescription() { 51 | return description; 52 | } 53 | 54 | public void setDescription(String description) { 55 | this.description = description; 56 | } 57 | 58 | public Object getSchema() { 59 | return schema; 60 | } 61 | 62 | public void setSchema(Object schema) { 63 | this.schema = schema; 64 | } 65 | 66 | public Map getExamples() { 67 | return this.examples; 68 | } 69 | 70 | public void setExamples(Map examples) { 71 | this.examples = examples; 72 | } 73 | 74 | public Map getHeaders() { 75 | return headers; 76 | } 77 | 78 | public void setHeaders(Map headers) { 79 | this.headers = headers; 80 | } 81 | 82 | public void addHeader(String key, Object property) { 83 | if (this.headers == null) { 84 | this.headers = new LinkedHashMap(); 85 | } 86 | this.headers.put(key, property); 87 | } 88 | 89 | @JsonAnyGetter 90 | public Map getVendorExtensions() { 91 | return vendorExtensions; 92 | } 93 | 94 | @JsonAnySetter 95 | public void setVendorExtension(String name, Object value) { 96 | if (name.startsWith("x-")) { 97 | vendorExtensions.put(name, value); 98 | } 99 | } 100 | 101 | @Override 102 | public int hashCode() { 103 | final int prime = 31; 104 | int result = 1; 105 | result = prime * result 106 | + ((description == null) ? 0 : description.hashCode()); 107 | result = prime * result + ((examples == null) ? 0 : examples.hashCode()); 108 | result = prime * result + ((headers == null) ? 0 : headers.hashCode()); 109 | result = prime * result + ((schema == null) ? 0 : schema.hashCode()); 110 | result = prime * result 111 | + ((vendorExtensions == null) ? 0 : vendorExtensions.hashCode()); 112 | return result; 113 | } 114 | 115 | @Override 116 | public boolean equals(Object obj) { 117 | if (this == obj) { 118 | return true; 119 | } 120 | if (obj == null) { 121 | return false; 122 | } 123 | if (getClass() != obj.getClass()) { 124 | return false; 125 | } 126 | Response other = (Response) obj; 127 | if (description == null) { 128 | if (other.description != null) { 129 | return false; 130 | } 131 | } else if (!description.equals(other.description)) { 132 | return false; 133 | } 134 | if (examples == null) { 135 | if (other.examples != null) { 136 | return false; 137 | } 138 | } else if (!examples.equals(other.examples)) { 139 | return false; 140 | } 141 | if (headers == null) { 142 | if (other.headers != null) { 143 | return false; 144 | } 145 | } else if (!headers.equals(other.headers)) { 146 | return false; 147 | } 148 | if (schema == null) { 149 | if (other.schema != null) { 150 | return false; 151 | } 152 | } else if (!schema.equals(other.schema)) { 153 | return false; 154 | } 155 | if (vendorExtensions == null) { 156 | if (other.vendorExtensions != null) { 157 | return false; 158 | } 159 | } else if (!vendorExtensions.equals(other.vendorExtensions)) { 160 | return false; 161 | } 162 | return true; 163 | } 164 | } -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/RefModel.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | import com.burnetzhong.domain.refs.GenericRef; 5 | import com.burnetzhong.domain.refs.RefFormat; 6 | import com.burnetzhong.domain.refs.RefType; 7 | 8 | import java.util.Map; 9 | 10 | public class RefModel implements Model { 11 | private GenericRef genericRef; 12 | private String description; 13 | private ExternalDocs externalDocs; 14 | private Map properties; 15 | private Object example; 16 | private String title; 17 | 18 | public RefModel() { 19 | } 20 | 21 | public RefModel(String ref) { 22 | set$ref(ref); 23 | } 24 | 25 | public RefModel asDefault(String ref) { 26 | this.set$ref(RefType.DEFINITION.getInternalPrefix() + ref); 27 | return this; 28 | } 29 | 30 | // not allowed in a $ref 31 | @JsonIgnore 32 | @Override 33 | public String getTitle() { 34 | return title; 35 | } 36 | 37 | @Override 38 | public void setTitle(String title) { 39 | this.title = title; 40 | } 41 | 42 | // not allowed in a $ref 43 | @JsonIgnore 44 | public String getDescription() { 45 | return description; 46 | } 47 | 48 | public void setDescription(String description) { 49 | this.description = description; 50 | } 51 | 52 | @JsonIgnore 53 | public Map getProperties() { 54 | return properties; 55 | } 56 | 57 | public void setProperties(Map properties) { 58 | this.properties = properties; 59 | } 60 | 61 | @JsonIgnore 62 | public String getSimpleRef() { 63 | return genericRef.getSimpleRef(); 64 | } 65 | 66 | public String get$ref() { 67 | return genericRef.getRef(); 68 | } 69 | 70 | public void set$ref(String ref) { 71 | this.genericRef = new GenericRef(RefType.DEFINITION, ref); 72 | } 73 | 74 | @JsonIgnore 75 | public RefFormat getRefFormat() { 76 | return this.genericRef.getFormat(); 77 | } 78 | 79 | @JsonIgnore 80 | public Object getExample() { 81 | return example; 82 | } 83 | 84 | public void setExample(Object example) { 85 | this.example = example; 86 | } 87 | 88 | @JsonIgnore 89 | public ExternalDocs getExternalDocs() { 90 | return externalDocs; 91 | } 92 | 93 | public void setExternalDocs(ExternalDocs value) { 94 | externalDocs = value; 95 | } 96 | 97 | public Object clone() { 98 | RefModel cloned = new RefModel(); 99 | cloned.genericRef = this.genericRef; //GenericRef is an immutable class 100 | cloned.description = this.description; 101 | cloned.properties = this.properties; 102 | cloned.example = this.example; 103 | 104 | return cloned; 105 | } 106 | 107 | @Override 108 | @JsonIgnore 109 | public Map getVendorExtensions() { 110 | return null; 111 | } 112 | 113 | @Override 114 | public int hashCode() { 115 | final int prime = 31; 116 | int result = 1; 117 | result = prime * result 118 | + ((description == null) ? 0 : description.hashCode()); 119 | result = prime * result + ((example == null) ? 0 : example.hashCode()); 120 | result = prime * result 121 | + ((externalDocs == null) ? 0 : externalDocs.hashCode()); 122 | result = prime * result 123 | + ((properties == null) ? 0 : properties.hashCode()); 124 | result = prime * result + ((genericRef == null) ? 0 : genericRef.hashCode()); 125 | return result; 126 | } 127 | 128 | @Override 129 | public boolean equals(Object obj) { 130 | if (this == obj) { 131 | return true; 132 | } 133 | if (obj == null) { 134 | return false; 135 | } 136 | if (getClass() != obj.getClass()) { 137 | return false; 138 | } 139 | RefModel other = (RefModel) obj; 140 | if (description == null) { 141 | if (other.description != null) { 142 | return false; 143 | } 144 | } else if (!description.equals(other.description)) { 145 | return false; 146 | } 147 | if (example == null) { 148 | if (other.example != null) { 149 | return false; 150 | } 151 | } else if (!example.equals(other.example)) { 152 | return false; 153 | } 154 | if (externalDocs == null) { 155 | if (other.externalDocs != null) { 156 | return false; 157 | } 158 | } else if (!externalDocs.equals(other.externalDocs)) { 159 | return false; 160 | } 161 | if (properties == null) { 162 | if (other.properties != null) { 163 | return false; 164 | } 165 | } else if (!properties.equals(other.properties)) { 166 | return false; 167 | } 168 | if (genericRef == null) { 169 | if (other.genericRef != null) { 170 | return false; 171 | } 172 | } else if (!genericRef.equals(other.genericRef)) { 173 | return false; 174 | } 175 | return true; 176 | } 177 | 178 | @Override 179 | @JsonIgnore 180 | public String getReference() { 181 | return genericRef.getRef(); 182 | } 183 | 184 | @Override 185 | public void setReference(String reference) { 186 | this.genericRef = new GenericRef(RefType.DEFINITION, reference); 187 | } 188 | } -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/ComposedModel.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public class ComposedModel extends AbstractModel { 10 | private List allOf = new ArrayList(); 11 | private Model parent; 12 | private Model child; 13 | private List interfaces; 14 | private String description; 15 | private Object example; 16 | 17 | public ComposedModel parent(Model model) { 18 | this.setParent(model); 19 | return this; 20 | } 21 | 22 | public ComposedModel child(Model model) { 23 | this.setChild(model); 24 | return this; 25 | } 26 | 27 | public ComposedModel interfaces(List interfaces) { 28 | this.setInterfaces(interfaces); 29 | return this; 30 | } 31 | 32 | public String getDescription() { 33 | return description; 34 | } 35 | 36 | public void setDescription(String description) { 37 | this.description = description; 38 | } 39 | 40 | public Map getProperties() { 41 | return null; 42 | } 43 | 44 | public void setProperties(Map properties) { 45 | 46 | } 47 | 48 | public Object getExample() { 49 | return example; 50 | } 51 | 52 | public void setExample(Object example) { 53 | this.example = example; 54 | } 55 | 56 | public List getAllOf() { 57 | return allOf; 58 | } 59 | 60 | public void setAllOf(List allOf) { 61 | this.allOf = allOf; 62 | } 63 | 64 | public Model getParent() { 65 | return parent; 66 | } 67 | 68 | @JsonIgnore 69 | public void setParent(Model model) { 70 | this.parent = model; 71 | if (!allOf.contains(model)) { 72 | this.allOf.add(model); 73 | } 74 | } 75 | 76 | public Model getChild() { 77 | return child; 78 | } 79 | 80 | @JsonIgnore 81 | public void setChild(Model model) { 82 | this.child = model; 83 | if (!allOf.contains(model)) { 84 | this.allOf.add(model); 85 | } 86 | } 87 | 88 | public List getInterfaces() { 89 | return interfaces; 90 | } 91 | 92 | @JsonIgnore 93 | public void setInterfaces(List interfaces) { 94 | this.interfaces = interfaces; 95 | for (RefModel model : interfaces) { 96 | if (!allOf.contains(model)) { 97 | allOf.add(model); 98 | } 99 | } 100 | } 101 | 102 | public Object clone() { 103 | ComposedModel cloned = new ComposedModel(); 104 | super.cloneTo(cloned); 105 | cloned.allOf = this.allOf; 106 | cloned.parent = this.parent; 107 | cloned.child = this.child; 108 | cloned.interfaces = this.interfaces; 109 | cloned.description = this.description; 110 | cloned.example = this.example; 111 | 112 | return cloned; 113 | } 114 | 115 | @Override 116 | public int hashCode() { 117 | final int prime = 31; 118 | int result = super.hashCode(); 119 | result = prime * result + ((allOf == null) ? 0 : allOf.hashCode()); 120 | result = prime * result + ((child == null) ? 0 : child.hashCode()); 121 | result = prime * result 122 | + ((description == null) ? 0 : description.hashCode()); 123 | result = prime * result + ((example == null) ? 0 : example.hashCode()); 124 | result = prime * result 125 | + ((interfaces == null) ? 0 : interfaces.hashCode()); 126 | result = prime * result + ((parent == null) ? 0 : parent.hashCode()); 127 | return result; 128 | } 129 | 130 | @Override 131 | public boolean equals(Object obj) { 132 | if (this == obj) { 133 | return true; 134 | } 135 | if (!super.equals(obj)) { 136 | return false; 137 | } 138 | if (getClass() != obj.getClass()) { 139 | return false; 140 | } 141 | ComposedModel other = (ComposedModel) obj; 142 | if (allOf == null) { 143 | if (other.allOf != null) { 144 | return false; 145 | } 146 | } else if (!allOf.equals(other.allOf)) { 147 | return false; 148 | } 149 | if (child == null) { 150 | if (other.child != null) { 151 | return false; 152 | } 153 | } else if (!child.equals(other.child)) { 154 | return false; 155 | } 156 | if (description == null) { 157 | if (other.description != null) { 158 | return false; 159 | } 160 | } else if (!description.equals(other.description)) { 161 | return false; 162 | } 163 | if (example == null) { 164 | if (other.example != null) { 165 | return false; 166 | } 167 | } else if (!example.equals(other.example)) { 168 | return false; 169 | } 170 | if (interfaces == null) { 171 | if (other.interfaces != null) { 172 | return false; 173 | } 174 | } else if (!interfaces.equals(other.interfaces)) { 175 | return false; 176 | } 177 | if (parent == null) { 178 | if (other.parent != null) { 179 | return false; 180 | } 181 | } else if (!parent.equals(other.parent)) { 182 | return false; 183 | } 184 | return true; 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /src/main/resources/static/swagger/lib/swagger-oauth.js: -------------------------------------------------------------------------------- 1 | function handleLogin(){var e=[],o=window.swaggerUiAuth.authSchemes||window.swaggerUiAuth.securityDefinitions;if(o){var i,n=o;for(i in n){var a=n[i];if("oauth2"===a.type&&a.scopes){var t;if(Array.isArray(a.scopes)){var p;for(p=0;p','
Select OAuth2.0 Scopes
','
',"

Scopes are used to grant an application different levels of access to data on behalf of the end user. Each API may declare one or more scopes.",'Learn how to use',"

","

"+appName+" API requires the following scopes. Select which ones you want to grant to Swagger UI.

",'
    ',"
",'

','
',"
",""].join("")),$(document.body).append(popupDialog),popup=popupDialog.find("ul.api-popup-scopes").empty(),p=0;p",popup.append(str);var r=$(window),s=r.width(),c=r.height(),l=r.scrollTop(),d=popupDialog.outerWidth(),u=popupDialog.outerHeight(),h=(c-u)/2+l,g=(s-d)/2;popupDialog.css({top:(h<0?0:h)+"px",left:(g<0?0:g)+"px"}),popupDialog.find("button.api-popup-cancel").click(function(){popupMask.hide(),popupDialog.hide(),popupDialog.empty(),popupDialog=[]}),$("button.api-popup-authbtn").unbind(),popupDialog.find("button.api-popup-authbtn").click(function(){function e(e){return e.vendorExtensions["x-tokenName"]||e.tokenName}popupMask.hide(),popupDialog.hide();var o,i=window.swaggerUi.api.authSchemes,n=window.location,a=location.pathname.substring(0,location.pathname.lastIndexOf("/")),t=n.protocol+"//"+n.host+a+"/o2c.html",p=window.oAuthRedirectUrl||t,r=null,s=[],c=popup.find("input:checked"),l=[];for(k=0;k0?void log("auth unable initialize oauth: "+i):($("pre code").each(function(e,o){hljs.highlightBlock(o)}),$(".api-ic").unbind(),void $(".api-ic").click(function(e){$(e.target).hasClass("ic-off")?handleLogin():handleLogout()}))}function clientCredentialsFlow(e,o,i){var n={client_id:clientId,client_secret:clientSecret,scope:e.join(" "),grant_type:"client_credentials"};$.ajax({url:o,type:"POST",data:n,success:function(e,o,n){onOAuthComplete(e,i)},error:function(e,o,i){onOAuthComplete("")}})}var appName,popupMask,popupDialog,clientId,realm,redirect_uri,clientSecret,scopeSeparator,additionalQueryStringParams;window.processOAuthCode=function(e){var o=e.state,i=window.location,n=location.pathname.substring(0,location.pathname.lastIndexOf("/")),a=i.protocol+"//"+i.host+n+"/o2c.html",t=window.oAuthRedirectUrl||a,p={client_id:clientId,code:e.code,grant_type:"authorization_code",redirect_uri:t};clientSecret&&(p.client_secret=clientSecret),$.ajax({url:window.swaggerUiAuth.tokenUrl,type:"POST",data:p,success:function(e,i,n){onOAuthComplete(e,o)},error:function(e,o,i){onOAuthComplete("")}})},window.onOAuthComplete=function(e,o){if(e)if(e.error){var i=$("input[type=checkbox],.secured");i.each(function(e){i[e].checked=!1}),alert(e.error)}else{var n=e[window.swaggerUiAuth.tokenName];if(o||(o=e.state),n){var a=null;$.each($(".auth .api-ic .api_information_panel"),function(e,o){var i=o;if(i&&i.childNodes){var n=[];$.each(i.childNodes,function(e,o){var i=o.innerHTML;i&&n.push(i)});for(var t=[],p=0;p0?(a=o.parentNode.parentNode,$(a.parentNode).find(".api-ic.ic-on").addClass("ic-off"),$(a.parentNode).find(".api-ic.ic-on").removeClass("ic-on"),$(a).find(".api-ic").addClass("ic-warning"),$(a).find(".api-ic").removeClass("ic-error")):(a=o.parentNode.parentNode,$(a.parentNode).find(".api-ic.ic-off").addClass("ic-on"),$(a.parentNode).find(".api-ic.ic-off").removeClass("ic-off"),$(a).find(".api-ic").addClass("ic-info"),$(a).find(".api-ic").removeClass("ic-warning"),$(a).find(".api-ic").removeClass("ic-error"))}}),"undefined"!=typeof window.swaggerUi&&(window.swaggerUi.api.clientAuthorizations.add(window.swaggerUiAuth.OAuthSchemeKey,new SwaggerClient.ApiKeyAuthorization("Authorization","Bearer "+n,"header")),window.swaggerUi.load())}}}; -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/Info.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain; 2 | 3 | import com.fasterxml.jackson.annotation.JsonAnyGetter; 4 | import com.fasterxml.jackson.annotation.JsonAnySetter; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | public class Info { 10 | private String description; 11 | private String version; 12 | private String title; 13 | private String termsOfService; 14 | private Contact contact; 15 | private License license; 16 | private Map vendorExtensions = new HashMap(); 17 | 18 | public Info version(String version) { 19 | this.setVersion(version); 20 | return this; 21 | } 22 | 23 | public Info title(String title) { 24 | this.setTitle(title); 25 | return this; 26 | } 27 | 28 | public Info description(String description) { 29 | this.setDescription(description); 30 | return this; 31 | } 32 | 33 | public Info termsOfService(String termsOfService) { 34 | this.setTermsOfService(termsOfService); 35 | return this; 36 | } 37 | 38 | public Info contact(Contact contact) { 39 | this.setContact(contact); 40 | return this; 41 | } 42 | 43 | public Info license(License license) { 44 | this.setLicense(license); 45 | return this; 46 | } 47 | 48 | public String getDescription() { 49 | return description; 50 | } 51 | 52 | public void setDescription(String description) { 53 | this.description = description; 54 | } 55 | 56 | public String getVersion() { 57 | return version; 58 | } 59 | 60 | public void setVersion(String version) { 61 | this.version = version; 62 | } 63 | 64 | public String getTitle() { 65 | return title; 66 | } 67 | 68 | public void setTitle(String title) { 69 | this.title = title; 70 | } 71 | 72 | public String getTermsOfService() { 73 | return termsOfService; 74 | } 75 | 76 | public void setTermsOfService(String termsOfService) { 77 | this.termsOfService = termsOfService; 78 | } 79 | 80 | public Contact getContact() { 81 | return contact; 82 | } 83 | 84 | public void setContact(Contact contact) { 85 | this.contact = contact; 86 | } 87 | 88 | public License getLicense() { 89 | return license; 90 | } 91 | 92 | public void setLicense(License license) { 93 | this.license = license; 94 | } 95 | 96 | public Info mergeWith(Info info) { 97 | if (info != null) { 98 | if (this.description == null) { 99 | this.description = info.description; 100 | } 101 | if (this.version == null) { 102 | this.version = info.version; 103 | } 104 | if (this.title == null) { 105 | this.title = info.title; 106 | } 107 | if (this.termsOfService == null) { 108 | this.termsOfService = info.termsOfService; 109 | } 110 | if (this.contact == null) { 111 | this.contact = info.contact; 112 | } 113 | if (this.license == null) { 114 | this.license = info.license; 115 | } 116 | if (this.vendorExtensions == null) { 117 | this.vendorExtensions = info.vendorExtensions; 118 | } 119 | } 120 | return this; 121 | } 122 | 123 | @JsonAnyGetter 124 | public Map getVendorExtensions() { 125 | return vendorExtensions; 126 | } 127 | 128 | @JsonAnySetter 129 | public void setVendorExtension(String name, Object value) { 130 | if (name.startsWith("x-")) { 131 | vendorExtensions.put(name, value); 132 | } 133 | } 134 | 135 | @Override 136 | public int hashCode() { 137 | final int prime = 31; 138 | int result = 1; 139 | result = prime * result + ((contact == null) ? 0 : contact.hashCode()); 140 | result = prime * result 141 | + ((description == null) ? 0 : description.hashCode()); 142 | result = prime * result + ((license == null) ? 0 : license.hashCode()); 143 | result = prime * result 144 | + ((termsOfService == null) ? 0 : termsOfService.hashCode()); 145 | result = prime * result + ((title == null) ? 0 : title.hashCode()); 146 | result = prime * result 147 | + ((vendorExtensions == null) ? 0 : vendorExtensions.hashCode()); 148 | result = prime * result + ((version == null) ? 0 : version.hashCode()); 149 | return result; 150 | } 151 | 152 | @Override 153 | public boolean equals(Object obj) { 154 | if (this == obj) { 155 | return true; 156 | } 157 | if (obj == null) { 158 | return false; 159 | } 160 | if (getClass() != obj.getClass()) { 161 | return false; 162 | } 163 | Info other = (Info) obj; 164 | if (contact == null) { 165 | if (other.contact != null) { 166 | return false; 167 | } 168 | } else if (!contact.equals(other.contact)) { 169 | return false; 170 | } 171 | if (description == null) { 172 | if (other.description != null) { 173 | return false; 174 | } 175 | } else if (!description.equals(other.description)) { 176 | return false; 177 | } 178 | if (license == null) { 179 | if (other.license != null) { 180 | return false; 181 | } 182 | } else if (!license.equals(other.license)) { 183 | return false; 184 | } 185 | if (termsOfService == null) { 186 | if (other.termsOfService != null) { 187 | return false; 188 | } 189 | } else if (!termsOfService.equals(other.termsOfService)) { 190 | return false; 191 | } 192 | if (title == null) { 193 | if (other.title != null) { 194 | return false; 195 | } 196 | } else if (!title.equals(other.title)) { 197 | return false; 198 | } 199 | if (vendorExtensions == null) { 200 | if (other.vendorExtensions != null) { 201 | return false; 202 | } 203 | } else if (!vendorExtensions.equals(other.vendorExtensions)) { 204 | return false; 205 | } 206 | if (version == null) { 207 | if (other.version != null) { 208 | return false; 209 | } 210 | } else if (!version.equals(other.version)) { 211 | return false; 212 | } 213 | return true; 214 | } 215 | } -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/Path.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain; 2 | 3 | import com.fasterxml.jackson.annotation.JsonAnyGetter; 4 | import com.fasterxml.jackson.annotation.JsonAnySetter; 5 | import com.fasterxml.jackson.annotation.JsonIgnore; 6 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 7 | 8 | import java.util.ArrayList; 9 | import java.util.HashMap; 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | @JsonPropertyOrder({"get", "head", "post", "put", "delete", "options", "patch"}) 14 | public class Path { 15 | 16 | private final Map vendorExtensions = new HashMap(); 17 | private Operation get; 18 | private Operation put; 19 | private Operation post; 20 | private Operation head; 21 | private Operation delete; 22 | private Operation patch; 23 | private Operation options; 24 | private List parameters; 25 | 26 | public Path set(String method, Operation op) { 27 | if ("get".equals(method)) { 28 | return get(op); 29 | } 30 | if ("put".equals(method)) { 31 | return put(op); 32 | } 33 | if ("head".equals(method)) { 34 | return head(op); 35 | } 36 | if ("post".equals(method)) { 37 | return post(op); 38 | } 39 | if ("delete".equals(method)) { 40 | return delete(op); 41 | } 42 | if ("patch".equals(method)) { 43 | return patch(op); 44 | } 45 | if ("options".equals(method)) { 46 | return options(op); 47 | } 48 | return null; 49 | } 50 | 51 | public Path get(Operation get) { 52 | this.get = get; 53 | return this; 54 | } 55 | 56 | public Path head(Operation head) { 57 | this.head = head; 58 | return this; 59 | } 60 | 61 | public Path put(Operation put) { 62 | this.put = put; 63 | return this; 64 | } 65 | 66 | public Path post(Operation post) { 67 | this.post = post; 68 | return this; 69 | } 70 | 71 | public Path delete(Operation delete) { 72 | this.delete = delete; 73 | return this; 74 | } 75 | 76 | public Path patch(Operation patch) { 77 | this.patch = patch; 78 | return this; 79 | } 80 | 81 | public Path options(Operation options) { 82 | this.options = options; 83 | return this; 84 | } 85 | 86 | public Operation getGet() { 87 | return get; 88 | } 89 | 90 | public void setGet(Operation get) { 91 | this.get = get; 92 | } 93 | 94 | public Operation getHead() { 95 | return head; 96 | } 97 | 98 | public void setHead(Operation head) { 99 | this.head = head; 100 | } 101 | 102 | public Operation getPut() { 103 | return put; 104 | } 105 | 106 | public void setPut(Operation put) { 107 | this.put = put; 108 | } 109 | 110 | public Operation getPost() { 111 | return post; 112 | } 113 | 114 | public void setPost(Operation post) { 115 | this.post = post; 116 | } 117 | 118 | public Operation getDelete() { 119 | return delete; 120 | } 121 | 122 | public void setDelete(Operation delete) { 123 | this.delete = delete; 124 | } 125 | 126 | public Operation getPatch() { 127 | return patch; 128 | } 129 | 130 | public void setPatch(Operation patch) { 131 | this.patch = patch; 132 | } 133 | 134 | public Operation getOptions() { 135 | return options; 136 | } 137 | 138 | public void setOptions(Operation options) { 139 | this.options = options; 140 | } 141 | 142 | @JsonIgnore 143 | public List getOperations() { 144 | List allOperations = new ArrayList(); 145 | if (get != null) { 146 | allOperations.add(get); 147 | } 148 | if (put != null) { 149 | allOperations.add(put); 150 | } 151 | if (head != null) { 152 | allOperations.add(head); 153 | } 154 | if (post != null) { 155 | allOperations.add(post); 156 | } 157 | if (delete != null) { 158 | allOperations.add(delete); 159 | } 160 | if (patch != null) { 161 | allOperations.add(patch); 162 | } 163 | if (options != null) { 164 | allOperations.add(options); 165 | } 166 | 167 | return allOperations; 168 | } 169 | 170 | @JsonIgnore 171 | public Map getOperationMap() { 172 | Map result = new HashMap(); 173 | 174 | if (get != null) { 175 | result.put(HttpMethod.GET, get); 176 | } 177 | if (put != null) { 178 | result.put(HttpMethod.PUT, put); 179 | } 180 | if (post != null) { 181 | result.put(HttpMethod.POST, post); 182 | } 183 | if (delete != null) { 184 | result.put(HttpMethod.DELETE, delete); 185 | } 186 | if (patch != null) { 187 | result.put(HttpMethod.PATCH, patch); 188 | } 189 | if (head != null) { 190 | result.put(HttpMethod.HEAD, head); 191 | } 192 | if (options != null) { 193 | result.put(HttpMethod.OPTIONS, options); 194 | } 195 | 196 | return result; 197 | } 198 | 199 | public List getParameters() { 200 | return parameters; 201 | } 202 | 203 | public void setParameters(List parameters) { 204 | this.parameters = parameters; 205 | } 206 | 207 | public void addParameter(Object parameter) { 208 | if (this.parameters == null) { 209 | this.parameters = new ArrayList(); 210 | } 211 | this.parameters.add(parameter); 212 | } 213 | 214 | @JsonIgnore 215 | public boolean isEmpty() { 216 | if (get == null && put == null && head == null && post == null && delete == null && patch == null && options == null) { 217 | return true; 218 | } else { 219 | return false; 220 | } 221 | } 222 | 223 | @JsonAnyGetter 224 | public Map getVendorExtensions() { 225 | return vendorExtensions; 226 | } 227 | 228 | @JsonAnySetter 229 | public void setVendorExtension(String name, Object value) { 230 | if (name.startsWith("x-")) { 231 | vendorExtensions.put(name, value); 232 | } 233 | } 234 | 235 | 236 | public int hashCode() { 237 | final int prime = 31; 238 | int result = 1; 239 | result = prime * result + ((delete == null) ? 0 : delete.hashCode()); 240 | result = prime * result + ((get == null) ? 0 : get.hashCode()); 241 | result = prime * result + ((head == null) ? 0 : head.hashCode()); 242 | result = prime * result + ((options == null) ? 0 : options.hashCode()); 243 | result = prime * result 244 | + ((parameters == null) ? 0 : parameters.hashCode()); 245 | result = prime * result + ((patch == null) ? 0 : patch.hashCode()); 246 | result = prime * result + ((post == null) ? 0 : post.hashCode()); 247 | result = prime * result + ((put == null) ? 0 : put.hashCode()); 248 | result = prime * result 249 | + ((vendorExtensions == null) ? 0 : vendorExtensions.hashCode()); 250 | return result; 251 | } 252 | 253 | @Override 254 | public boolean equals(Object obj) { 255 | if (this == obj) { 256 | return true; 257 | } 258 | if (obj == null) { 259 | return false; 260 | } 261 | if (getClass() != obj.getClass()) { 262 | return false; 263 | } 264 | Path other = (Path) obj; 265 | if (delete == null) { 266 | if (other.delete != null) { 267 | return false; 268 | } 269 | } else if (!delete.equals(other.delete)) { 270 | return false; 271 | } 272 | if (get == null) { 273 | if (other.get != null) { 274 | return false; 275 | } 276 | } else if (!get.equals(other.get)) { 277 | return false; 278 | } 279 | if (head == null) { 280 | if (other.head != null) { 281 | return false; 282 | } 283 | } else if (!head.equals(other.head)) { 284 | return false; 285 | } 286 | if (options == null) { 287 | if (other.options != null) { 288 | return false; 289 | } 290 | } else if (!options.equals(other.options)) { 291 | return false; 292 | } 293 | if (parameters == null) { 294 | if (other.parameters != null) { 295 | return false; 296 | } 297 | } else if (!parameters.equals(other.parameters)) { 298 | return false; 299 | } 300 | if (patch == null) { 301 | if (other.patch != null) { 302 | return false; 303 | } 304 | } else if (!patch.equals(other.patch)) { 305 | return false; 306 | } 307 | if (post == null) { 308 | if (other.post != null) { 309 | return false; 310 | } 311 | } else if (!post.equals(other.post)) { 312 | return false; 313 | } 314 | if (put == null) { 315 | if (other.put != null) { 316 | return false; 317 | } 318 | } else if (!put.equals(other.put)) { 319 | return false; 320 | } 321 | if (vendorExtensions == null) { 322 | if (other.vendorExtensions != null) { 323 | return false; 324 | } 325 | } else if (!vendorExtensions.equals(other.vendorExtensions)) { 326 | return false; 327 | } 328 | return true; 329 | } 330 | } 331 | -------------------------------------------------------------------------------- /src/main/resources/static/example.json: -------------------------------------------------------------------------------- 1 | [{"id":"58e5f9227bf9116722bfe859","swagger":"2.0","info":{"description":"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.","version":"2.0","title":"Springfox petstore API","termsOfService":"http://springfox.io","contact":{"name":"springfox","url":null,"email":null},"license":{"name":"Apache License Version 2.0","url":"https://github.com/springfox/springfox/blob/master/LICENSE"}},"host":"127.0.0.1:9000","basePath":"/resource","tags":[{"name":"document-ele-controller","description":"Document Ele Controller","externalDocs":null},{"name":"building-unit-controller","description":"Building Unit Controller","externalDocs":null},{"name":"house-controller","description":"House Controller","externalDocs":null}],"schemes":null,"consumes":null,"produces":null,"security":null,"paths":{"/buildingunit/":{"get":{"tags":["building-unit-controller"],"summary":"getAll","description":null,"operationId":"getAllUsingGET","schemes":null,"consumes":["application/json"],"produces":["*/*"],"parameters":[],"responses":{"200":{"description":"OK","schema":{"type":"object"},"examples":null,"headers":null},"401":{"description":"Unauthorized","schema":null,"examples":null,"headers":null},"403":{"description":"Forbidden","schema":null,"examples":null,"headers":null},"404":{"description":"Not Found","schema":null,"examples":null,"headers":null}},"security":null,"externalDocs":null,"deprecated":null},"head":null,"post":{"tags":["building-unit-controller"],"summary":"create","description":null,"operationId":"createUsingPOST","schemes":null,"consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"buildingUnit","description":"buildingUnit","required":true,"schema":{"$ref":"#/definitions/BuildingUnit"}}],"responses":{"200":{"description":"OK","schema":null,"examples":null,"headers":null},"201":{"description":"Created","schema":null,"examples":null,"headers":null},"401":{"description":"Unauthorized","schema":null,"examples":null,"headers":null},"403":{"description":"Forbidden","schema":null,"examples":null,"headers":null},"404":{"description":"Not Found","schema":null,"examples":null,"headers":null}},"security":null,"externalDocs":null,"deprecated":null},"put":null,"delete":null,"options":null,"patch":null,"parameters":null},"/documentEle/":{"get":{"tags":["document-ele-controller"],"summary":"getAllFields","description":null,"operationId":"getAllFieldsUsingGET","schemes":null,"consumes":["application/json"],"produces":["*/*"],"parameters":[],"responses":{"200":{"description":"OK","schema":{"type":"object"},"examples":null,"headers":null},"401":{"description":"Unauthorized","schema":null,"examples":null,"headers":null},"403":{"description":"Forbidden","schema":null,"examples":null,"headers":null},"404":{"description":"Not Found","schema":null,"examples":null,"headers":null}},"security":null,"externalDocs":null,"deprecated":null},"head":null,"post":{"tags":["document-ele-controller"],"summary":"create","description":null,"operationId":"createUsingPOST_1","schemes":null,"consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"documentEle","description":"documentEle","required":true,"schema":{"$ref":"#/definitions/DocumentEle"}}],"responses":{"200":{"description":"OK","schema":null,"examples":null,"headers":null},"201":{"description":"Created","schema":null,"examples":null,"headers":null},"401":{"description":"Unauthorized","schema":null,"examples":null,"headers":null},"403":{"description":"Forbidden","schema":null,"examples":null,"headers":null},"404":{"description":"Not Found","schema":null,"examples":null,"headers":null}},"security":null,"externalDocs":null,"deprecated":null},"put":null,"delete":null,"options":null,"patch":null,"parameters":null},"/documentEle/category/{name}":{"get":{"tags":["document-ele-controller"],"summary":"getByCategory","description":null,"operationId":"getByCategoryUsingGET","schemes":null,"consumes":["application/json"],"produces":["*/*"],"parameters":[{"name":"name","in":"path","description":"name","required":true,"type":"string","enum":["BUILDING","BUILDINGUNIT","HOUSE"]}],"responses":{"200":{"description":"OK","schema":{"type":"array","items":{"$ref":"#/definitions/DocumentEle"}},"examples":null,"headers":null},"401":{"description":"Unauthorized","schema":null,"examples":null,"headers":null},"403":{"description":"Forbidden","schema":null,"examples":null,"headers":null},"404":{"description":"Not Found","schema":null,"examples":null,"headers":null}},"security":null,"externalDocs":null,"deprecated":null},"head":null,"post":null,"put":null,"delete":null,"options":null,"patch":null,"parameters":null},"/house/":{"get":{"tags":["house-controller"],"summary":"getAll","description":null,"operationId":"getAllUsingGET_1","schemes":null,"consumes":["application/json"],"produces":["*/*"],"parameters":[],"responses":{"200":{"description":"OK","schema":{"type":"object"},"examples":null,"headers":null},"401":{"description":"Unauthorized","schema":null,"examples":null,"headers":null},"403":{"description":"Forbidden","schema":null,"examples":null,"headers":null},"404":{"description":"Not Found","schema":null,"examples":null,"headers":null}},"security":null,"externalDocs":null,"deprecated":null},"head":null,"post":{"tags":["house-controller"],"summary":"create","description":null,"operationId":"createUsingPOST_2","schemes":null,"consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"house","description":"house","required":true,"schema":{"$ref":"#/definitions/House"}}],"responses":{"200":{"description":"OK","schema":null,"examples":null,"headers":null},"201":{"description":"Created","schema":null,"examples":null,"headers":null},"401":{"description":"Unauthorized","schema":null,"examples":null,"headers":null},"403":{"description":"Forbidden","schema":null,"examples":null,"headers":null},"404":{"description":"Not Found","schema":null,"examples":null,"headers":null}},"security":null,"externalDocs":null,"deprecated":null},"put":null,"delete":null,"options":null,"patch":null,"parameters":null},"/house/{seqNo}":{"get":{"tags":["house-controller"],"summary":"getBySeqNo","description":null,"operationId":"getBySeqNoUsingGET","schemes":null,"consumes":["application/json"],"produces":["*/*"],"parameters":[{"name":"seqNo","in":"path","description":"seqNo","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/House"},"examples":null,"headers":null},"401":{"description":"Unauthorized","schema":null,"examples":null,"headers":null},"403":{"description":"Forbidden","schema":null,"examples":null,"headers":null},"404":{"description":"Not Found","schema":null,"examples":null,"headers":null}},"security":null,"externalDocs":null,"deprecated":null},"head":null,"post":null,"put":null,"delete":null,"options":null,"patch":null,"parameters":null}},"securityDefinitions":null,"definitions":{"Building":{"type":"object","discriminator":null,"properties":null,"externalDocs":null,"title":null,"format":null,"description":null,"example":null,"additionalProperties":null,"xml":null,"enum":null,"default":null},"Address":{"type":"object","discriminator":null,"properties":{"city":{"type":"string"},"district":{"type":"string"},"location":{"$ref":"#/definitions/GeoJsonPoint"},"name":{"type":"string"},"province":{"type":"string"},"street":{"type":"string"},"tempX":{"type":"number","format":"double"},"tempY":{"type":"number","format":"double"}},"externalDocs":null,"title":null,"format":null,"description":null,"example":null,"additionalProperties":null,"xml":null,"enum":null,"default":null},"BuildingUnit":{"type":"object","discriminator":null,"properties":{"address":{"$ref":"#/definitions/Address"},"building":{"$ref":"#/definitions/Building"},"description":{"type":"object"},"name":{"type":"string"},"seqNo":{"type":"string"}},"externalDocs":null,"title":null,"format":null,"description":null,"example":null,"additionalProperties":null,"xml":null,"enum":null,"default":null},"HousePrice":{"type":"object","discriminator":null,"properties":{"amount":{"type":"number"},"updateDate":{"type":"string","format":"date-time"}},"externalDocs":null,"title":null,"format":null,"description":null,"example":null,"additionalProperties":null,"xml":null,"enum":null,"default":null},"House":{"type":"object","discriminator":null,"properties":{"buildingUnit":{"$ref":"#/definitions/BuildingUnit"},"description":{"type":"object"},"feature":{"type":"object"},"price":{"$ref":"#/definitions/HousePrice"},"priceHistory":{"type":"array","items":{"$ref":"#/definitions/HousePrice"}},"seqNo":{"type":"string"},"status":{"type":"string"},"tag":{"type":"array","items":{"type":"string"}}},"externalDocs":null,"title":null,"format":null,"description":null,"example":null,"additionalProperties":null,"xml":null,"enum":null,"default":null},"GeoJsonPoint":{"type":"object","discriminator":null,"properties":{"coordinates":{"type":"array","items":{"type":"number","format":"double"}},"type":{"type":"string"},"x":{"type":"number","format":"double"},"y":{"type":"number","format":"double"}},"externalDocs":null,"title":null,"format":null,"description":null,"example":null,"additionalProperties":null,"xml":null,"enum":null,"default":null},"DocumentEle":{"type":"object","discriminator":null,"properties":{"addTime":{"type":"string","format":"date-time"},"category":{"type":"string","enum":["BUILDING","BUILDINGUNIT","HOUSE"]},"configurable":{"type":"integer","format":"int32"},"dataType":{"type":"string"},"description":{"type":"string"},"embedEles":{"type":"array","items":{"$ref":"#/definitions/DocumentEle"}},"id":{"type":"integer","format":"int64"},"jsonKey":{"type":"string"},"level":{"type":"integer","format":"int32"},"name":{"type":"string"},"parentEleId":{"type":"integer","format":"int64"},"tableHeader":{"type":"integer","format":"int32"},"updateTime":{"type":"string","format":"date-time"}},"externalDocs":null,"title":null,"format":null,"description":null,"example":null,"additionalProperties":null,"xml":null,"enum":null,"default":null}},"parameters":null,"responses":null,"externalDocs":null}] -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/ModelImpl.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | 7 | import javax.xml.bind.annotation.XmlType; 8 | import java.util.*; 9 | 10 | @XmlType(propOrder = {"type", "required", "discriminator", "properties"}) 11 | @JsonPropertyOrder({"type", "required", "discriminator", "properties"}) 12 | public class ModelImpl extends AbstractModel { 13 | public static final String OBJECT = "object"; 14 | private String type; 15 | private String format; 16 | private String name; 17 | private List required; 18 | private Map properties; 19 | private boolean isSimple = false; 20 | private String description; 21 | private Object example; 22 | private Object additionalProperties; 23 | private String discriminator; 24 | private Xml xml; 25 | @JsonProperty("default") 26 | private String defaultValue; 27 | private List _enum; 28 | 29 | public ModelImpl _enum(List value) { 30 | this._enum = value; 31 | return this; 32 | } 33 | 34 | public ModelImpl _enum(String value) { 35 | if(this._enum == null) { 36 | this._enum = new ArrayList(); 37 | } 38 | this._enum.add(value); 39 | return this; 40 | } 41 | 42 | public List getEnum() { 43 | return _enum; 44 | } 45 | 46 | public void setEnum(List _enum) { 47 | this._enum = _enum; 48 | } 49 | 50 | 51 | public ModelImpl discriminator(String discriminator) { 52 | this.setDiscriminator(discriminator); 53 | return this; 54 | } 55 | 56 | public ModelImpl type(String type) { 57 | this.setType(type); 58 | return this; 59 | } 60 | 61 | public ModelImpl format(String format) { 62 | this.setFormat(format); 63 | return this; 64 | } 65 | 66 | public ModelImpl name(String name) { 67 | this.setName(name); 68 | return this; 69 | } 70 | 71 | public ModelImpl description(String description) { 72 | this.setDescription(description); 73 | return this; 74 | } 75 | 76 | 77 | public ModelImpl example(Object example) { 78 | this.setExample(example); 79 | return this; 80 | } 81 | 82 | public ModelImpl additionalProperties(Object additionalProperties) { 83 | this.setAdditionalProperties(additionalProperties); 84 | return this; 85 | } 86 | 87 | public ModelImpl xml(Xml xml) { 88 | this.setXml(xml); 89 | return this; 90 | } 91 | 92 | public String getDiscriminator() { 93 | return this.discriminator; 94 | } 95 | 96 | public void setDiscriminator(String discriminator) { 97 | this.discriminator = discriminator; 98 | } 99 | 100 | @JsonIgnore 101 | public String getName() { 102 | return this.name; 103 | } 104 | 105 | public void setName(String name) { 106 | this.name = name; 107 | } 108 | 109 | public String getDescription() { 110 | return description; 111 | } 112 | 113 | public void setDescription(String description) { 114 | this.description = description; 115 | } 116 | 117 | @JsonIgnore 118 | public boolean isSimple() { 119 | return isSimple; 120 | } 121 | 122 | public void setSimple(boolean isSimple) { 123 | this.isSimple = isSimple; 124 | } 125 | 126 | public Object getAdditionalProperties() { 127 | return additionalProperties; 128 | } 129 | 130 | public void setAdditionalProperties(Object additionalProperties) { 131 | type(OBJECT); 132 | this.additionalProperties = additionalProperties; 133 | } 134 | 135 | public String getType() { 136 | return type; 137 | } 138 | 139 | public void setType(String type) { 140 | this.type = type; 141 | } 142 | 143 | public String getFormat() { 144 | return format; 145 | } 146 | 147 | public void setFormat(String format) { 148 | this.format = format; 149 | } 150 | 151 | 152 | 153 | public Map getProperties() { 154 | return properties; 155 | } 156 | 157 | @Override 158 | public void setProperties(Map properties) { 159 | this.properties = properties; 160 | } 161 | 162 | public Object getExample() { 163 | if (example == null) { 164 | // TODO: will add logic to construct examples based on payload here 165 | } 166 | 167 | return example; 168 | } 169 | 170 | public void setExample(Object example) { 171 | this.example = example; 172 | } 173 | 174 | public Xml getXml() { 175 | return xml; 176 | } 177 | 178 | public void setXml(Xml xml) { 179 | this.xml = xml; 180 | } 181 | 182 | public String getDefaultValue() { 183 | return defaultValue; 184 | } 185 | 186 | public void setDefaultValue(String defaultValue) { 187 | this.defaultValue = defaultValue; 188 | } 189 | 190 | public Object clone() { 191 | ModelImpl cloned = new ModelImpl(); 192 | super.cloneTo(cloned); 193 | cloned.type = this.type; 194 | cloned.name = this.name; 195 | cloned.required = this.required; 196 | if (this.properties != null) cloned.properties = new LinkedHashMap<>(this.properties); 197 | cloned.isSimple = this.isSimple; 198 | cloned.description = this.description; 199 | cloned.example = this.example; 200 | cloned.additionalProperties = this.additionalProperties; 201 | cloned.discriminator = this.discriminator; 202 | cloned.xml = this.xml; 203 | cloned.defaultValue = this.defaultValue; 204 | 205 | return cloned; 206 | } 207 | 208 | @Override 209 | public int hashCode() { 210 | final int prime = 31; 211 | int result = super.hashCode(); 212 | result = prime 213 | * result 214 | + ((additionalProperties == null) ? 0 : additionalProperties 215 | .hashCode()); 216 | result = prime * result 217 | + ((description == null) ? 0 : description.hashCode()); 218 | result = prime * result 219 | + ((discriminator == null) ? 0 : discriminator.hashCode()); 220 | result = prime * result + ((example == null) ? 0 : example.hashCode()); 221 | result = prime * result + ((format == null) ? 0 : format.hashCode()); 222 | result = prime * result + (isSimple ? 1231 : 1237); 223 | result = prime * result + ((name == null) ? 0 : name.hashCode()); 224 | result = prime * result 225 | + ((properties == null) ? 0 : properties.hashCode()); 226 | result = prime * result + ((required == null) ? 0 : required.hashCode()); 227 | result = prime * result + ((type == null) ? 0 : type.hashCode()); 228 | result = prime * result + ((xml == null) ? 0 : xml.hashCode()); 229 | result = prime * result + ((defaultValue == null) ? 0 : defaultValue.hashCode()); 230 | return result; 231 | } 232 | 233 | @Override 234 | public boolean equals(Object obj) { 235 | if (this == obj) { 236 | return true; 237 | } 238 | if (!super.equals(obj)) { 239 | return false; 240 | } 241 | if (getClass() != obj.getClass()) { 242 | return false; 243 | } 244 | ModelImpl other = (ModelImpl) obj; 245 | if (additionalProperties == null) { 246 | if (other.additionalProperties != null) { 247 | return false; 248 | } 249 | } else if (!additionalProperties.equals(other.additionalProperties)) { 250 | return false; 251 | } 252 | if (description == null) { 253 | if (other.description != null) { 254 | return false; 255 | } 256 | } else if (!description.equals(other.description)) { 257 | return false; 258 | } 259 | if (discriminator == null) { 260 | if (other.discriminator != null) { 261 | return false; 262 | } 263 | } else if (!discriminator.equals(other.discriminator)) { 264 | return false; 265 | } 266 | if (example == null) { 267 | if (other.example != null) { 268 | return false; 269 | } 270 | } else if (!example.equals(other.example)) { 271 | return false; 272 | } 273 | if (format == null) { 274 | if (other.format != null) { 275 | return false; 276 | } 277 | } else if (!format.equals(other.format)) { 278 | return false; 279 | } 280 | if (isSimple != other.isSimple) { 281 | return false; 282 | } 283 | if (name == null) { 284 | if (other.name != null) { 285 | return false; 286 | } 287 | } else if (!name.equals(other.name)) { 288 | return false; 289 | } 290 | if (properties == null) { 291 | if (other.properties != null) { 292 | return false; 293 | } 294 | } else if (!properties.equals(other.properties)) { 295 | return false; 296 | } 297 | if (required == null) { 298 | if (other.required != null) { 299 | return false; 300 | } 301 | } else if (!required.equals(other.required)) { 302 | return false; 303 | } 304 | if (type == null) { 305 | if (other.type != null) { 306 | return false; 307 | } 308 | } else if (!type.equals(other.type)) { 309 | return false; 310 | } 311 | if (xml == null) { 312 | if (other.xml != null) { 313 | return false; 314 | } 315 | } else if (!xml.equals(other.xml)) { 316 | return false; 317 | } 318 | if (defaultValue == null) { 319 | if (other.defaultValue != null) { 320 | return false; 321 | } 322 | } else if (!defaultValue.equals(other.defaultValue)) { 323 | return false; 324 | } 325 | return true; 326 | } 327 | } 328 | -------------------------------------------------------------------------------- /src/main/resources/static/swagger/lib/highlight.9.1.0.pack.js: -------------------------------------------------------------------------------- 1 | !function(e){"undefined"!=typeof exports?e(exports):(self.hljs=e({}),"function"==typeof define&&define.amd&&define("hljs",[],function(){return self.hljs}))}(function(e){function r(e){return e.replace(/&/gm,"&").replace(//gm,">")}function t(e){return e.nodeName.toLowerCase()}function n(e,r){var t=e&&e.exec(r);return t&&0==t.index}function a(e){return/^(no-?highlight|plain|text)$/i.test(e)}function c(e){var r,t,n,c=e.className+" ";if(c+=e.parentNode?e.parentNode.className:"",t=/\blang(?:uage)?-([\w-]+)\b/i.exec(c))return E(t[1])?t[1]:"no-highlight";for(c=c.split(/\s+/),r=0,n=c.length;n>r;r++)if(E(c[r])||a(c[r]))return c[r]}function i(e,r){var t,n={};for(t in e)n[t]=e[t];if(r)for(t in r)n[t]=r[t];return n}function o(e){var r=[];return function n(e,a){for(var c=e.firstChild;c;c=c.nextSibling)3==c.nodeType?a+=c.nodeValue.length:1==c.nodeType&&(r.push({event:"start",offset:a,node:c}),a=n(c,a),t(c).match(/br|hr|img|input/)||r.push({event:"stop",offset:a,node:c}));return a}(e,0),r}function s(e,n,a){function c(){return e.length&&n.length?e[0].offset!=n[0].offset?e[0].offset"}function o(e){l+=""}function s(e){("start"==e.event?i:o)(e.node)}for(var u=0,l="",f=[];e.length||n.length;){var b=c();if(l+=r(a.substr(u,b[0].offset-u)),u=b[0].offset,b==e){f.reverse().forEach(o);do s(b.splice(0,1)[0]),b=c();while(b==e&&b.length&&b[0].offset==u);f.reverse().forEach(i)}else"start"==b[0].event?f.push(b[0].node):f.pop(),s(b.splice(0,1)[0])}return l+r(a.substr(u))}function u(e){function r(e){return e&&e.source||e}function t(t,n){return new RegExp(r(t),"m"+(e.cI?"i":"")+(n?"g":""))}function n(a,c){if(!a.compiled){if(a.compiled=!0,a.k=a.k||a.bK,a.k){var o={},s=function(r,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");o[t[0]]=[r,t[1]?Number(t[1]):1]})};"string"==typeof a.k?s("keyword",a.k):Object.keys(a.k).forEach(function(e){s(e,a.k[e])}),a.k=o}a.lR=t(a.l||/\b\w+\b/,!0),c&&(a.bK&&(a.b="\\b("+a.bK.split(" ").join("|")+")\\b"),a.b||(a.b=/\B|\b/),a.bR=t(a.b),a.e||a.eW||(a.e=/\B|\b/),a.e&&(a.eR=t(a.e)),a.tE=r(a.e)||"",a.eW&&c.tE&&(a.tE+=(a.e?"|":"")+c.tE)),a.i&&(a.iR=t(a.i)),void 0===a.r&&(a.r=1),a.c||(a.c=[]);var u=[];a.c.forEach(function(e){e.v?e.v.forEach(function(r){u.push(i(e,r))}):u.push("self"==e?a:e)}),a.c=u,a.c.forEach(function(e){n(e,a)}),a.starts&&n(a.starts,c);var l=a.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([a.tE,a.i]).map(r).filter(Boolean);a.t=l.length?t(l.join("|"),!0):{exec:function(){return null}}}}n(e)}function l(e,t,a,c){function i(e,r){for(var t=0;t";return c+=e+'">',c+r+i}function p(){if(!M.k)return r(B);var e="",t=0;M.lR.lastIndex=0;for(var n=M.lR.exec(B);n;){e+=r(B.substr(t,n.index-t));var a=b(M,n);a?(L+=a[1],e+=g(a[0],r(n[0]))):e+=r(n[0]),t=M.lR.lastIndex,n=M.lR.exec(B)}return e+r(B.substr(t))}function h(){var e="string"==typeof M.sL;if(e&&!y[M.sL])return r(B);var t=e?l(M.sL,B,!0,R[M.sL]):f(B,M.sL.length?M.sL:void 0);return M.r>0&&(L+=t.r),e&&(R[M.sL]=t.top),g(t.language,t.value,!1,!0)}function d(){return void 0!==M.sL?h():p()}function m(e,t){var n=e.cN?g(e.cN,"",!0):"";e.rB?(x+=n,B=""):e.eB?(x+=r(t)+n,B=""):(x+=n,B=t),M=Object.create(e,{parent:{value:M}})}function v(e,t){if(B+=e,void 0===t)return x+=d(),0;var n=i(t,M);if(n)return x+=d(),m(n,t),n.rB?0:t.length;var a=o(M,t);if(a){var c=M;c.rE||c.eE||(B+=t),x+=d();do M.cN&&(x+=""),L+=M.r,M=M.parent;while(M!=a.parent);return c.eE&&(x+=r(t)),B="",a.starts&&m(a.starts,""),c.rE?0:t.length}if(s(t,M))throw new Error('Illegal lexeme "'+t+'" for mode "'+(M.cN||"")+'"');return B+=t,t.length||1}var N=E(e);if(!N)throw new Error('Unknown language: "'+e+'"');u(N);var C,M=c||N,R={},x="";for(C=M;C!=N;C=C.parent)C.cN&&(x=g(C.cN,"",!0)+x);var B="",L=0;try{for(var S,A,k=0;M.t.lastIndex=k,S=M.t.exec(t),S;)A=v(t.substr(k,S.index-k),S[0]),k=S.index+A;for(v(t.substr(k)),C=M;C.parent;C=C.parent)C.cN&&(x+="");return{r:L,value:x,language:e,top:M}}catch(I){if(-1!=I.message.indexOf("Illegal"))return{r:0,value:r(t)};throw I}}function f(e,t){t=t||w.languages||Object.keys(y);var n={r:0,value:r(e)},a=n;return t.forEach(function(r){if(E(r)){var t=l(r,e,!1);t.language=r,t.r>a.r&&(a=t),t.r>n.r&&(a=n,n=t)}}),a.language&&(n.second_best=a),n}function b(e){return w.tabReplace&&(e=e.replace(/^((<[^>]+>|\t)+)/gm,function(e,r){return r.replace(/\t/g,w.tabReplace)})),w.useBR&&(e=e.replace(/\n/g,"
")),e}function g(e,r,t){var n=r?C[r]:t,a=[e.trim()];return e.match(/\bhljs\b/)||a.push("hljs"),-1===e.indexOf(n)&&a.push(n),a.join(" ").trim()}function p(e){var r=c(e);if(!a(r)){var t;w.useBR?(t=document.createElementNS("http://www.w3.org/1999/xhtml","div"),t.innerHTML=e.innerHTML.replace(/\n/g,"").replace(//g,"\n")):t=e;var n=t.textContent,i=r?l(r,n,!0):f(n),u=o(t);if(u.length){var p=document.createElementNS("http://www.w3.org/1999/xhtml","div");p.innerHTML=i.value,i.value=s(u,o(p),n)}i.value=b(i.value),e.innerHTML=i.value,e.className=g(e.className,r,i.language),e.result={language:i.language,re:i.r},i.second_best&&(e.second_best={language:i.second_best.language,re:i.second_best.r})}}function h(e){w=i(w,e)}function d(){if(!d.called){d.called=!0;var e=document.querySelectorAll("pre code");Array.prototype.forEach.call(e,p)}}function m(){addEventListener("DOMContentLoaded",d,!1),addEventListener("load",d,!1)}function v(r,t){var n=y[r]=t(e);n.aliases&&n.aliases.forEach(function(e){C[e]=r})}function N(){return Object.keys(y)}function E(e){return e=(e||"").toLowerCase(),y[e]||y[C[e]]}var w={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},y={},C={};return e.highlight=l,e.highlightAuto=f,e.fixMarkup=b,e.highlightBlock=p,e.configure=h,e.initHighlighting=d,e.initHighlightingOnLoad=m,e.registerLanguage=v,e.listLanguages=N,e.getLanguage=E,e.inherit=i,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},e.C=function(r,t,n){var a=e.inherit({cN:"comment",b:r,e:t,c:[]},n||{});return a.c.push(e.PWM),a.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),a},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e}),hljs.registerLanguage("json",function(e){var r={literal:"true false null"},t=[e.QSM,e.CNM],n={e:",",eW:!0,eE:!0,c:t,k:r},a={b:"{",e:"}",c:[{cN:"attr",b:'\\s*"',e:'"\\s*:\\s*',eB:!0,eE:!0,c:[e.BE],i:"\\n",starts:n}],i:"\\S"},c={b:"\\[",e:"\\]",c:[e.inherit(n)],i:"\\S"};return t.splice(t.length,0,a,c),{c:t,k:r,i:"\\S"}}),hljs.registerLanguage("xml",function(e){var r="[A-Za-z0-9\\._:-]+",t={b:/<\?(php)?(?!\w)/,e:/\?>/,sL:"php"},n={eW:!0,i:/]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xsl","plist"],cI:!0,c:[{cN:"meta",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},e.C("",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"|$)",e:">",k:{name:"style"},c:[n],starts:{e:"",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"|$)",e:">",k:{name:"script"},c:[n],starts:{e:"",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},t,{cN:"meta",b:/<\?\w+/,e:/\?>/,r:10},{cN:"tag",b:"",c:[{cN:"name",b:/[^\/><\s]+/,r:0},n]}]}}),hljs.registerLanguage("javascript",function(e){return{aliases:["js"],k:{keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},e.ASM,e.QSM,{cN:"string",b:"`",e:"`",c:[e.BE,{cN:"subst",b:"\\$\\{",e:"\\}"}]},e.CLCM,e.CBCM,{cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{b:/\s*[);\]]/,r:0,sL:"xml"}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:[e.CLCM,e.CBCM]}],i:/\[|%/},{b:/\$[(.]/},{b:"\\."+e.IR,r:0},{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}}),hljs.registerLanguage("css",function(e){var r="[a-zA-Z-][a-zA-Z0-9_-]*",t={b:/[A-Z\_\.\-]+\s*:/,rB:!0,e:";",eW:!0,c:[{cN:"attribute",b:/\S/,e:":",eE:!0,starts:{eW:!0,eE:!0,c:[{b:/[\w-]+\s*\(/,rB:!0,c:[{cN:"built_in",b:/[\w-]+/}]},e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"number",b:"#[0-9A-Fa-f]+"},{cN:"meta",b:"!important"}]}}]};return{cI:!0,i:/[=\/|'\$]/,c:[e.CBCM,{cN:"selector-id",b:/#[A-Za-z0-9_-]+/},{cN:"selector-class",b:/\.[A-Za-z0-9_-]+/},{cN:"selector-attr",b:/\[/,e:/\]/,i:"$"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{b:"@",e:"[{;]",c:[{cN:"keyword",b:/\S+/},{b:/\s/,eW:!0,eE:!0,r:0,c:[e.ASM,e.QSM,e.CSSNM]}]},{cN:"selector-tag",b:r,r:0},{b:"{",e:"}",i:/\S/,c:[e.CBCM,t]}]}}); -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /src/main/java/com/burnetzhong/domain/Operation.java: -------------------------------------------------------------------------------- 1 | package com.burnetzhong.domain; 2 | 3 | import com.fasterxml.jackson.annotation.JsonAnyGetter; 4 | import com.fasterxml.jackson.annotation.JsonAnySetter; 5 | 6 | import java.util.ArrayList; 7 | import java.util.HashMap; 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | public class Operation { 12 | private final Map vendorExtensions = new HashMap(); 13 | private List tags; 14 | private String summary; 15 | private String description; 16 | private String operationId; 17 | private List schemes; 18 | private List consumes; 19 | private List produces; 20 | private List parameters = new ArrayList(); 21 | private Map responses; 22 | private List>> security; 23 | private ExternalDocs externalDocs; 24 | private Boolean deprecated; 25 | 26 | public Operation summary(String summary) { 27 | this.setSummary(summary); 28 | return this; 29 | } 30 | 31 | public Operation description(String description) { 32 | this.setDescription(description); 33 | return this; 34 | } 35 | 36 | public Operation operationId(String operationId) { 37 | this.setOperationId(operationId); 38 | return this; 39 | } 40 | 41 | public Operation schemes(List schemes) { 42 | this.setSchemes(schemes); 43 | return this; 44 | } 45 | 46 | public Operation scheme(Scheme scheme) { 47 | this.addScheme(scheme); 48 | return this; 49 | } 50 | 51 | public Operation consumes(List consumes) { 52 | this.setConsumes(consumes); 53 | return this; 54 | } 55 | 56 | public Operation consumes(String consumes) { 57 | this.addConsumes(consumes); 58 | return this; 59 | } 60 | 61 | public Operation produces(List produces) { 62 | this.setProduces(produces); 63 | return this; 64 | } 65 | 66 | public Operation produces(String produces) { 67 | this.addProduces(produces); 68 | return this; 69 | } 70 | 71 | public Operation security(SecurityRequirement security) { 72 | this.addSecurity(security.getName(), security.getScopes()); 73 | return this; 74 | } 75 | 76 | public Operation parameter(Object parameter) { 77 | this.addParameter(parameter); 78 | return this; 79 | } 80 | 81 | public Operation response(int key, Response response) { 82 | this.addResponse(String.valueOf(key), response); 83 | return this; 84 | } 85 | 86 | public Operation defaultResponse(Response response) { 87 | this.addResponse("default", response); 88 | return this; 89 | } 90 | 91 | public Operation tags(List tags) { 92 | this.setTags(tags); 93 | return this; 94 | } 95 | 96 | public Operation tag(String tag) { 97 | this.addTag(tag); 98 | return this; 99 | } 100 | 101 | public Operation externalDocs(ExternalDocs externalDocs) { 102 | this.setExternalDocs(externalDocs); 103 | return this; 104 | } 105 | 106 | public Operation deprecated(Boolean deprecated) { 107 | this.setDeprecated(deprecated); 108 | return this; 109 | } 110 | 111 | public List getTags() { 112 | return tags; 113 | } 114 | 115 | public void setTags(List tags) { 116 | this.tags = tags; 117 | } 118 | 119 | public void addTag(String tag) { 120 | if (this.tags == null) { 121 | this.tags = new ArrayList(); 122 | } 123 | this.tags.add(tag); 124 | } 125 | 126 | public String getSummary() { 127 | return summary; 128 | } 129 | 130 | public void setSummary(String summary) { 131 | this.summary = summary; 132 | } 133 | 134 | public String getDescription() { 135 | return description; 136 | } 137 | 138 | public void setDescription(String description) { 139 | this.description = description; 140 | } 141 | 142 | public String getOperationId() { 143 | return operationId; 144 | } 145 | 146 | public void setOperationId(String operationId) { 147 | this.operationId = operationId; 148 | } 149 | 150 | public List getSchemes() { 151 | return schemes; 152 | } 153 | 154 | public void setSchemes(List schemes) { 155 | this.schemes = schemes; 156 | } 157 | 158 | public void addScheme(Scheme scheme) { 159 | if (schemes == null) { 160 | schemes = new ArrayList(); 161 | } 162 | if (!schemes.contains(scheme)) { 163 | schemes.add(scheme); 164 | } 165 | } 166 | 167 | public List getConsumes() { 168 | return consumes; 169 | } 170 | 171 | public void setConsumes(List consumes) { 172 | this.consumes = consumes; 173 | } 174 | 175 | public void addConsumes(String consumes) { 176 | if (this.consumes == null) { 177 | this.consumes = new ArrayList(); 178 | } 179 | this.consumes.add(consumes); 180 | } 181 | 182 | public List getProduces() { 183 | return produces; 184 | } 185 | 186 | public void setProduces(List produces) { 187 | this.produces = produces; 188 | } 189 | 190 | public void addProduces(String produces) { 191 | if (this.produces == null) { 192 | this.produces = new ArrayList(); 193 | } 194 | this.produces.add(produces); 195 | } 196 | 197 | public List getParameters() { 198 | return parameters; 199 | } 200 | 201 | public void setParameters(List parameters) { 202 | this.parameters = parameters; 203 | } 204 | 205 | public void addParameter(Object parameter) { 206 | if (this.parameters == null) { 207 | this.parameters = new ArrayList(); 208 | } 209 | this.parameters.add(parameter); 210 | } 211 | 212 | public Map getResponses() { 213 | return responses; 214 | } 215 | 216 | public void setResponses(Map responses) { 217 | this.responses = responses; 218 | } 219 | 220 | public void addResponse(String key, Response response) { 221 | if (this.responses == null) { 222 | this.responses = new HashMap(); 223 | } 224 | this.responses.put(key, response); 225 | } 226 | 227 | public List>> getSecurity() { 228 | return security; 229 | } 230 | 231 | public void setSecurity(List>> security) { 232 | this.security = security; 233 | } 234 | 235 | public void addSecurity(String name, List scopes) { 236 | if (this.security == null) { 237 | this.security = new ArrayList>>(); 238 | } 239 | Map> req = new HashMap>(); 240 | if (scopes == null) { 241 | scopes = new ArrayList(); 242 | } 243 | req.put(name, scopes); 244 | this.security.add(req); 245 | } 246 | 247 | public ExternalDocs getExternalDocs() { 248 | return externalDocs; 249 | } 250 | 251 | public void setExternalDocs(ExternalDocs value) { 252 | this.externalDocs = value; 253 | } 254 | 255 | public Boolean isDeprecated() { 256 | return deprecated; 257 | } 258 | 259 | public void setDeprecated(Boolean value) { 260 | if (value == null || value.equals(Boolean.FALSE)) { 261 | this.deprecated = null; 262 | } else { 263 | this.deprecated = value; 264 | } 265 | } 266 | 267 | @JsonAnyGetter 268 | public Map getVendorExtensions() { 269 | return vendorExtensions; 270 | } 271 | 272 | @JsonAnySetter 273 | public void setVendorExtension(String name, Object value) { 274 | if (name.startsWith("x-")) { 275 | vendorExtensions.put(name, value); 276 | } 277 | } 278 | 279 | @Override 280 | public int hashCode() { 281 | final int prime = 31; 282 | int result = 1; 283 | result = prime * result + ((consumes == null) ? 0 : consumes.hashCode()); 284 | result = prime * result 285 | + ((deprecated == null) ? 0 : deprecated.hashCode()); 286 | result = prime * result 287 | + ((description == null) ? 0 : description.hashCode()); 288 | result = prime * result 289 | + ((externalDocs == null) ? 0 : externalDocs.hashCode()); 290 | result = prime * result 291 | + ((operationId == null) ? 0 : operationId.hashCode()); 292 | result = prime * result 293 | + ((parameters == null) ? 0 : parameters.hashCode()); 294 | result = prime * result + ((produces == null) ? 0 : produces.hashCode()); 295 | result = prime * result + ((responses == null) ? 0 : responses.hashCode()); 296 | result = prime * result + ((schemes == null) ? 0 : schemes.hashCode()); 297 | result = prime * result + ((security == null) ? 0 : security.hashCode()); 298 | result = prime * result + ((summary == null) ? 0 : summary.hashCode()); 299 | result = prime * result + ((tags == null) ? 0 : tags.hashCode()); 300 | result = prime * result 301 | + ((vendorExtensions == null) ? 0 : vendorExtensions.hashCode()); 302 | return result; 303 | } 304 | 305 | @Override 306 | public boolean equals(Object obj) { 307 | if (this == obj) { 308 | return true; 309 | } 310 | if (obj == null) { 311 | return false; 312 | } 313 | if (getClass() != obj.getClass()) { 314 | return false; 315 | } 316 | Operation other = (Operation) obj; 317 | if (consumes == null) { 318 | if (other.consumes != null) { 319 | return false; 320 | } 321 | } else if (!consumes.equals(other.consumes)) { 322 | return false; 323 | } 324 | if (deprecated == null) { 325 | if (other.deprecated != null) { 326 | return false; 327 | } 328 | } else if (!deprecated.equals(other.deprecated)) { 329 | return false; 330 | } 331 | if (description == null) { 332 | if (other.description != null) { 333 | return false; 334 | } 335 | } else if (!description.equals(other.description)) { 336 | return false; 337 | } 338 | if (externalDocs == null) { 339 | if (other.externalDocs != null) { 340 | return false; 341 | } 342 | } else if (!externalDocs.equals(other.externalDocs)) { 343 | return false; 344 | } 345 | if (operationId == null) { 346 | if (other.operationId != null) { 347 | return false; 348 | } 349 | } else if (!operationId.equals(other.operationId)) { 350 | return false; 351 | } 352 | if (parameters == null) { 353 | if (other.parameters != null) { 354 | return false; 355 | } 356 | } else if (!parameters.equals(other.parameters)) { 357 | return false; 358 | } 359 | if (produces == null) { 360 | if (other.produces != null) { 361 | return false; 362 | } 363 | } else if (!produces.equals(other.produces)) { 364 | return false; 365 | } 366 | if (responses == null) { 367 | if (other.responses != null) { 368 | return false; 369 | } 370 | } else if (!responses.equals(other.responses)) { 371 | return false; 372 | } 373 | if (schemes == null) { 374 | if (other.schemes != null) { 375 | return false; 376 | } 377 | } else if (!schemes.equals(other.schemes)) { 378 | return false; 379 | } 380 | if (security == null) { 381 | if (other.security != null) { 382 | return false; 383 | } 384 | } else if (!security.equals(other.security)) { 385 | return false; 386 | } 387 | if (summary == null) { 388 | if (other.summary != null) { 389 | return false; 390 | } 391 | } else if (!summary.equals(other.summary)) { 392 | return false; 393 | } 394 | if (tags == null) { 395 | if (other.tags != null) { 396 | return false; 397 | } 398 | } else if (!tags.equals(other.tags)) { 399 | return false; 400 | } 401 | if (vendorExtensions == null) { 402 | if (other.vendorExtensions != null) { 403 | return false; 404 | } 405 | } else if (!vendorExtensions.equals(other.vendorExtensions)) { 406 | return false; 407 | } 408 | return true; 409 | } 410 | 411 | public Operation vendorExtensions(Map vendorExtensions) { 412 | this.vendorExtensions.putAll( vendorExtensions ); 413 | return this; 414 | } 415 | 416 | @Override 417 | public String toString() { 418 | return super.toString() + "[" + operationId + "]"; 419 | } 420 | } 421 | --------------------------------------------------------------------------------