Skip to content

Commit

Permalink
Merge 55b2b5a into 61e002c
Browse files Browse the repository at this point in the history
  • Loading branch information
chanjarster committed Nov 11, 2019
2 parents 61e002c + 55b2b5a commit 01a31b9
Show file tree
Hide file tree
Showing 106 changed files with 213 additions and 183 deletions.
Expand Up @@ -28,7 +28,7 @@
import static java.util.Collections.singletonList;

/**
* 不允许在requestBody.content.'mediaType'.encoding.'encoding'.headers 下添加Header Object
* Adding Header Object under requestBody.content.'mediaType'.encoding.'encoding'.headers is not allowed
*/
public class HeaderAddInRequestBodyNotAllowedDiffValidator extends OasObjectDiffValidatorTemplate<Header>
implements HeaderDiffValidator {
Expand Down
Expand Up @@ -28,7 +28,7 @@
import static java.util.Collections.singletonList;

/**
* 不允许在responses.'response'.headers.headers 下删除Header Object
* Deleting Header Object under responses.'response'.headers.headers is not allowed
*/
public class HeaderDelInResponseNotAllowedDiffValidator extends OasObjectDiffValidatorTemplate<Header>
implements HeaderDiffValidator {
Expand Down
Expand Up @@ -28,7 +28,7 @@
import static java.util.Collections.singletonList;

/**
* 不允许在Parameter.content下添加MediaType
* Adding MediaType Object under Parameter.content is not allowed
*/
public class MediaTypeAddInParameterNotAllowedDiffValidator
extends OasObjectDiffValidatorTemplate<MediaType>
Expand Down
Expand Up @@ -28,7 +28,7 @@
import static java.util.Collections.singletonList;

/**
* 不允许在Parameter.content下删除MediaType
* Deleting MediaType Object under Parameter.content is not allowed
*/
public class MediaTypeDelInParameterNotAllowedDiffValidator
extends OasObjectDiffValidatorTemplate<MediaType>
Expand Down
Expand Up @@ -28,7 +28,7 @@
import static java.util.Collections.singletonList;

/**
* 不允许在RequestBody.content下删除MediaType
* Deleting MediaType Object under RequestBody.content is not allowed
*/
public class MediaTypeDelInRequestBodyNotAllowedDiffValidator
extends OasObjectDiffValidatorTemplate<MediaType>
Expand Down
Expand Up @@ -28,7 +28,7 @@
import static java.util.Collections.singletonList;

/**
* 不允许在responses.'response'.content.'mediaType' 下删除Header Object
* Deleting MediaType Object under responses.'response'.content.'mediaType' is not allowed
*/
public class MediaTypeDelInResponseNotAllowedDiffValidator
extends OasObjectDiffValidatorTemplate<MediaType>
Expand Down
Expand Up @@ -34,7 +34,7 @@
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;

/**
* 仅允许false->true的修改
* Parameter.allowEmpty only allow change false->true
*/
public class ParameterAllowEmptyValueChangeDiffValidator
extends OasObjectDiffValidatorTemplate<Parameter>
Expand Down
Expand Up @@ -34,7 +34,7 @@
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;

/**
* 仅允许false->true的修改
* Parameter.allowReserved only allow change false->true
*/
public class ParameterAllowReservedChangeDiffValidator
extends OasObjectDiffValidatorTemplate<Parameter>
Expand Down
Expand Up @@ -34,7 +34,7 @@
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;

/**
* 仅允许true->false的修改
* Parameter.required only allow change true->false
*/
public class ParameterRequiredChangeDiffValidator
extends OasObjectDiffValidatorTemplate<Parameter>
Expand Down
Expand Up @@ -33,7 +33,7 @@
import static java.util.Collections.singletonList;

/**
* 仅允许true->false的修改
* RequestBody.required only allow change true->false
*/
public class RequestBodyRequiredChangeDiffValidator
extends OasObjectDiffValidatorTemplate<RequestBody>
Expand Down
Expand Up @@ -27,7 +27,7 @@
import static java.util.Collections.singletonList;

/**
* 不允许在responses.'http status code'.下新增 Response Object
* Adding Response Object under responses.'http status code' is not allowed
*/
public class ResponseAddNotAllowedDiffValidator
extends OasObjectDiffValidatorTemplate<ApiResponse>
Expand Down
Expand Up @@ -30,7 +30,7 @@

public class SchemaEnumChangeInRequestValidator extends SchemaPropertyChangeValidator<List> {

public static final String VIOLATION_MESSAGE = "delete enum on right side is not allowed";
public static final String VIOLATION_MESSAGE = "deleting enum on right side is not allowed";

@Override
protected List getProperty(Schema schema) {
Expand Down
Expand Up @@ -30,7 +30,7 @@

public class SchemaRequiredChangeInRequestValidator extends SchemaPropertyChangeValidator<List<String>> {

public static final String VIOLATION_MESSAGE = "add required fields is not allowed on right side";
public static final String VIOLATION_MESSAGE = "adding required fields is not allowed on right side";

@Override
protected List<String> getProperty(Schema schema) {
Expand Down
Expand Up @@ -29,7 +29,7 @@

public class SchemaEnumChangeInResponseValidator extends SchemaPropertyChangeValidator<List> {

public static final String VIOLATION_MESSAGE = "add enum on right side is not allowed";
public static final String VIOLATION_MESSAGE = "adding enum on right side is not allowed";

@Override
protected List getProperty(Schema schema) {
Expand Down
Expand Up @@ -29,7 +29,7 @@

public class SchemaRequiredChangeInResponseValidator extends SchemaPropertyChangeValidator<List<String>> {

public static final String VIOLATION_MESSAGE = "delete required fields is not allowed on right side";
public static final String VIOLATION_MESSAGE = "deleting required fields is not allowed on right side";

@Override
protected List<String> getProperty(Schema schema) {
Expand Down
Expand Up @@ -24,9 +24,9 @@

/**
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#headerObject">Header Object</a>
* .description属性校验器
* .description property validator
* <ul>
* <li>必须填写</li>
* <li>must not be null</li>
* </ul>
*/
public class HeaderDescriptionRequiredValidator
Expand Down
Expand Up @@ -23,10 +23,10 @@
import io.swagger.v3.oas.models.info.Info;

/**
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#infoObject">Info Object</a>属性校验器
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#infoObject">Info Object</a>
* property validator
* <ul>
* <li>description必须填写</li>
* <li>version必须和Api版本一致</li>
* <li>description must not be null</li>
* </ul>
*/
public class InfoDescriptionRequiredValidator
Expand Down
Expand Up @@ -33,7 +33,7 @@

/**
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#openapi-object">OpenAPI Object</a>
* .security属性校验器
* .security property validator
* <ul>
* <li>This field is not allowed</li>
* </ul>
Expand Down
Expand Up @@ -32,9 +32,10 @@

/**
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#openapi-object">OpenAPI Object</a>
* .tags(List of <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#tagObject">Tag Object</a>)大小校验器
* .tags(List of <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#tagObject">Tag Object</a>)
* not empty validator
* <ul>
* <li>数量至少为一</li>
* <li>at least one</li>
* </ul>
*/
public class OpenApiTagNotEmptyValidator implements OpenApiValidator {
Expand Down
Expand Up @@ -28,9 +28,9 @@

/**
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#openapi-object">OpenAPI Object</a>
* .openapi属性校验器
* .openapi property validator
* <ul>
* <li>必须为3.0.x且>=3.0.2</li>
* <li>must be 3.0.x and >=3.0.2</li>
* </ul>
*/
public class OpenApiVersionValidator implements OpenApiValidator {
Expand Down
Expand Up @@ -29,7 +29,9 @@

/**
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#operationObject">Operation Object</a>
* operationId. 属性校验器lower camel case
* .operationId property validator
* <ul>
* <li>should be lower camel case</li>
* </ul>
*/
public class OperationIdLowerCamelCaseValidator implements OperationValidator {
Expand Down
Expand Up @@ -33,7 +33,7 @@

/**
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#operationObject">Operation Object</a>
* .servers属性校验器
* .servers property validator
* <ul>
* <li>This field is not allowed</li>
* </ul>
Expand Down
Expand Up @@ -24,9 +24,9 @@

/**
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#operationObject">Operation Object</a>
* .summary属性校验器
* .summary property validator
* <ul>
* <li>必填</li>
* <li>is field is required</li>
* </ul>
*/
public class OperationSummaryRequiredValidator
Expand Down
Expand Up @@ -31,10 +31,9 @@

/**
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#operationObject">Operation Object</a>
* .tags属性校验器
* .tags property validator
* <ul>
* <li>必须写一个</li>
* <li>必须在OpenAPI Object的tags属性里有对应property: description,rule:必填</li>
* <li>at least one</li>
* </ul>
*/
public class OperationTagsOnlyOneValidator implements OperationValidator {
Expand Down
Expand Up @@ -36,9 +36,9 @@

/**
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#operationObject">Operation Object</a>
* .tags属性校验器
* .tags property validator
* <ul>
* <li>必须在OpenAPI Object的tags属性里有对应</li>
* <li>must be defined in OpenAPI Object tags property</li>
* </ul>
*/
public class OperationTagsReferenceValidator implements OperationValidator {
Expand Down
Expand Up @@ -30,9 +30,9 @@

/**
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#parameterObject">Parameter Object</a>
* .name 属性校验器
* .name property validator
* <ul>
* <li>如果in=cookie,必须lower camel case</li>
* <li>must be lower camel case</li>
* </ul>
*/
public class ParameterCookieLowerCamelCaseValidator implements ParameterValidator {
Expand Down
Expand Up @@ -24,9 +24,9 @@

/**
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#parameterObject">Parameter Object</a>
* .description 属性校验器
* .description property validator
* <ul>
* <li>Required</li>
* <li>this field is required</li>
* </ul>
*/
public class ParameterDescriptionRequiredValidator
Expand Down
Expand Up @@ -30,9 +30,9 @@

/**
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#parameterObject">Parameter Object</a>
* .name 属性校验器
* .name property validator
* <ul>
* <li>如果in=header,必须是upper hyphen case</li>
* <li>must be upper hyphen case</li>
* </ul>
*/
public class ParameterHeaderUpperHyphenCaseValidator implements ParameterValidator {
Expand Down
Expand Up @@ -30,9 +30,9 @@

/**
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#parameterObject">Parameter Object</a>
* .name 属性校验器
* .name property validator
* <ul>
* <li>如果in=path,必须lower camel case</li>
* <li>must be lower camel case</li>
* </ul>
*/
public class ParameterPathLowerCamelCaseValidator implements ParameterValidator {
Expand Down
Expand Up @@ -30,9 +30,9 @@

/**
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#parameterObject">Parameter Object</a>
* .name 属性校验器
* .name property validator
* <ul>
* <li>如果in=query,必须lower camel case</li>
* <li>must be lower camel case</li>
* </ul>
*/
public class ParameterQueryLowerCamelCaseValidator implements ParameterValidator {
Expand Down
Expand Up @@ -35,9 +35,14 @@
import static org.apache.servicecomb.toolkit.oasv.util.StringCaseUtils.isLowerCamelCase;

/**
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#pathsObject">Paths Object</a>lower camel case校验器
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#pathsObject">Paths Object</a>
* path name validator
* <ul>
* <li>path name must be lower camel case</li>
* </ul>
* <p>
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#path-templating">Path Templating</a>的变量也要是lower camel case的
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#path-templating">Path Templating</a>
* variable also must be lower camel case
* </p>
*/
public class PathsLowerCamelCaseValidator implements PathsValidator {
Expand Down
Expand Up @@ -24,9 +24,9 @@

/**
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#request-body-object">Request Object</a>
* .description 属性校验器
* .description property validator
* <ul>
* <li>Required</li>
* <li>this field is required</li>
* </ul>
*/
public class RequestBodyDescriptionRequiredValidator
Expand Down
Expand Up @@ -32,13 +32,15 @@
import static java.util.Collections.singletonList;

/**
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#schemaObject">Schema Object</a>.title属性校验器
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#schemaObject">Schema Object</a>
* .title property validator
* <ul>
* <li>如果Schema Object的上级是
* <li>
* if this Schema Object's parent is
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#schemaObject">Schema Object</a>
* /
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#componentsObject">Components Object</a>
* ,那么必须写title</li>
* , then title property is required</li>
* </ul>
*/
public class SchemaTitleValidator extends SchemaRecursiveValidatorTemplate {
Expand Down
Expand Up @@ -24,9 +24,9 @@

/**
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#tagObject">Tag Object</a>
* .description 属性校验器
* .description property validator
* <ul>
* <li>必填</li>
* <li>this field is required</li>
* </ul>
*/
public class TagDescriptionRequiredValidator
Expand Down
Expand Up @@ -29,9 +29,9 @@

/**
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#tagObject">Tag Object</a>
* .name属性校验器
* .name property validator
* <ul>
* <li>upper camel case</li>
* <li>must be upper camel case</li>
* </ul>
*/
public class TagNameUpperCamelCaseValidator implements TagValidator {
Expand Down
Expand Up @@ -33,9 +33,12 @@
import static java.util.Collections.emptySet;

/**
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#tagObject">Tag Object</a>引用情况校验器
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#tagObject">Tag Object</a>
* referencing validator
* <ul>
* <li>不得存在没有被<a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#operationObject">Operation Object</a>引用的<a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#tagObject">Tag Object</a></li>
* <li>
* Every tag object must be referenced by <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#operationObject">Operation Object</a>
* </li>
* </ul>
*/
public class TagReferenceValidator implements TagValidator {
Expand Down

0 comments on commit 01a31b9

Please sign in to comment.