Repository: apache/servicecomb-toolkit
Branch: master
Commit: 03b709c7dfe9
Files: 1059
Total size: 2.4 MB
Directory structure:
gitextract_jkg1t5v4/
├── .gitignore
├── LICENSE
├── NOTICE
├── README-ZH.md
├── README.md
├── cli/
│ ├── pom.xml
│ ├── scripts/
│ │ ├── cli.cmd
│ │ └── cli.sh
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── org/
│ │ │ └── apache/
│ │ │ └── servicecomb/
│ │ │ └── toolkit/
│ │ │ └── cli/
│ │ │ ├── CheckCompatibility.java
│ │ │ ├── CheckCompatibilityAbbr.java
│ │ │ ├── CheckCompatibilityBase.java
│ │ │ ├── CheckStyle.java
│ │ │ ├── CheckStyleAbbr.java
│ │ │ ├── CheckStyleBase.java
│ │ │ ├── CodeGenerate.java
│ │ │ ├── DocGenerate.java
│ │ │ ├── ToolkitMain.java
│ │ │ └── ValidationFailedException.java
│ │ └── resources/
│ │ ├── application.properties
│ │ └── log4j2.xml
│ └── test/
│ ├── java/
│ │ └── org/
│ │ └── apache/
│ │ └── servicecomb/
│ │ └── toolkit/
│ │ └── cli/
│ │ └── CliTest.java
│ └── resources/
│ ├── contracts/
│ │ ├── CalculateEndpoint.yaml
│ │ ├── HelloEndPoint.yaml
│ │ └── pojo/
│ │ └── CodeFirstHelloEndPoint.yaml
│ ├── log4j2-test.xml
│ ├── oas/
│ │ ├── compatibility-left.yaml
│ │ ├── compatibility-right.yaml
│ │ ├── style-rules.properties
│ │ └── style.yaml
│ └── swagger.yaml
├── codegen/
│ ├── pom.xml
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── org/
│ │ │ └── apache/
│ │ │ └── servicecomb/
│ │ │ └── toolkit/
│ │ │ └── codegen/
│ │ │ ├── AbstractConsumerDirectoryStrategy.java
│ │ │ ├── AbstractDirectoryStrategy.java
│ │ │ ├── AbstractJavaCodegenExt.java
│ │ │ ├── AbstractMultiDirectoryStrategy.java
│ │ │ ├── AbstractProviderDirectoryStrategy.java
│ │ │ ├── ConsumerDirectoryStrategy.java
│ │ │ ├── DefaultCodeGenerator.java
│ │ │ ├── DefaultDirectoryStrategy.java
│ │ │ ├── DirectoryStrategy.java
│ │ │ ├── GeneratorExternalConfigConstant.java
│ │ │ ├── GetGenericClassTypeLambda.java
│ │ │ ├── GetRelativeBasePathLambda.java
│ │ │ ├── MicroServiceFramework.java
│ │ │ ├── MultiContractGenerator.java
│ │ │ ├── ProjectMetaConstant.java
│ │ │ ├── ProviderDirectoryStrategy.java
│ │ │ ├── ServiceCombCodegen.java
│ │ │ ├── ServiceType.java
│ │ │ ├── ShowBasePathLambda.java
│ │ │ ├── SpringCloudCodegen.java
│ │ │ ├── SpringCloudConsumerDirectoryStrategy.java
│ │ │ ├── SpringCloudMultiDirectoryStrategy.java
│ │ │ └── SpringCloudProviderDirectoryStrategy.java
│ │ └── resources/
│ │ ├── META-INF/
│ │ │ └── services/
│ │ │ ├── org.apache.servicecomb.toolkit.CodeGenerator
│ │ │ └── org.openapitools.codegen.CodegenConfig
│ │ ├── ServiceComb/
│ │ │ ├── consumer/
│ │ │ │ ├── Application.mustache
│ │ │ │ ├── apiConsumer.mustache
│ │ │ │ ├── bodyParamsConsumer.mustache
│ │ │ │ ├── formParamsConsumer.mustache
│ │ │ │ ├── headerParamsConsumer.mustache
│ │ │ │ ├── microservice.mustache
│ │ │ │ ├── pathParamsConsumer.mustache
│ │ │ │ ├── pojo/
│ │ │ │ │ ├── apiConsumer.mustache
│ │ │ │ │ └── apiInterface.mustache
│ │ │ │ ├── pom.mustache
│ │ │ │ ├── queryParamsConsumer.mustache
│ │ │ │ └── springboot/
│ │ │ │ ├── Application.mustache
│ │ │ │ └── pom.mustache
│ │ │ ├── enumClass.mustache
│ │ │ ├── enumOuterClass.mustache
│ │ │ ├── libraries/
│ │ │ │ ├── JAX-RS/
│ │ │ │ │ ├── Application.mustache
│ │ │ │ │ ├── api.mustache
│ │ │ │ │ ├── bodyParams.mustache
│ │ │ │ │ ├── formParams.mustache
│ │ │ │ │ ├── headerParams.mustache
│ │ │ │ │ ├── pathParams.mustache
│ │ │ │ │ ├── pom.mustache
│ │ │ │ │ └── queryParams.mustache
│ │ │ │ ├── POJO/
│ │ │ │ │ ├── Application.mustache
│ │ │ │ │ ├── api.mustache
│ │ │ │ │ ├── bodyParams.mustache
│ │ │ │ │ ├── formParams.mustache
│ │ │ │ │ ├── headerParams.mustache
│ │ │ │ │ ├── pathParams.mustache
│ │ │ │ │ ├── pom.mustache
│ │ │ │ │ └── queryParams.mustache
│ │ │ │ ├── SpringBoot/
│ │ │ │ │ ├── Application.mustache
│ │ │ │ │ ├── api.mustache
│ │ │ │ │ ├── bodyParams.mustache
│ │ │ │ │ ├── formParams.mustache
│ │ │ │ │ ├── headerParams.mustache
│ │ │ │ │ ├── operationMethod.mustache
│ │ │ │ │ ├── pathParams.mustache
│ │ │ │ │ ├── pom.mustache
│ │ │ │ │ └── queryParams.mustache
│ │ │ │ └── SpringMVC/
│ │ │ │ ├── Application.mustache
│ │ │ │ ├── api.mustache
│ │ │ │ ├── bodyParams.mustache
│ │ │ │ ├── formParams.mustache
│ │ │ │ ├── headerParams.mustache
│ │ │ │ ├── pathParams.mustache
│ │ │ │ ├── pom.mustache
│ │ │ │ └── queryParams.mustache
│ │ │ ├── log4j2.mustache
│ │ │ ├── model/
│ │ │ │ ├── model.mustache
│ │ │ │ └── pom.mustache
│ │ │ ├── pojo.mustache
│ │ │ ├── project/
│ │ │ │ └── pom.mustache
│ │ │ ├── provider/
│ │ │ │ └── microservice.mustache
│ │ │ └── returnTypes.mustache
│ │ └── SpringCloud/
│ │ ├── consumer/
│ │ │ └── openfeign/
│ │ │ ├── Application.mustache
│ │ │ ├── apiConsumer.mustache
│ │ │ ├── applicationYml.mustache
│ │ │ ├── bodyParamsConsumer.mustache
│ │ │ ├── formParamsConsumer.mustache
│ │ │ ├── headerParamsConsumer.mustache
│ │ │ ├── pathParamsConsumer.mustache
│ │ │ ├── pom.mustache
│ │ │ └── queryParamsConsumer.mustache
│ │ ├── model/
│ │ │ ├── enumClass.mustache
│ │ │ ├── enumOuterClass.mustache
│ │ │ ├── model.mustache
│ │ │ ├── pojo.mustache
│ │ │ └── pom.mustache
│ │ ├── project/
│ │ │ └── pom.mustache
│ │ └── provider/
│ │ └── servlet/
│ │ ├── Application.mustache
│ │ ├── api.mustache
│ │ ├── applicationYml.mustache
│ │ ├── bodyParams.mustache
│ │ ├── formParams.mustache
│ │ ├── headerParams.mustache
│ │ ├── pathParams.mustache
│ │ ├── pom.mustache
│ │ ├── queryParams.mustache
│ │ └── returnTypes.mustache
│ └── test/
│ ├── java/
│ │ └── org/
│ │ └── apache/
│ │ └── servicecomb/
│ │ └── toolkit/
│ │ └── codegen/
│ │ ├── CustomPropertiesTest.java
│ │ ├── GeneratorTest.java
│ │ ├── ReflectUtils.java
│ │ ├── ServiceCombCodegenTest.java
│ │ ├── SpringCloudCodegenTest.java
│ │ └── TemplateTest.java
│ └── resources/
│ ├── examples/
│ │ ├── v2.0/
│ │ │ ├── json/
│ │ │ │ ├── api-with-examples.json
│ │ │ │ ├── petstore-expanded.json
│ │ │ │ ├── petstore-minimal.json
│ │ │ │ ├── petstore-separate/
│ │ │ │ │ ├── common/
│ │ │ │ │ │ └── Error.json
│ │ │ │ │ └── spec/
│ │ │ │ │ ├── NewPet.json
│ │ │ │ │ ├── Pet.json
│ │ │ │ │ ├── parameters.json
│ │ │ │ │ └── swagger.json
│ │ │ │ ├── petstore-simple.json
│ │ │ │ ├── petstore-with-external-docs.json
│ │ │ │ ├── petstore.json
│ │ │ │ └── uber.json
│ │ │ └── yaml/
│ │ │ ├── api-with-examples.yaml
│ │ │ ├── petstore-expanded.yaml
│ │ │ ├── petstore-minimal.yaml
│ │ │ ├── petstore-separate/
│ │ │ │ ├── common/
│ │ │ │ │ └── Error.yaml
│ │ │ │ └── spec/
│ │ │ │ ├── NewPet.yaml
│ │ │ │ ├── Pet.yaml
│ │ │ │ ├── parameters.yaml
│ │ │ │ └── swagger.yaml
│ │ │ ├── petstore-simple.yaml
│ │ │ ├── petstore-with-external-docs.yaml
│ │ │ ├── petstore.yaml
│ │ │ └── uber.yaml
│ │ └── v3.0/
│ │ ├── api-with-examples.yaml
│ │ ├── callback-example.yaml
│ │ ├── link-example.yaml
│ │ ├── petstore-expanded.yaml
│ │ ├── petstore.yaml
│ │ └── uspto.yaml
│ ├── log4j2-test.xml
│ ├── no-model.yaml
│ ├── swagger.yaml
│ └── with-model.yaml
├── common/
│ ├── pom.xml
│ └── src/
│ ├── main/
│ │ └── java/
│ │ └── org/
│ │ └── apache/
│ │ └── servicecomb/
│ │ └── toolkit/
│ │ └── common/
│ │ ├── ClassMaker.java
│ │ ├── CompareAlgorithm.java
│ │ ├── ComparisionType.java
│ │ ├── Comparison.java
│ │ ├── ContractComparator.java
│ │ ├── ContractFileType.java
│ │ ├── DocumentType.java
│ │ ├── FileUtils.java
│ │ ├── ImmediateClassLoader.java
│ │ ├── MyersAlgorithm.java
│ │ ├── SourceType.java
│ │ └── SplitDiffFormatter.java
│ └── test/
│ ├── java/
│ │ └── org/
│ │ └── apache/
│ │ └── servicecomb/
│ │ └── toolkit/
│ │ └── common/
│ │ ├── ClassMakerTest.java
│ │ ├── FileUtilsTest.java
│ │ └── TextCompareTest.java
│ └── resources/
│ ├── compare/
│ │ ├── HelloEndPoint.yaml
│ │ └── HelloEndPoint2.yaml
│ └── projects/
│ ├── demo-with-correct-pom/
│ │ └── pom.xml
│ └── demo-with-invaild-pom/
│ └── pom.xml
├── contractgen/
│ ├── pom.xml
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── org/
│ │ │ └── apache/
│ │ │ └── servicecomb/
│ │ │ └── toolkit/
│ │ │ └── contractgen/
│ │ │ └── DefaultContractsGenerator.java
│ │ └── resources/
│ │ └── META-INF/
│ │ └── services/
│ │ └── org.apache.servicecomb.toolkit.ContractsGenerator
│ └── test/
│ ├── java/
│ │ └── org/
│ │ └── apache/
│ │ └── servicecomb/
│ │ └── toolkit/
│ │ └── contractgen/
│ │ ├── ContractTestUtil.java
│ │ └── DefaultContractsGeneratorTest.java
│ ├── projects/
│ │ └── demo/
│ │ ├── pom.xml
│ │ └── src/
│ │ └── main/
│ │ └── java/
│ │ └── demo/
│ │ ├── Application.java
│ │ └── HelloEndPoint.java
│ └── resources/
│ └── log4j2-test.xml
├── core/
│ ├── pom.xml
│ └── src/
│ └── main/
│ └── java/
│ └── org/
│ └── apache/
│ └── servicecomb/
│ └── toolkit/
│ ├── CodeGenerator.java
│ ├── ContractsGenerator.java
│ ├── DocGenerator.java
│ ├── Generator.java
│ └── GeneratorFactory.java
├── docgen/
│ ├── pom.xml
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── org/
│ │ │ └── apache/
│ │ │ └── servicecomb/
│ │ │ └── toolkit/
│ │ │ └── docgen/
│ │ │ └── ContractsSwaggerUIGenerator.java
│ │ └── resources/
│ │ ├── META-INF/
│ │ │ └── services/
│ │ │ └── org.apache.servicecomb.toolkit.DocGenerator
│ │ └── webroot/
│ │ └── swagger-ui.html
│ └── test/
│ ├── java/
│ │ └── org/
│ │ └── apache/
│ │ └── servicecomb/
│ │ └── toolkit/
│ │ └── docgen/
│ │ └── ContractsSwaggerUIGeneratorTest.java
│ └── resources/
│ └── HelloEndPoint.yaml
├── integration-tests/
│ ├── coverage-aggregate/
│ │ └── pom.xml
│ └── pom.xml
├── oas-generator/
│ ├── oas-generator-core/
│ │ ├── pom.xml
│ │ └── src/
│ │ ├── main/
│ │ │ └── java/
│ │ │ └── org/
│ │ │ └── apache/
│ │ │ └── servicecomb/
│ │ │ └── toolkit/
│ │ │ └── generator/
│ │ │ ├── HttpStatuses.java
│ │ │ ├── MediaTypes.java
│ │ │ ├── annotation/
│ │ │ │ ├── AnnotationProcessor.java
│ │ │ │ ├── ApiResponseMethodAnnotationProcessor.java
│ │ │ │ ├── ApiResponsesMethodAnnotationProcessor.java
│ │ │ │ ├── ClassAnnotationProcessor.java
│ │ │ │ ├── MethodAnnotationProcessor.java
│ │ │ │ ├── ModelInterceptor.java
│ │ │ │ ├── OpenApiDefinitionClassAnnotationProcessor.java
│ │ │ │ ├── OperationMethodAnnotationProcessor.java
│ │ │ │ ├── ParamAnnotationProcessor.java
│ │ │ │ ├── ParameterAnnotationProcessor.java
│ │ │ │ └── RequestBodyParamAnnotationProcessor.java
│ │ │ ├── context/
│ │ │ │ ├── Context.java
│ │ │ │ ├── IExtensionsContext.java
│ │ │ │ ├── ISchemaContext.java
│ │ │ │ ├── OasContext.java
│ │ │ │ ├── OasGenerator.java
│ │ │ │ ├── OperationContext.java
│ │ │ │ └── ParameterContext.java
│ │ │ ├── parser/
│ │ │ │ ├── AbstractAnnotationParser.java
│ │ │ │ └── api/
│ │ │ │ └── OpenApiAnnotationParser.java
│ │ │ └── util/
│ │ │ ├── ArrayModelConverter.java
│ │ │ ├── LocalVariableVisitor.java
│ │ │ ├── ModelConverter.java
│ │ │ ├── ParamUtils.java
│ │ │ ├── RequestResponse.java
│ │ │ └── SwaggerAnnotationUtils.java
│ │ └── test/
│ │ └── java/
│ │ └── org/
│ │ └── apache/
│ │ └── servicecomb/
│ │ └── toolkit/
│ │ └── generator/
│ │ ├── AnnotationProcessorTest.java
│ │ ├── ContextTest.java
│ │ ├── OasGeneratorTest.java
│ │ ├── ParserTest.java
│ │ └── UtilsTest.java
│ ├── oas-generator-jaxrs/
│ │ ├── pom.xml
│ │ └── src/
│ │ ├── main/
│ │ │ ├── java/
│ │ │ │ └── org/
│ │ │ │ └── apache/
│ │ │ │ └── servicecomb/
│ │ │ │ └── toolkit/
│ │ │ │ └── generator/
│ │ │ │ ├── annotation/
│ │ │ │ │ ├── ConsumesAnnotationProcessor.java
│ │ │ │ │ ├── CookieParamAnnotationProcessor.java
│ │ │ │ │ ├── FormParamAnnotationProcessor.java
│ │ │ │ │ ├── HeaderParamAnnotationProcessor.java
│ │ │ │ │ ├── HttpMethodAnnotationProcessor.java
│ │ │ │ │ ├── PathClassAnnotationProcessor.java
│ │ │ │ │ ├── PathMethodAnnotationProcessor.java
│ │ │ │ │ ├── PathParamAnnotationProcessor.java
│ │ │ │ │ └── QueryParamAnnotationProcessor.java
│ │ │ │ └── parser/
│ │ │ │ └── JaxRsAnnotationParser.java
│ │ │ └── resources/
│ │ │ └── META-INF/
│ │ │ └── services/
│ │ │ └── org.apache.servicecomb.toolkit.generator.parser.api.OpenApiAnnotationParser
│ │ └── test/
│ │ └── java/
│ │ └── org/
│ │ └── apache/
│ │ └── servicecomb/
│ │ └── toolkit/
│ │ └── generator/
│ │ ├── JaxrsAnnotationProcessorTest.java
│ │ └── JaxrsParserTest.java
│ ├── oas-generator-servicecomb/
│ │ ├── pom.xml
│ │ └── src/
│ │ ├── main/
│ │ │ ├── java/
│ │ │ │ └── org/
│ │ │ │ └── apache/
│ │ │ │ └── servicecomb/
│ │ │ │ └── toolkit/
│ │ │ │ └── generator/
│ │ │ │ └── parser/
│ │ │ │ ├── ServicecombJaxrsParser.java
│ │ │ │ ├── ServicecombPojoParser.java
│ │ │ │ └── ServicecombSpringmvcParser.java
│ │ │ └── resources/
│ │ │ └── META-INF/
│ │ │ └── services/
│ │ │ └── org.apache.servicecomb.toolkit.generator.parser.api.OpenApiAnnotationParser
│ │ └── test/
│ │ └── java/
│ │ └── org/
│ │ └── apache/
│ │ └── servicecomb/
│ │ └── toolkit/
│ │ └── generator/
│ │ └── ServiceCombParserTest.java
│ ├── oas-generator-spring/
│ │ ├── pom.xml
│ │ └── src/
│ │ ├── main/
│ │ │ ├── java/
│ │ │ │ └── org/
│ │ │ │ └── apache/
│ │ │ │ └── servicecomb/
│ │ │ │ └── toolkit/
│ │ │ │ └── generator/
│ │ │ │ ├── MultipartFileInterceptor.java
│ │ │ │ ├── annotation/
│ │ │ │ │ ├── AbstractHttpMethodMappingAnnotationProcessor.java
│ │ │ │ │ ├── DeleteMappingMethodAnnotationProcessor.java
│ │ │ │ │ ├── GetMappingMethodAnnotationProcessor.java
│ │ │ │ │ ├── PathVariableAnnotationProcessor.java
│ │ │ │ │ ├── PostMappingMethodAnnotationProcessor.java
│ │ │ │ │ ├── PutMappingMethodAnnotationProcessor.java
│ │ │ │ │ ├── RequestBodyAnnotationProcessor.java
│ │ │ │ │ ├── RequestHeaderAnnotationProcessor.java
│ │ │ │ │ ├── RequestMappingClassAnnotationProcessor.java
│ │ │ │ │ ├── RequestMappingMethodAnnotationProcessor.java
│ │ │ │ │ ├── RequestParamAnnotationProcessor.java
│ │ │ │ │ └── RequestPartAnnotationProcessor.java
│ │ │ │ └── parser/
│ │ │ │ └── SpringmvcAnnotationParser.java
│ │ │ └── resources/
│ │ │ └── META-INF/
│ │ │ └── services/
│ │ │ ├── org.apache.servicecomb.toolkit.generator.annotation.ModelInterceptor
│ │ │ └── org.apache.servicecomb.toolkit.generator.parser.api.OpenApiAnnotationParser
│ │ └── test/
│ │ └── java/
│ │ └── org/
│ │ └── apache/
│ │ └── servicecomb/
│ │ └── toolkit/
│ │ └── generator/
│ │ ├── SpringAnnotationProcessorTest.java
│ │ └── SpringParserTest.java
│ └── pom.xml
├── oas-validator/
│ ├── .gitignore
│ ├── README-ZH.md
│ ├── README.md
│ ├── doc/
│ │ ├── INSTALLATION.MD
│ │ └── USAGE.MD
│ ├── oas-validator-compatibility/
│ │ ├── pom.xml
│ │ └── src/
│ │ ├── main/
│ │ │ └── java/
│ │ │ └── org/
│ │ │ └── apache/
│ │ │ └── servicecomb/
│ │ │ └── toolkit/
│ │ │ └── oasv/
│ │ │ └── compatibility/
│ │ │ ├── CompatibilityCheckParser.java
│ │ │ ├── factory/
│ │ │ │ ├── DefaultCallbackDiffValidatorFactory.java
│ │ │ │ ├── DefaultComponentsDiffValidatorFactory.java
│ │ │ │ ├── DefaultEncodingDiffValidatorFactory.java
│ │ │ │ ├── DefaultHeaderDiffValidatorFactory.java
│ │ │ │ ├── DefaultInfoDiffValidatorFactory.java
│ │ │ │ ├── DefaultLinkDiffValidatorFactory.java
│ │ │ │ ├── DefaultMediaTypeDiffValidatorFactory.java
│ │ │ │ ├── DefaultOasSpecDiffValidatorFactory.java
│ │ │ │ ├── DefaultOpenApiDiffValidatorFactory.java
│ │ │ │ ├── DefaultOperationDiffValidatorFactory.java
│ │ │ │ ├── DefaultParameterDiffValidatorFactory.java
│ │ │ │ ├── DefaultPathItemDiffValidatorFactory.java
│ │ │ │ ├── DefaultPathsDiffValidatorFactory.java
│ │ │ │ ├── DefaultRequestBodyDiffValidatorFactory.java
│ │ │ │ ├── DefaultResponseDiffValidatorFactory.java
│ │ │ │ ├── DefaultResponsesDiffValidatorFactory.java
│ │ │ │ ├── DefaultSchemaDiffValidatorFactory.java
│ │ │ │ ├── DefaultSecuritySchemeDiffValidatorFactory.java
│ │ │ │ ├── DefaultServerDiffValidatorFactory.java
│ │ │ │ └── DefaultTagDiffValidatorFactory.java
│ │ │ └── validators/
│ │ │ ├── encoding/
│ │ │ │ ├── EncodingAddNotAllowedDiffValidator.java
│ │ │ │ ├── EncodingAllowedReservedChangeDiffValidator.java
│ │ │ │ ├── EncodingContentTypeNotSameDiffValidator.java
│ │ │ │ ├── EncodingDelNotAllowedDiffValidator.java
│ │ │ │ ├── EncodingExplodeNotSameDiffValidator.java
│ │ │ │ └── EncodingStyleNotSameDiffValidator.java
│ │ │ ├── header/
│ │ │ │ ├── HeaderAddInRequestBodyNotAllowedDiffValidator.java
│ │ │ │ └── HeaderDelInResponseNotAllowedDiffValidator.java
│ │ │ ├── mediatype/
│ │ │ │ ├── MediaTypeAddInParameterNotAllowedDiffValidator.java
│ │ │ │ ├── MediaTypeDelInParameterNotAllowedDiffValidator.java
│ │ │ │ ├── MediaTypeDelInRequestBodyNotAllowedDiffValidator.java
│ │ │ │ └── MediaTypeDelInResponseNotAllowedDiffValidator.java
│ │ │ ├── operation/
│ │ │ │ ├── OperationDeleteNotAllowedDiffValidator.java
│ │ │ │ └── OperationIdNotSameDiffValidator.java
│ │ │ ├── parameter/
│ │ │ │ ├── ParameterAddDiffValidator.java
│ │ │ │ ├── ParameterAllowEmptyValueChangeDiffValidator.java
│ │ │ │ ├── ParameterAllowReservedChangeDiffValidator.java
│ │ │ │ ├── ParameterExplodeNotSameDiffValidator.java
│ │ │ │ ├── ParameterRequiredChangeDiffValidator.java
│ │ │ │ └── ParameterStyleNotSameDiffValidator.java
│ │ │ ├── pathitem/
│ │ │ │ └── PathItemDeleteNotAllowedDiffValidator.java
│ │ │ ├── requestbody/
│ │ │ │ └── RequestBodyRequiredChangeDiffValidator.java
│ │ │ ├── response/
│ │ │ │ └── ResponseAddNotAllowedDiffValidator.java
│ │ │ └── schema/
│ │ │ ├── SchemaDiscriminatorChangeValidator.java
│ │ │ ├── SchemaPropertyChangeValidator.java
│ │ │ ├── SchemaReadOnlyChangeValidator.java
│ │ │ ├── SchemaTypeFormatChangeValidator.java
│ │ │ ├── SchemaWriteOnlyChangeValidator.java
│ │ │ ├── SchemaXmlChangeValidator.java
│ │ │ ├── TypeFormat.java
│ │ │ ├── request/
│ │ │ │ ├── SchemaEnumChangeInRequestValidator.java
│ │ │ │ ├── SchemaExclusiveMaximumChangeInRequestValidator.java
│ │ │ │ ├── SchemaExclusiveMinimumChangeInRequestValidator.java
│ │ │ │ ├── SchemaMaxItemsChangeInRequestValidator.java
│ │ │ │ ├── SchemaMaxLengthChangeInRequestValidator.java
│ │ │ │ ├── SchemaMaxPropertiesChangeInRequestValidator.java
│ │ │ │ ├── SchemaMaximumChangeInRequestValidator.java
│ │ │ │ ├── SchemaMinItemsChangeInRequestValidator.java
│ │ │ │ ├── SchemaMinLengthChangeInRequestValidator.java
│ │ │ │ ├── SchemaMinPropertiesChangeInRequestValidator.java
│ │ │ │ ├── SchemaMinimumChangeInRequestValidator.java
│ │ │ │ ├── SchemaMultipleOfChangeInRequestValidator.java
│ │ │ │ ├── SchemaNullableChangeInRequestValidator.java
│ │ │ │ ├── SchemaRequiredChangeInRequestValidator.java
│ │ │ │ ├── SchemaTypeFormatChangeInRequestValidator.java
│ │ │ │ └── SchemaUniqueItemsChangeInRequestValidator.java
│ │ │ └── response/
│ │ │ ├── SchemaEnumChangeInResponseValidator.java
│ │ │ ├── SchemaExclusiveMaximumChangeInResponseValidator.java
│ │ │ ├── SchemaExclusiveMinimumChangeInResponseValidator.java
│ │ │ ├── SchemaMaxItemsChangeInResponseValidator.java
│ │ │ ├── SchemaMaxLengthChangeInResponseValidator.java
│ │ │ ├── SchemaMaxPropertiesChangeInResponseValidator.java
│ │ │ ├── SchemaMaximumChangeInResponseValidator.java
│ │ │ ├── SchemaMinItemsChangeInResponseValidator.java
│ │ │ ├── SchemaMinLengthChangeInResponseValidator.java
│ │ │ ├── SchemaMinPropertiesChangeInResponseValidator.java
│ │ │ ├── SchemaMinimumChangeInResponseValidator.java
│ │ │ ├── SchemaMultipleOfChangeInResponseValidator.java
│ │ │ ├── SchemaNullableChangeInResponseValidator.java
│ │ │ ├── SchemaRequiredChangeInResponseValidator.java
│ │ │ ├── SchemaTypeFormatChangeInResponseValidator.java
│ │ │ └── SchemaUniqueItemsChangeInResponseValidator.java
│ │ └── test/
│ │ ├── java/
│ │ │ └── org/
│ │ │ └── apache/
│ │ │ └── servicecomb/
│ │ │ └── toolkit/
│ │ │ └── oasv/
│ │ │ └── compatibility/
│ │ │ ├── CompatibilityCheckParserTest.java
│ │ │ ├── factory/
│ │ │ │ ├── DefaultCallbackDiffValidatorFactoryTest.java
│ │ │ │ ├── DefaultComponentsDiffValidatorFactoryTest.java
│ │ │ │ ├── DefaultEncodingDiffValidatorFactoryTest.java
│ │ │ │ ├── DefaultInfoDiffValidatorFactoryTest.java
│ │ │ │ ├── DefaultLinkDiffValidatorFactoryTest.java
│ │ │ │ ├── DefaultMediaTypeDiffValidatorFactoryTest.java
│ │ │ │ ├── DefaultOasSpecDiffValidatorFactoryTest.java
│ │ │ │ ├── DefaultOpenApiDiffValidatorFactoryTest.java
│ │ │ │ ├── DefaultOperationDiffValidatorFactoryTest.java
│ │ │ │ ├── DefaultParameterDiffValidatorFactoryTest.java
│ │ │ │ ├── DefaultPathItemDiffValidatorFactoryTest.java
│ │ │ │ ├── DefaultPathsDiffValidatorFactoryTest.java
│ │ │ │ ├── DefaultRequestBodyDiffValidatorFactoryTest.java
│ │ │ │ ├── DefaultResponseDiffValidatorFactoryTest.java
│ │ │ │ ├── DefaultResponsesDiffValidatorFactoryTest.java
│ │ │ │ ├── DefaultSchemaDiffValidatorFactoryTest.java
│ │ │ │ ├── DefaultSecuritySchemeDiffValidatorFactoryTest.java
│ │ │ │ ├── DefaultServerDiffValidatorFactoryTest.java
│ │ │ │ ├── DefaultTagDiffValidatorFactoryTest.java
│ │ │ │ └── DiffValidatorFactoryTestConfiguration.java
│ │ │ └── validators/
│ │ │ ├── OasCompatibilityTestBase.java
│ │ │ ├── encoding/
│ │ │ │ ├── EncodingAddNotAllowedDiffValidatorTest.java
│ │ │ │ ├── EncodingAllowedReservedChangeDiffValidatorTest.java
│ │ │ │ ├── EncodingContentTypeNotSameDiffValidatorTest.java
│ │ │ │ ├── EncodingDelNotAllowedDiffValidatorTest.java
│ │ │ │ ├── EncodingExplodeNotSameDiffValidatorTest.java
│ │ │ │ └── EncodingStyleNotSameDiffValidatorTest.java
│ │ │ ├── header/
│ │ │ │ ├── HeaderAddInRequestBodyNotAllowedDiffValidatorTest.java
│ │ │ │ └── HeaderDelInResponseNotAllowedDiffValidatorTest.java
│ │ │ ├── mediatype/
│ │ │ │ ├── MediaTypeAddInParameterNotAllowedDiffValidatorTest.java
│ │ │ │ ├── MediaTypeDelInParameterNotAllowedDiffValidatorTest.java
│ │ │ │ ├── MediaTypeDelInRequestBodyNotAllowedDiffValidatorTest.java
│ │ │ │ └── MediaTypeDelInResponseNotAllowedDiffValidatorTest.java
│ │ │ ├── operation/
│ │ │ │ ├── OperationDeleteNotAllowedDiffValidatorTest.java
│ │ │ │ └── OperationIdNotSameDiffValidatorTest.java
│ │ │ ├── parameter/
│ │ │ │ ├── ParameterAddDiffValidatorTest.java
│ │ │ │ ├── ParameterAllowEmptyValueChangeDiffValidatorTest.java
│ │ │ │ ├── ParameterAllowReservedChangeDiffValidatorTest.java
│ │ │ │ ├── ParameterExplodeNotSameDiffValidatorTest.java
│ │ │ │ ├── ParameterRequiredChangeDiffValidatorTest.java
│ │ │ │ └── ParameterStyleNotSameDiffValidatorTest.java
│ │ │ ├── pathitem/
│ │ │ │ └── PathItemDeleteNotAllowedDiffValidatorTest.java
│ │ │ ├── requestbody/
│ │ │ │ └── RequestBodyRequiredChangeDiffValidatorTest.java
│ │ │ ├── response/
│ │ │ │ └── ResponseAddNotAllowedDiffValidatorTest.java
│ │ │ └── schema/
│ │ │ ├── SchemaDiscriminatorChangeValidatorTest.java
│ │ │ ├── SchemaReadOnlyChangeValidatorTest.java
│ │ │ ├── SchemaWriteOnlyChangeValidatorTest.java
│ │ │ ├── SchemaXmlChangeValidatorTest.java
│ │ │ ├── request/
│ │ │ │ ├── SchemaEnumChangeInRequestValidatorTest.java
│ │ │ │ ├── SchemaExclusiveMaximumChangeInRequestValidatorTest.java
│ │ │ │ ├── SchemaExclusiveMinimumChangeInRequestValidatorTest.java
│ │ │ │ ├── SchemaMaxItemsChangeInRequestValidatorTest.java
│ │ │ │ ├── SchemaMaxLengthChangeInRequestValidatorTest.java
│ │ │ │ ├── SchemaMaxPropertiesChangeInRequestValidatorTest.java
│ │ │ │ ├── SchemaMaximumChangeInRequestValidatorTest.java
│ │ │ │ ├── SchemaMinItemsChangeInRequestValidatorTest.java
│ │ │ │ ├── SchemaMinLengthChangeInRequestValidatorTest.java
│ │ │ │ ├── SchemaMinPropertiesChangeInRequestValidatorTest.java
│ │ │ │ ├── SchemaMinimumChangeInRequestValidatorTest.java
│ │ │ │ ├── SchemaMultipleOfChangeInRequestValidatorTest.java
│ │ │ │ ├── SchemaNullableChangeInRequestValidatorTest.java
│ │ │ │ ├── SchemaRequiredChangeInRequestValidatorTest.java
│ │ │ │ ├── SchemaTypeFormatChangeInRequestValidatorTest.java
│ │ │ │ └── SchemaUniqueItemsChangeInRequestValidatorTest.java
│ │ │ └── response/
│ │ │ ├── SchemaEnumChangeInResponseValidatorTest.java
│ │ │ ├── SchemaExclusiveMaximumChangeInResponseValidatorTest.java
│ │ │ ├── SchemaExclusiveMinimumChangeInResponseValidatorTest.java
│ │ │ ├── SchemaMaxItemsChangeInResponseValidatorTest.java
│ │ │ ├── SchemaMaxLengthChangeInResponseValidatorTest.java
│ │ │ ├── SchemaMaxPropertiesChangeInResponseValidatorTest.java
│ │ │ ├── SchemaMaximumChangeInResponseValidatorTest.java
│ │ │ ├── SchemaMinItemsChangeInResponseValidatorTest.java
│ │ │ ├── SchemaMinLengthChangeInResponseValidatorTest.java
│ │ │ ├── SchemaMinPropertiesChangeInResponseValidatorTest.java
│ │ │ ├── SchemaMinimumChangeInResponseValidatorTest.java
│ │ │ ├── SchemaMultipleOfChangeInResponseValidatorTest.java
│ │ │ ├── SchemaNullableChangeInResponseValidatorTest.java
│ │ │ ├── SchemaRequiredChangeInResponseValidatorTest.java
│ │ │ ├── SchemaTypeFormatChangeInResponseValidatorTest.java
│ │ │ └── SchemaUniqueItemsChangeInResponseValidatorTest.java
│ │ └── resources/
│ │ ├── logback-test.xml
│ │ └── org/
│ │ └── apache/
│ │ └── servicecomb/
│ │ └── toolkit/
│ │ └── oasv/
│ │ └── compatibility/
│ │ ├── parser-test.yaml
│ │ └── validators/
│ │ ├── encoding/
│ │ │ ├── petstore-encoding-add-a.yaml
│ │ │ ├── petstore-encoding-add-b.yaml
│ │ │ ├── petstore-encoding-allow-reserved-a.yaml
│ │ │ ├── petstore-encoding-allow-reserved-b.yaml
│ │ │ ├── petstore-encoding-content-type-a.yaml
│ │ │ ├── petstore-encoding-content-type-b.yaml
│ │ │ ├── petstore-encoding-del-a.yaml
│ │ │ ├── petstore-encoding-del-b.yaml
│ │ │ ├── petstore-encoding-explode-a.yaml
│ │ │ ├── petstore-encoding-explode-b.yaml
│ │ │ ├── petstore-encoding-style-a.yaml
│ │ │ └── petstore-encoding-style-b.yaml
│ │ ├── header/
│ │ │ ├── petstore-header-add-in-request-body-a.yaml
│ │ │ ├── petstore-header-add-in-request-body-b.yaml
│ │ │ ├── petstore-header-del-in-response-a.yaml
│ │ │ └── petstore-header-del-in-response-b.yaml
│ │ ├── mediatype/
│ │ │ ├── petstore-media-type-add-in-parameter-a.yaml
│ │ │ ├── petstore-media-type-add-in-parameter-b.yaml
│ │ │ ├── petstore-media-type-del-in-parameter-a.yaml
│ │ │ ├── petstore-media-type-del-in-parameter-b.yaml
│ │ │ ├── petstore-media-type-del-in-request-body-a.yaml
│ │ │ ├── petstore-media-type-del-in-request-body-b.yaml
│ │ │ ├── petstore-media-type-del-in-response-a.yaml
│ │ │ └── petstore-media-type-del-in-response-b.yaml
│ │ ├── operation/
│ │ │ ├── petstore-operation-delete-a.yaml
│ │ │ ├── petstore-operation-delete-b.yaml
│ │ │ ├── petstore-operation-id-a.yaml
│ │ │ └── petstore-operation-id-b.yaml
│ │ ├── parameter/
│ │ │ ├── petstore-parameter-add-a.yaml
│ │ │ ├── petstore-parameter-add-b.yaml
│ │ │ ├── petstore-parameter-allow-empty-value-a.yaml
│ │ │ ├── petstore-parameter-allow-empty-value-b.yaml
│ │ │ ├── petstore-parameter-allow-reserved-a.yaml
│ │ │ ├── petstore-parameter-allow-reserved-b.yaml
│ │ │ ├── petstore-parameter-explode-a.yaml
│ │ │ ├── petstore-parameter-explode-b.yaml
│ │ │ ├── petstore-parameter-required-a.yaml
│ │ │ ├── petstore-parameter-required-b.yaml
│ │ │ ├── petstore-parameter-style-a.yaml
│ │ │ └── petstore-parameter-style-b.yaml
│ │ ├── pathitem/
│ │ │ ├── petstore-path-item-delete-a.yaml
│ │ │ └── petstore-path-item-delete-b.yaml
│ │ ├── requestbody/
│ │ │ ├── petstore-request-body-required-a.yaml
│ │ │ └── petstore-request-body-required-b.yaml
│ │ ├── response/
│ │ │ ├── petstore-response-add-a.yaml
│ │ │ └── petstore-response-add-b.yaml
│ │ └── schema/
│ │ ├── petstore-schema-discriminator-a.yaml
│ │ ├── petstore-schema-discriminator-b.yaml
│ │ ├── petstore-schema-read-only-a.yaml
│ │ ├── petstore-schema-read-only-b.yaml
│ │ ├── petstore-schema-write-only-a.yaml
│ │ ├── petstore-schema-write-only-b.yaml
│ │ ├── petstore-schema-xml-a.yaml
│ │ ├── petstore-schema-xml-b.yaml
│ │ ├── request/
│ │ │ ├── petstore-schema-enum-in-request-a.yaml
│ │ │ ├── petstore-schema-enum-in-request-b.yaml
│ │ │ ├── petstore-schema-exclusive-maximum-in-request-a.yaml
│ │ │ ├── petstore-schema-exclusive-maximum-in-request-b.yaml
│ │ │ ├── petstore-schema-exclusive-minimum-in-request-a.yaml
│ │ │ ├── petstore-schema-exclusive-minimum-in-request-b.yaml
│ │ │ ├── petstore-schema-max-items-in-request-a.yaml
│ │ │ ├── petstore-schema-max-items-in-request-b.yaml
│ │ │ ├── petstore-schema-max-length-in-request-a.yaml
│ │ │ ├── petstore-schema-max-length-in-request-b.yaml
│ │ │ ├── petstore-schema-max-properties-in-request-a.yaml
│ │ │ ├── petstore-schema-max-properties-in-request-b.yaml
│ │ │ ├── petstore-schema-maximum-in-request-a.yaml
│ │ │ ├── petstore-schema-maximum-in-request-b.yaml
│ │ │ ├── petstore-schema-min-items-in-request-a.yaml
│ │ │ ├── petstore-schema-min-items-in-request-b.yaml
│ │ │ ├── petstore-schema-min-length-in-request-a.yaml
│ │ │ ├── petstore-schema-min-length-in-request-b.yaml
│ │ │ ├── petstore-schema-min-properties-in-request-a.yaml
│ │ │ ├── petstore-schema-min-properties-in-request-b.yaml
│ │ │ ├── petstore-schema-minimum-in-request-a.yaml
│ │ │ ├── petstore-schema-minimum-in-request-b.yaml
│ │ │ ├── petstore-schema-multiple-of-in-request-a.yaml
│ │ │ ├── petstore-schema-multiple-of-in-request-b.yaml
│ │ │ ├── petstore-schema-nullable-in-request-a.yaml
│ │ │ ├── petstore-schema-nullable-in-request-b.yaml
│ │ │ ├── petstore-schema-required-in-request-a.yaml
│ │ │ ├── petstore-schema-required-in-request-b.yaml
│ │ │ ├── petstore-schema-type-format-in-request-a.yaml
│ │ │ ├── petstore-schema-type-format-in-request-b.yaml
│ │ │ ├── petstore-schema-unique-items-in-request-a.yaml
│ │ │ └── petstore-schema-unique-items-in-request-b.yaml
│ │ └── response/
│ │ ├── petstore-schema-enum-in-response-a.yaml
│ │ ├── petstore-schema-enum-in-response-b.yaml
│ │ ├── petstore-schema-exclusive-maximum-in-response-a.yaml
│ │ ├── petstore-schema-exclusive-maximum-in-response-b.yaml
│ │ ├── petstore-schema-exclusive-minimum-in-response-a.yaml
│ │ ├── petstore-schema-exclusive-minimum-in-response-b.yaml
│ │ ├── petstore-schema-max-items-in-response-a.yaml
│ │ ├── petstore-schema-max-items-in-response-b.yaml
│ │ ├── petstore-schema-max-length-in-response-a.yaml
│ │ ├── petstore-schema-max-length-in-response-b.yaml
│ │ ├── petstore-schema-max-properties-in-response-a.yaml
│ │ ├── petstore-schema-max-properties-in-response-b.yaml
│ │ ├── petstore-schema-maximum-in-response-a.yaml
│ │ ├── petstore-schema-maximum-in-response-b.yaml
│ │ ├── petstore-schema-min-items-in-response-a.yaml
│ │ ├── petstore-schema-min-items-in-response-b.yaml
│ │ ├── petstore-schema-min-length-in-response-a.yaml
│ │ ├── petstore-schema-min-length-in-response-b.yaml
│ │ ├── petstore-schema-min-properties-in-response-a.yaml
│ │ ├── petstore-schema-min-properties-in-response-b.yaml
│ │ ├── petstore-schema-minimum-in-response-a.yaml
│ │ ├── petstore-schema-minimum-in-response-b.yaml
│ │ ├── petstore-schema-multiple-of-in-response-a.yaml
│ │ ├── petstore-schema-multiple-of-in-response-b.yaml
│ │ ├── petstore-schema-nullable-in-response-a.yaml
│ │ ├── petstore-schema-nullable-in-response-b.yaml
│ │ ├── petstore-schema-required-in-response-a.yaml
│ │ ├── petstore-schema-required-in-response-b.yaml
│ │ ├── petstore-schema-type-format-in-response-a.yaml
│ │ ├── petstore-schema-type-format-in-response-b.yaml
│ │ ├── petstore-schema-unique-items-in-response-a.yaml
│ │ └── petstore-schema-unique-items-in-response-b.yaml
│ ├── oas-validator-compatibility-spring/
│ │ ├── pom.xml
│ │ └── src/
│ │ ├── main/
│ │ │ ├── java/
│ │ │ │ └── org/
│ │ │ │ └── apache/
│ │ │ │ └── servicecomb/
│ │ │ │ └── toolkit/
│ │ │ │ └── oasv/
│ │ │ │ └── compatibility/
│ │ │ │ └── config/
│ │ │ │ ├── EncodingDiffValidatorsConfiguration.java
│ │ │ │ ├── HeaderDiffValidatorsConfiguration.java
│ │ │ │ ├── MediaTypeDiffValidatorsConfiguration.java
│ │ │ │ ├── OperationDiffValidatorsConfiguration.java
│ │ │ │ ├── ParameterDiffValidatorsConfiguration.java
│ │ │ │ ├── PathItemDiffValidatorsConfiguration.java
│ │ │ │ ├── RequestBodyDiffValidatorsConfiguration.java
│ │ │ │ ├── ResponseDiffValidatorsConfiguration.java
│ │ │ │ └── SchemaDiffValidatorsConfiguration.java
│ │ │ └── resources/
│ │ │ └── META-INF/
│ │ │ └── spring.factories
│ │ └── test/
│ │ ├── java/
│ │ │ └── org/
│ │ │ └── apache/
│ │ │ └── servicecomb/
│ │ │ └── toolkit/
│ │ │ └── oasv/
│ │ │ └── compatibility/
│ │ │ └── config/
│ │ │ └── ValidatorConfigurationsTest.java
│ │ └── resources/
│ │ └── logback-test.xml
│ ├── oas-validator-core/
│ │ ├── pom.xml
│ │ └── src/
│ │ ├── main/
│ │ │ └── java/
│ │ │ └── org/
│ │ │ └── apache/
│ │ │ └── servicecomb/
│ │ │ └── toolkit/
│ │ │ └── oasv/
│ │ │ ├── FactoryOptions.java
│ │ │ ├── common/
│ │ │ │ ├── OasObjectProperty.java
│ │ │ │ ├── OasObjectPropertyLocation.java
│ │ │ │ └── OasObjectType.java
│ │ │ ├── diffvalidation/
│ │ │ │ ├── api/
│ │ │ │ │ ├── CallbackDiffValidator.java
│ │ │ │ │ ├── ComponentsDiffValidator.java
│ │ │ │ │ ├── DefaultOasSpecDiffValidator.java
│ │ │ │ │ ├── DiffViolationMessages.java
│ │ │ │ │ ├── EncodingDiffValidator.java
│ │ │ │ │ ├── HeaderDiffValidator.java
│ │ │ │ │ ├── InfoDiffValidator.java
│ │ │ │ │ ├── LinkDiffValidator.java
│ │ │ │ │ ├── ListPropertyDiffValidator.java
│ │ │ │ │ ├── MapPropertyDiffValidator.java
│ │ │ │ │ ├── MediaTypeDiffValidator.java
│ │ │ │ │ ├── OasDiffValidationContext.java
│ │ │ │ │ ├── OasDiffValidationException.java
│ │ │ │ │ ├── OasDiffViolation.java
│ │ │ │ │ ├── OasObjectDiffValidator.java
│ │ │ │ │ ├── OasObjectDiffValidatorTemplate.java
│ │ │ │ │ ├── OasSpecDiffValidator.java
│ │ │ │ │ ├── ObjectPropertyDiffValidator.java
│ │ │ │ │ ├── OpenApiDiffValidator.java
│ │ │ │ │ ├── OperationDiffValidator.java
│ │ │ │ │ ├── ParameterDiffValidator.java
│ │ │ │ │ ├── PathItemDiffValidator.java
│ │ │ │ │ ├── PathsDiffValidator.java
│ │ │ │ │ ├── RequestBodyDiffValidator.java
│ │ │ │ │ ├── ResponseDiffValidator.java
│ │ │ │ │ ├── ResponsesDiffValidator.java
│ │ │ │ │ ├── SchemaAddValidator.java
│ │ │ │ │ ├── SchemaCompareValidator.java
│ │ │ │ │ ├── SchemaDelValidator.java
│ │ │ │ │ ├── SchemaDiffValidator.java
│ │ │ │ │ ├── SecuritySchemeDiffValidator.java
│ │ │ │ │ ├── ServerDiffValidator.java
│ │ │ │ │ └── TagDiffValidator.java
│ │ │ │ ├── factory/
│ │ │ │ │ ├── CallbackDiffValidatorFactory.java
│ │ │ │ │ ├── ComponentsDiffValidatorFactory.java
│ │ │ │ │ ├── EncodingDiffValidatorFactory.java
│ │ │ │ │ ├── HeaderDiffValidatorFactory.java
│ │ │ │ │ ├── InfoDiffValidatorFactory.java
│ │ │ │ │ ├── LinkDiffValidatorFactory.java
│ │ │ │ │ ├── MediaTypeDiffValidatorFactory.java
│ │ │ │ │ ├── OasObjectDiffValidatorFactory.java
│ │ │ │ │ ├── OasSpecDiffValidatorFactory.java
│ │ │ │ │ ├── OpenApiDiffValidatorFactory.java
│ │ │ │ │ ├── OperationDiffValidatorFactory.java
│ │ │ │ │ ├── ParameterDiffValidatorFactory.java
│ │ │ │ │ ├── PathItemDiffValidatorFactory.java
│ │ │ │ │ ├── PathsDiffValidatorFactory.java
│ │ │ │ │ ├── RequestBodyDiffValidatorFactory.java
│ │ │ │ │ ├── ResponseDiffValidatorFactory.java
│ │ │ │ │ ├── ResponsesDiffValidatorFactory.java
│ │ │ │ │ ├── SchemaDiffValidatorFactory.java
│ │ │ │ │ ├── SecuritySchemeDiffValidatorFactory.java
│ │ │ │ │ ├── ServerDiffValidatorFactory.java
│ │ │ │ │ └── TagDiffValidatorFactory.java
│ │ │ │ ├── skeleton/
│ │ │ │ │ ├── components/
│ │ │ │ │ │ ├── ComponentsCallbacksDiffValidator.java
│ │ │ │ │ │ ├── ComponentsHeadersDiffValidator.java
│ │ │ │ │ │ ├── ComponentsLinksDiffValidator.java
│ │ │ │ │ │ ├── ComponentsParametersDiffValidator.java
│ │ │ │ │ │ ├── ComponentsRequestBodiesDiffValidator.java
│ │ │ │ │ │ └── ComponentsResponsesDiffValidator.java
│ │ │ │ │ ├── encoding/
│ │ │ │ │ │ └── EncodingHeadersDiffValidator.java
│ │ │ │ │ ├── header/
│ │ │ │ │ │ └── HeaderSchemaDiffValidator.java
│ │ │ │ │ ├── mediatype/
│ │ │ │ │ │ ├── MediaTypeEncodingDiffValidator.java
│ │ │ │ │ │ └── MediaTypeSchemaDiffValidator.java
│ │ │ │ │ ├── openapi/
│ │ │ │ │ │ ├── OpenApiComponentsDiffValidator.java
│ │ │ │ │ │ ├── OpenApiInfoDiffValidator.java
│ │ │ │ │ │ ├── OpenApiPathsDiffValidator.java
│ │ │ │ │ │ ├── OpenApiServersDiffValidator.java
│ │ │ │ │ │ └── OpenApiTagsDiffValidator.java
│ │ │ │ │ ├── operation/
│ │ │ │ │ │ ├── OperationParametersDiffValidator.java
│ │ │ │ │ │ ├── OperationRequestBodyDiffValidator.java
│ │ │ │ │ │ └── OperationResponsesDiffValidator.java
│ │ │ │ │ ├── parameter/
│ │ │ │ │ │ ├── ParameterContentDiffValidator.java
│ │ │ │ │ │ └── ParameterSchemaDiffValidator.java
│ │ │ │ │ ├── pathitem/
│ │ │ │ │ │ ├── PathItemOperationsDiffValidator.java
│ │ │ │ │ │ └── PathItemParametersDiffValidator.java
│ │ │ │ │ ├── paths/
│ │ │ │ │ │ └── PathsPathItemsDiffValidator.java
│ │ │ │ │ ├── requestbody/
│ │ │ │ │ │ └── RequestBodyContentDiffValidator.java
│ │ │ │ │ ├── response/
│ │ │ │ │ │ ├── ResponseContentDiffValidator.java
│ │ │ │ │ │ └── ResponseHeadersDiffValidator.java
│ │ │ │ │ ├── responses/
│ │ │ │ │ │ └── ResponsesResponsesDiffValidator.java
│ │ │ │ │ └── schema/
│ │ │ │ │ └── SchemaDiffValidatorEngine.java
│ │ │ │ └── util/
│ │ │ │ ├── ChangeRangeCheckUtils.java
│ │ │ │ ├── OasDiffValidationContextUtils.java
│ │ │ │ ├── OasObjectDiffValidatorUtils.java
│ │ │ │ └── ParameterUtils.java
│ │ │ ├── util/
│ │ │ │ ├── StringCaseUtils.java
│ │ │ │ └── SyntaxChecker.java
│ │ │ └── validation/
│ │ │ ├── api/
│ │ │ │ ├── CallbackValidator.java
│ │ │ │ ├── ComponentsValidator.java
│ │ │ │ ├── DefaultOasSpecValidator.java
│ │ │ │ ├── EncodingValidator.java
│ │ │ │ ├── ExampleValidator.java
│ │ │ │ ├── HeaderValidator.java
│ │ │ │ ├── InfoValidator.java
│ │ │ │ ├── LinkValidator.java
│ │ │ │ ├── ListPropertyRequiredValidator.java
│ │ │ │ ├── ListPropertyValidator.java
│ │ │ │ ├── MapPropertyKeysValidator.java
│ │ │ │ ├── MapPropertyValuesValidator.java
│ │ │ │ ├── MediaTypeValidator.java
│ │ │ │ ├── OasObjectValidator.java
│ │ │ │ ├── OasSpecValidator.java
│ │ │ │ ├── OasValidationContext.java
│ │ │ │ ├── OasViolation.java
│ │ │ │ ├── ObjectPropertyRequiredValidator.java
│ │ │ │ ├── ObjectPropertyValidator.java
│ │ │ │ ├── OpenApiValidator.java
│ │ │ │ ├── OperationValidator.java
│ │ │ │ ├── ParameterValidator.java
│ │ │ │ ├── PathItemValidator.java
│ │ │ │ ├── PathsValidator.java
│ │ │ │ ├── RequestBodyValidator.java
│ │ │ │ ├── ResponseValidator.java
│ │ │ │ ├── ResponsesValidator.java
│ │ │ │ ├── SchemaValidator.java
│ │ │ │ ├── SecuritySchemeValidator.java
│ │ │ │ ├── ServerValidator.java
│ │ │ │ ├── TagValidator.java
│ │ │ │ └── ViolationMessages.java
│ │ │ ├── factory/
│ │ │ │ ├── CallbackValidatorFactory.java
│ │ │ │ ├── ComponentsValidatorFactory.java
│ │ │ │ ├── EncodingValidatorFactory.java
│ │ │ │ ├── ExampleValidatorFactory.java
│ │ │ │ ├── HeaderValidatorFactory.java
│ │ │ │ ├── InfoValidatorFactory.java
│ │ │ │ ├── LinkValidatorFactory.java
│ │ │ │ ├── MediaTypeValidatorFactory.java
│ │ │ │ ├── OasObjectValidatorFactory.java
│ │ │ │ ├── OasSpecValidatorFactory.java
│ │ │ │ ├── OpenApiValidatorFactory.java
│ │ │ │ ├── OperationValidatorFactory.java
│ │ │ │ ├── ParameterValidatorFactory.java
│ │ │ │ ├── PathItemValidatorFactory.java
│ │ │ │ ├── PathsValidatorFactory.java
│ │ │ │ ├── RequestBodyValidatorFactory.java
│ │ │ │ ├── ResponseValidatorFactory.java
│ │ │ │ ├── ResponsesValidatorFactory.java
│ │ │ │ ├── SchemaValidatorFactory.java
│ │ │ │ ├── SecuritySchemeValidatorFactory.java
│ │ │ │ ├── ServerValidatorFactory.java
│ │ │ │ └── TagValidatorFactory.java
│ │ │ ├── skeleton/
│ │ │ │ ├── components/
│ │ │ │ │ ├── ComponentsCallbacksKeysValidator.java
│ │ │ │ │ ├── ComponentsCallbacksValuesValidator.java
│ │ │ │ │ ├── ComponentsExamplesKeysValidator.java
│ │ │ │ │ ├── ComponentsExamplesValuesValidator.java
│ │ │ │ │ ├── ComponentsHeadersKeysValidator.java
│ │ │ │ │ ├── ComponentsHeadersValuesValidator.java
│ │ │ │ │ ├── ComponentsLinksKeysValidator.java
│ │ │ │ │ ├── ComponentsLinksValuesValidator.java
│ │ │ │ │ ├── ComponentsParametersKeysValidator.java
│ │ │ │ │ ├── ComponentsParametersValuesValidator.java
│ │ │ │ │ ├── ComponentsRequestBodiesKeysValidator.java
│ │ │ │ │ ├── ComponentsRequestBodiesValuesValidator.java
│ │ │ │ │ ├── ComponentsResponsesKeysValidator.java
│ │ │ │ │ ├── ComponentsResponsesValuesValidator.java
│ │ │ │ │ ├── ComponentsSchemasKeysValidator.java
│ │ │ │ │ ├── ComponentsSchemasValuesValidator.java
│ │ │ │ │ ├── ComponentsSecuritySchemesKeysValidator.java
│ │ │ │ │ └── ComponentsSecuritySchemesValuesValidator.java
│ │ │ │ ├── encoding/
│ │ │ │ │ ├── EncodingHeadersKeysValidator.java
│ │ │ │ │ └── EncodingHeadersValuesValidator.java
│ │ │ │ ├── header/
│ │ │ │ │ └── HeaderSchemaValidator.java
│ │ │ │ ├── mediatype/
│ │ │ │ │ ├── MediaTypeEncodingValidator.java
│ │ │ │ │ └── MediaTypeSchemaValidator.java
│ │ │ │ ├── openapi/
│ │ │ │ │ ├── OpenApiComponentsValidator.java
│ │ │ │ │ ├── OpenApiInfoValidator.java
│ │ │ │ │ ├── OpenApiPathsValidator.java
│ │ │ │ │ ├── OpenApiServersValidator.java
│ │ │ │ │ └── OpenApiTagsValidator.java
│ │ │ │ ├── operation/
│ │ │ │ │ ├── OperationParametersValidator.java
│ │ │ │ │ ├── OperationRequestBodyValidator.java
│ │ │ │ │ └── OperationResponsesValidator.java
│ │ │ │ ├── parameter/
│ │ │ │ │ ├── ParameterContentValidator.java
│ │ │ │ │ └── ParameterSchemaValidator.java
│ │ │ │ ├── pathitem/
│ │ │ │ │ ├── PathItemOperationsValidator.java
│ │ │ │ │ └── PathItemParametersValidator.java
│ │ │ │ ├── paths/
│ │ │ │ │ └── PathsPathItemsValidator.java
│ │ │ │ ├── requestbody/
│ │ │ │ │ └── RequestBodyContentValidator.java
│ │ │ │ ├── response/
│ │ │ │ │ ├── ResponseContentValidator.java
│ │ │ │ │ ├── ResponseHeadersKeysValidator.java
│ │ │ │ │ └── ResponseHeadersValuesValidator.java
│ │ │ │ ├── responses/
│ │ │ │ │ └── ResponsesResponsesValidator.java
│ │ │ │ └── schema/
│ │ │ │ ├── SchemaPropertiesKeysValidator.java
│ │ │ │ └── SchemaRecursiveValidatorTemplate.java
│ │ │ └── util/
│ │ │ └── OasObjectValidatorUtils.java
│ │ └── test/
│ │ ├── java/
│ │ │ └── org/
│ │ │ └── apache/
│ │ │ └── servicecomb/
│ │ │ └── toolkit/
│ │ │ └── oasv/
│ │ │ ├── common/
│ │ │ │ └── OasObjectPropertyLocationTest.java
│ │ │ └── util/
│ │ │ ├── StringCaseUtilsTest.java
│ │ │ └── SyntaxCheckerTest.java
│ │ └── resources/
│ │ └── org/
│ │ └── apache/
│ │ └── servicecomb/
│ │ └── toolkit/
│ │ └── oasv/
│ │ └── util/
│ │ ├── syntax-bad.yaml
│ │ └── syntax-good.yaml
│ ├── oas-validator-core-spring/
│ │ ├── pom.xml
│ │ └── src/
│ │ └── main/
│ │ ├── java/
│ │ │ └── org/
│ │ │ └── apache/
│ │ │ └── servicecomb/
│ │ │ └── toolkit/
│ │ │ └── oasv/
│ │ │ └── diffvalidation/
│ │ │ └── config/
│ │ │ └── OasDiffValidatorsSkeletonConfiguration.java
│ │ └── resources/
│ │ └── META-INF/
│ │ └── spring.factories
│ ├── oas-validator-style/
│ │ ├── pom.xml
│ │ └── src/
│ │ ├── main/
│ │ │ └── java/
│ │ │ └── org/
│ │ │ └── apache/
│ │ │ └── servicecomb/
│ │ │ └── toolkit/
│ │ │ └── oasv/
│ │ │ └── style/
│ │ │ ├── StyleCheckParser.java
│ │ │ ├── factory/
│ │ │ │ ├── DefaultComponentsValidatorFactory.java
│ │ │ │ ├── DefaultEncodingValidatorFactory.java
│ │ │ │ ├── DefaultHeaderValidatorFactory.java
│ │ │ │ ├── DefaultInfoValidatorFactory.java
│ │ │ │ ├── DefaultMediaTypeValidatorFactory.java
│ │ │ │ ├── DefaultOasSpecValidatorFactory.java
│ │ │ │ ├── DefaultOpenApiValidatorFactory.java
│ │ │ │ ├── DefaultOperationValidatorFactory.java
│ │ │ │ ├── DefaultParameterValidatorFactory.java
│ │ │ │ ├── DefaultPathItemValidatorFactory.java
│ │ │ │ ├── DefaultPathsValidatorFactory.java
│ │ │ │ ├── DefaultRequestBodyValidatorFactory.java
│ │ │ │ ├── DefaultResponseValidatorFactory.java
│ │ │ │ ├── DefaultResponsesValidatorFactory.java
│ │ │ │ ├── DefaultSchemaValidatorFactory.java
│ │ │ │ ├── DefaultSecuritySchemeValidatorFactory.java
│ │ │ │ ├── DefaultServerValidatorFactory.java
│ │ │ │ ├── DefaultTagValidatorFactory.java
│ │ │ │ └── ValidatorFactoryComponents.java
│ │ │ └── validator/
│ │ │ ├── components/
│ │ │ │ ├── ComponentsCallbacksKeysCaseValidator.java
│ │ │ │ ├── ComponentsExamplesKeysCaseValidator.java
│ │ │ │ ├── ComponentsHeadersKeysCaseValidator.java
│ │ │ │ ├── ComponentsLinksKeysCaseValidator.java
│ │ │ │ ├── ComponentsParametersKeysCaseValidator.java
│ │ │ │ ├── ComponentsRequestBodiesKeysCaseValidator.java
│ │ │ │ ├── ComponentsResponsesKeysCaseValidator.java
│ │ │ │ ├── ComponentsSchemasKeysCaseValidator.java
│ │ │ │ └── ComponentsSecuritySchemesKeysCaseValidator.java
│ │ │ ├── encoding/
│ │ │ │ └── EncodingHeadersKeysCaseValidator.java
│ │ │ ├── header/
│ │ │ │ └── HeaderDescriptionRequiredValidator.java
│ │ │ ├── info/
│ │ │ │ └── InfoDescriptionRequiredValidator.java
│ │ │ ├── openapi/
│ │ │ │ ├── OpenApiSecuritySizeEqValidator.java
│ │ │ │ ├── OpenApiTagsSizeGteValidator.java
│ │ │ │ └── OpenApiVersionGteValidator.java
│ │ │ ├── operation/
│ │ │ │ ├── OperationIdCaseValidator.java
│ │ │ │ ├── OperationServersSizeEqValidator.java
│ │ │ │ ├── OperationSummaryRequiredValidator.java
│ │ │ │ ├── OperationTagsReferenceValidator.java
│ │ │ │ └── OperationTagsSizeEqValidator.java
│ │ │ ├── parameter/
│ │ │ │ ├── ParameterDescriptionRequiredValidator.java
│ │ │ │ ├── ParameterNameCookieCaseValidator.java
│ │ │ │ ├── ParameterNameHeaderCaseValidator.java
│ │ │ │ ├── ParameterNamePathCaseValidator.java
│ │ │ │ └── ParameterNameQueryCaseValidator.java
│ │ │ ├── paths/
│ │ │ │ └── PathsKeyCaseValidator.java
│ │ │ ├── requestbody/
│ │ │ │ └── RequestBodyDescriptionRequiredValidator.java
│ │ │ ├── response/
│ │ │ │ └── ResponseHeadersKeysCaseValidator.java
│ │ │ ├── schema/
│ │ │ │ ├── SchemaPropertiesKeysCaseValidator.java
│ │ │ │ └── SchemaTitleRequiredValidator.java
│ │ │ └── tag/
│ │ │ ├── TagDescriptionRequiredValidator.java
│ │ │ ├── TagMustBeReferencedValidator.java
│ │ │ └── TagNameCaseValidator.java
│ │ └── test/
│ │ ├── java/
│ │ │ └── org/
│ │ │ └── apache/
│ │ │ └── servicecomb/
│ │ │ └── toolkit/
│ │ │ └── oasv/
│ │ │ └── style/
│ │ │ ├── StyleCheckParserTest.java
│ │ │ ├── factory/
│ │ │ │ ├── DefaultComponentsValidatorFactoryTest.java
│ │ │ │ ├── DefaultEncodingValidatorFactoryTest.java
│ │ │ │ ├── DefaultHeaderValidatorFactoryTest.java
│ │ │ │ ├── DefaultInfoValidatorFactoryTest.java
│ │ │ │ ├── DefaultMediaTypeValidatorFactoryTest.java
│ │ │ │ ├── DefaultOasSpecValidatorFactoryTest.java
│ │ │ │ ├── DefaultOpenApiValidatorFactoryTest.java
│ │ │ │ ├── DefaultOperationValidatorFactoryTest.java
│ │ │ │ ├── DefaultParameterValidatorFactoryTest.java
│ │ │ │ ├── DefaultPathItemValidatorFactoryTest.java
│ │ │ │ ├── DefaultPathsValidatorFactoryTest.java
│ │ │ │ ├── DefaultRequestBodyValidatorFactoryTest.java
│ │ │ │ ├── DefaultResponseValidatorFactoryTest.java
│ │ │ │ ├── DefaultResponsesValidatorFactoryTest.java
│ │ │ │ ├── DefaultSchemaValidatorFactoryTest.java
│ │ │ │ ├── DefaultSecuritySchemeValidatorFactoryTest.java
│ │ │ │ ├── DefaultServerValidatorFactoryTest.java
│ │ │ │ └── DefaultTagValidatorFactoryTest.java
│ │ │ └── validator/
│ │ │ ├── OasStyleCheckTestBase.java
│ │ │ ├── components/
│ │ │ │ ├── ComponentsCallbacksKeysCaseValidatorTest.java
│ │ │ │ ├── ComponentsExamplesKeysCaseValidatorTest.java
│ │ │ │ ├── ComponentsHeadersKeysCaseValidatorTest.java
│ │ │ │ ├── ComponentsLinksKeysCaseValidatorTest.java
│ │ │ │ ├── ComponentsParametersKeysCaseValidatorTest.java
│ │ │ │ ├── ComponentsRequestBodiesKeysCaseValidatorTest.java
│ │ │ │ ├── ComponentsResponsesKeysCaseValidatorTest.java
│ │ │ │ ├── ComponentsSchemasKeysCaseValidatorTest.java
│ │ │ │ └── ComponentsSecuritySchemesKeysCaseValidatorTest.java
│ │ │ ├── encoding/
│ │ │ │ └── EncodingHeadersKeysCaseValidatorTest.java
│ │ │ ├── header/
│ │ │ │ └── HeaderDescriptionRequiredValidatorTest.java
│ │ │ ├── info/
│ │ │ │ └── InfoDescriptionRequiredValidatorTest.java
│ │ │ ├── openapi/
│ │ │ │ ├── OpenApiSecuritySizeEqValidatorTest.java
│ │ │ │ ├── OpenApiTagsSizeGteValidatorTest.java
│ │ │ │ └── OpenApiVersionGteValidatorTest.java
│ │ │ ├── operation/
│ │ │ │ ├── OperationIdCaseValidatorTest.java
│ │ │ │ ├── OperationServersSizeEqValidatorTest.java
│ │ │ │ ├── OperationSummaryRequiredValidatorTest.java
│ │ │ │ ├── OperationTagsReferenceValidatorTest.java
│ │ │ │ └── OperationTagsSizeEqValidatorTest.java
│ │ │ ├── parameter/
│ │ │ │ ├── ParameterDescriptionRequiredValidatorTest.java
│ │ │ │ ├── ParameterNameCookieCaseValidatorTest.java
│ │ │ │ ├── ParameterNameHeaderCaseValidatorTest.java
│ │ │ │ ├── ParameterNamePathCaseValidatorTest.java
│ │ │ │ └── ParameterNameQueryCaseValidatorTest.java
│ │ │ ├── paths/
│ │ │ │ └── PathsKeyCaseValidatorTest.java
│ │ │ ├── requestbody/
│ │ │ │ └── RequestBodyDescriptionRequiredValidatorTest.java
│ │ │ ├── response/
│ │ │ │ └── ResponseHeadersKeysCaseValidatorTest.java
│ │ │ ├── schema/
│ │ │ │ ├── SchemaPropertiesKeysCaseValidatorTest.java
│ │ │ │ └── SchemaTitleRequiredValidatorTest.java
│ │ │ └── tag/
│ │ │ ├── TagDescriptionRequiredValidatorTest.java
│ │ │ ├── TagMustBeReferencedValidatorTest.java
│ │ │ └── TagNameCaseValidatorTest.java
│ │ └── resources/
│ │ ├── logback-test.xml
│ │ └── org/
│ │ └── apache/
│ │ └── servicecomb/
│ │ └── toolkit/
│ │ └── oasv/
│ │ └── style/
│ │ ├── parser-test.yaml
│ │ └── validator/
│ │ ├── components/
│ │ │ ├── petstore-callbacks-upper-camel-case.yaml
│ │ │ ├── petstore-examples-upper-camel-case.yaml
│ │ │ ├── petstore-headers-upper-camel-case.yaml
│ │ │ ├── petstore-links-upper-camel-case.yaml
│ │ │ ├── petstore-parameters-upper-camel-case.yaml
│ │ │ ├── petstore-request-bodies-upper-camel-case.yaml
│ │ │ ├── petstore-responses-upper-camel-case.yaml
│ │ │ ├── petstore-schemas-upper-camel-case.yaml
│ │ │ └── petstore-security-schemes-upper-camel-case.yaml
│ │ ├── encoding/
│ │ │ ├── petstore-encoding-headers-key-case-1.yaml
│ │ │ ├── petstore-encoding-headers-key-case-2.yaml
│ │ │ ├── petstore-encoding-headers-key-case-3.yaml
│ │ │ └── petstore-encoding-headers-key-case-4.yaml
│ │ ├── header/
│ │ │ └── petstore-header-no-desc.yaml
│ │ ├── info/
│ │ │ └── petstore-info-no-desc.yaml
│ │ ├── openapi/
│ │ │ ├── petstore-openapi-wrong.yaml
│ │ │ ├── petstore-security-empty-good.yaml
│ │ │ ├── petstore-security-empty.yaml
│ │ │ └── petstore-tag-not-provided.yaml
│ │ ├── operation/
│ │ │ ├── petstore-operation-id-lower-camel-case.yaml
│ │ │ ├── petstore-operation-servers-empty.yaml
│ │ │ ├── petstore-operation-summary-required.yaml
│ │ │ ├── petstore-operation-tags-only-one.yaml
│ │ │ └── petstore-operation-tags-reference.yaml
│ │ ├── parameter/
│ │ │ ├── petstore-parameter-cookie-lower-camel-case.yaml
│ │ │ ├── petstore-parameter-desc-none.yaml
│ │ │ ├── petstore-parameter-header-upper-hyphen-case.yaml
│ │ │ ├── petstore-parameter-path-lower-camel-case.yaml
│ │ │ └── petstore-parameter-query-lower-camel-case.yaml
│ │ ├── paths/
│ │ │ └── petstore-paths-lower-camel-case.yaml
│ │ ├── requestbody/
│ │ │ └── petstore-request-body-desc-required.yaml
│ │ ├── response/
│ │ │ └── petstore-response-headers-key-case.yaml
│ │ ├── schema/
│ │ │ ├── petstore-schema-p-keys-lower-camel-case-all-of.yaml
│ │ │ ├── petstore-schema-p-keys-lower-camel-case-any-of.yaml
│ │ │ ├── petstore-schema-p-keys-lower-camel-case-array.yaml
│ │ │ ├── petstore-schema-p-keys-lower-camel-case-comp.yaml
│ │ │ ├── petstore-schema-p-keys-lower-camel-case-nested.yaml
│ │ │ ├── petstore-schema-p-keys-lower-camel-case-one-of.yaml
│ │ │ ├── petstore-schema-p-keys-lower-camel-case-param-1.yaml
│ │ │ ├── petstore-schema-p-keys-lower-camel-case-param-2.yaml
│ │ │ ├── petstore-schema-p-keys-lower-camel-case-req-1.yaml
│ │ │ ├── petstore-schema-p-keys-lower-camel-case-req-2.yaml
│ │ │ ├── petstore-schema-p-keys-lower-camel-case-resp-1.yaml
│ │ │ ├── petstore-schema-p-keys-lower-camel-case-resp-2.yaml
│ │ │ ├── petstore-schema-title-comp.yaml
│ │ │ ├── petstore-schema-title-nested.yaml
│ │ │ ├── petstore-schema-title-param.yaml
│ │ │ ├── petstore-schema-title-req.yaml
│ │ │ └── petstore-schema-title-resp.yaml
│ │ └── tag/
│ │ ├── petstore-tag-name-not-upper-camel-case.yaml
│ │ ├── petstore-tag-no-desc.yaml
│ │ └── petstore-tag-redundant.yaml
│ ├── oas-validator-test/
│ │ ├── pom.xml
│ │ └── src/
│ │ └── main/
│ │ └── java/
│ │ └── org/
│ │ └── apache/
│ │ └── servicecomb/
│ │ └── toolkit/
│ │ └── oasv/
│ │ ├── OasSpecLoader.java
│ │ ├── diffvalidation/
│ │ │ └── test/
│ │ │ └── OasDiffValidatorTestBase.java
│ │ └── validation/
│ │ └── test/
│ │ └── OasValidatorTestBase.java
│ ├── oas-validator-web/
│ │ ├── pom.xml
│ │ └── src/
│ │ └── main/
│ │ ├── java/
│ │ │ └── org/
│ │ │ └── apache/
│ │ │ └── servicecomb/
│ │ │ └── toolkit/
│ │ │ └── oasv/
│ │ │ └── web/
│ │ │ ├── Application.java
│ │ │ ├── api/
│ │ │ │ └── controller/
│ │ │ │ ├── CompatibilityController.java
│ │ │ │ ├── ImportError.java
│ │ │ │ ├── ImportError2.java
│ │ │ │ └── StyleController.java
│ │ │ ├── config/
│ │ │ │ └── StyleCheckValidatorsConfiguration.java
│ │ │ └── page/
│ │ │ └── controller/
│ │ │ ├── EditorController.java
│ │ │ ├── IndexController.java
│ │ │ ├── ValidatorController.java
│ │ │ └── ViewerController.java
│ │ └── resources/
│ │ ├── application.properties
│ │ ├── samples/
│ │ │ └── petstore-openapi-wrong.yaml
│ │ ├── style-check-rules.properties
│ │ └── templates/
│ │ ├── index.html
│ │ └── validator/
│ │ ├── compatibility.html
│ │ └── style.html
│ └── pom.xml
├── pom.xml
├── samples/
│ ├── README-ZH.md
│ ├── README.md
│ ├── generate-from-code-sample/
│ │ ├── GoodbyeService/
│ │ │ ├── pom.xml
│ │ │ └── src/
│ │ │ └── main/
│ │ │ ├── java/
│ │ │ │ └── org/
│ │ │ │ └── apache/
│ │ │ │ └── servicecomb/
│ │ │ │ └── toolkit/
│ │ │ │ └── goodbye/
│ │ │ │ ├── GoodbyeApplication.java
│ │ │ │ └── GoodbyeController.java
│ │ │ └── resources/
│ │ │ └── application.yaml
│ │ ├── HelloService/
│ │ │ ├── pom.xml
│ │ │ └── src/
│ │ │ └── main/
│ │ │ ├── java/
│ │ │ │ └── org/
│ │ │ │ └── apache/
│ │ │ │ └── servicecomb/
│ │ │ │ └── toolkit/
│ │ │ │ └── hello/
│ │ │ │ ├── HelloApplication.java
│ │ │ │ └── HelloController.java
│ │ │ └── resources/
│ │ │ └── application.yaml
│ │ ├── README-ZH.md
│ │ ├── README.md
│ │ └── pom.xml
│ ├── generate-from-contract-sample/
│ │ ├── README-ZH.md
│ │ ├── README.md
│ │ ├── contract/
│ │ │ ├── GoodByeService/
│ │ │ │ └── GoodbyeController.yaml
│ │ │ └── HelloService/
│ │ │ └── HelloController.yaml
│ │ └── pom.xml
│ ├── pom.xml
│ └── verify-with-code-sample/
│ ├── GreetingService/
│ │ ├── pom.xml
│ │ └── src/
│ │ └── main/
│ │ └── java/
│ │ └── org/
│ │ └── apache/
│ │ └── servicecomb/
│ │ └── toolkit/
│ │ └── goodbye/
│ │ ├── GreetingController.java
│ │ └── GreetingService.java
│ ├── README-ZH.md
│ ├── README.md
│ ├── contract/
│ │ └── GreetingService/
│ │ └── GreetingController.yaml
│ └── pom.xml
├── scripts/
│ ├── cliTest.sh
│ ├── deploy.sh
│ └── test.sh
├── toolkit-distribution/
│ ├── pom.xml
│ └── src/
│ ├── assembly/
│ │ ├── bin.xml
│ │ └── src.xml
│ └── release/
│ ├── LICENSE
│ ├── NOTICE
│ └── licenses/
│ ├── LICENSE-asm
│ ├── LICENSE-automaton
│ ├── LICENSE-cal10n
│ ├── LICENSE-cc0
│ ├── LICENSE-cddl
│ ├── LICENSE-commonmark
│ ├── LICENSE-epl-v10
│ ├── LICENSE-hamcrest
│ ├── LICENSE-jmustache
│ ├── LICENSE-jopt
│ ├── LICENSE-jsch
│ ├── LICENSE-jzlib
│ ├── LICENSE-lombok
│ ├── LICENSE-mit
│ ├── LICENSE-mockito
│ ├── LICENSE-mozilla-v20
│ ├── LICENSE-slf4j
│ ├── LICENSE-threetenbp
│ ├── LICENSE-webjars
│ ├── LICENSE-woodstox-stax2-api
│ ├── NOTICE-airline
│ ├── NOTICE-apache-commons-cli
│ ├── NOTICE-apache-commons-codec
│ └── NOTICE-servicecomb-java-chassis
└── toolkit-maven-plugin/
├── pom.xml
└── src/
├── main/
│ └── java/
│ └── org/
│ └── apache/
│ └── servicecomb/
│ └── toolkit/
│ └── plugin/
│ ├── GenerateMojo.java
│ ├── GenerateUtil.java
│ ├── MavenPluginUtil.java
│ ├── ServiceConfig.java
│ └── VerifyMojo.java
└── test/
├── java/
│ └── org/
│ └── apache/
│ └── servicecomb/
│ └── toolkit/
│ └── plugin/
│ ├── GenerateMojoTest.java
│ ├── GenerateUtilTest.java
│ ├── InvokeStaticMethodTest.java
│ ├── MavenPluginUtilTest.java
│ ├── TestResourcesEx.java
│ └── VerifyMojoTest.java
├── projects/
│ ├── contract-destination/
│ │ └── HelloEndPoint.yaml
│ ├── contract-source/
│ │ └── HelloEndPoint.yaml
│ ├── demo-multi-module/
│ │ ├── first-module/
│ │ │ └── pom.xml
│ │ └── pom.xml
│ ├── demo-with-contract/
│ │ ├── pom.xml
│ │ └── src/
│ │ └── main/
│ │ └── java/
│ │ └── demo/
│ │ ├── Application.java
│ │ └── HelloEndPoint.java
│ └── demo-without-contract/
│ ├── pom.xml
│ └── src/
│ └── main/
│ └── java/
│ └── demo/
│ └── Application.java
└── resources/
└── log4j2-test.xml
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Output Directory
target/
# C pre-compile
*.gch
*.pch
# C compile
*.a
*.o
*.ko
*.la
*.lo
*.obj
*.elf
*.so
*.so.*
*.dylib
*.exe
*.lib
*.dll
*.out
*.app
*.hex
# Debug files
*.dSYM/
# Java
*.class
# Java Package Files
*.jar
*.war
*.ear
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# Zip Files
*.rar
*.zip
*.7z
*.tar
*.gz
# Ant
build/
# Compiled Python
__pycache__/
*.py[cod]
*py.class
# Eclipse
.settings/
.classpath
.project
# IntelliJ, based on http://devnet.jetbrains.net/docs/DOC-1186
.idea/
*.iml
*.ipr
*.iws
# logs and trace
*.log
*.trace
*.dat
# vi swap
*.swp
# Backup Files
*.bak
*.old
# SVN metadata
.svn/
# Mac
.DS_Store
# gradle
.gradle
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================================
For codegen/src/main/resources/ServiceComb/*
For cli/src/test/resources/swagger.yaml
For codegen/src/test/resources/swagger.yaml
================================================================
This product bundles files from swagger-codegen which is licensed under the Apache License v2.
For details, see https://github.com/swagger-api/swagger-codegen
================================================================
For codegen/src/main/resources/examples/*
================================================================
This product bundles files from swagger-codegen which is licensed under the Apache License v2.
For details, see https://github.com/OAI/OpenAPI-Specification
================================================
FILE: NOTICE
================================================
Apache ServiceComb Toolkit
Copyright 2019-present The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
================================================
FILE: README-ZH.md
================================================
# Toolkit | [English](./README.md) [](https://travis-ci.org/apache/servicecomb-toolkit?branch=master)[](https://coveralls.io/github/apache/servicecomb-toolkit?branch=master)[](https://www.apache.org/licenses/LICENSE-2.0.html)[](https://sonarcloud.io/dashboard?id=servicecomb-toolkit) [](https://gitter.im/ServiceCombUsers/Lobby)
Apache ServiceComb Toolkit 是基于契约的微服务开发工具套件
> 贡献者: 这个项目缺少维护者,如果您愿意为项目维护提供支持,请联系我们,可以将您加入项目的commiter群组,继续维护该项目.
> 用户:这个项目缺少维护者,在我们找到持续的维护者之前,建议您尽可能不要使用这个项目,避免碰到问题得不到技术支持.
## 1 简介
### 1.1 目标
* 提供契约、代码、文档相互转换及校验的能力,帮助用户一键式快速构建基于流行微服务框架和流行编程模型的微服务工程,降低微服务入门成本,使用户聚焦业务开发,提升遗留系统重构、开发效率。

### 1.2 特性
* 遗留应用提取契约文件
在基于SpringMVC/POJO/JAX-RS模型开发的应用中,一键提取符合OpenAPI规范的服务契约文件。
* 契约文件生成微服务工程
输入符合OpenAPI规范的服务契约,一键生成以ServiceComb/SpringCloud/Swagger为底座,以及以SpringMVC/POJO/JAX-RS或SpringBoot为开发模型的微服务项目。
* 契约与代码一致性校验
校验应用的实际实现(如数据和服务API)是否与样本服务契约描述一致。
* 契约的风格校验和兼容性校验
风格校验检查契约是否符合[OAS 3.0.2规范][openapi-3.0.2]以及自定义的规则; 兼容性校验检查新旧两个版本的OAS的兼容性
* 契约/代码生成文档
输入符合OpenAPI规范的服务契约,一键生成html格式的文档。
* Todo List
* 支持gradle plugin, eclipse plugin, intellij plugin。
* 支持word、pdf等流行格式文档。
* 支持契约增量生成代码。
* 工具能力服务化。
* Server端自动/半自动测试
* Interface匹配性校验
* 支持生成包含连接Mysql/Redis等常见DB的代码片段的微服务脚手架
### 1.3 适用场景
* 集成多厂商应用的企业
问题:厂商数据、服务标准不一致,开发语言、习惯、框架不一致,集成商难集成,企业难管控。
措施:通过统一定义的接口描述标准(服务契约),使用工具套件一键生成基于指定微服务框架的微服务工程,并且通过服务契约校验手段协同维护整体系统的一致性。以此协调多个开发团队,降低沟通成本且避免后期的混乱。
* 遗留系统微服务化快速改造
问题:用户需要额外学习和理解微服务及相关框架后,再设计微服务工程,学习成本高。
措施:使用工具套件分析遗留应用提取服务契约,再一键生成基于指定微服务框架的微服务工程后,即可聚焦业务开发,减少用户对微服务框架的学习成本。
## 2 设计
### 2.1 主体架构

### 2.2 工作原理

## 3 快速入门
### 3.1 从源码构建工具和插件
构建环境要求:
* [Java 8](http://java.oracle.com)
* [Apache maven 3.5.0 or greater](http://maven.apache.org/)
```shell
# 从github获取toolkit最新源码
$ git clone https://github.com/apache/servicecomb-toolkit.git
$ cd toolkit
# 构建打包
$ mvn clean install
```
### 3.2 使用toolkit-maven-plugin插件
#### 3.2.1 配置
在maven项目的pom文件中配置
```xml
org.apache.servicecomb.toolkit
toolkit-maven-plugin
0.3.0-SNAPSHOT
code
yaml
html
./target
./contract
./target/contract
./contract
all
domain.orgnization.project
sample
0.1.0-SNAPSHOT
domain.orgnization.project.sample
ServiceComb
servicecomb-provider
servicecomb-consumer
value
value
...
value
```
#### 3.2.2 命令
```shell
# 生成契约,文档和微服务工程
mvn toolkit:generate
# 校验代码和契约一致性
mvn toolkit:verify
```
#### 3.2.2.1 解析代码,生成微服务代码工程、OpenAPI规范契约、文档
配置项(不显式设置 `` 则使用默认配置)
例:
```xml
org.apache.servicecomb.toolkit
toolkit-maven-plugin
0.3.0-SNAPSHOT
code
./target
all
```
运行命令
```shell
mvn toolkit:generate
```
代码生成契约现已支持以下注解(类级别)编写的restful接口
>RestController, RestSchema, RpcSchema, RequestMapping
代码生成契约时,restful接口方法修饰符必须指定为public
#### 3.2.2.2 解析契约,生成微服务工程、文档
配置项(不显式设置 `` 则使用默认配置)
例:
```xml
org.apache.servicecomb.toolkit
toolkit-maven-plugin
0.3.0-SNAPSHOT
contract
./contract
./target
provider
```
运行命令
```shell
mvn toolkit:generate
```
#### 3.2.2.3 代码和契约一致性校验
配置项
例:
```xml
org.apache.servicecomb.toolkit
toolkit-maven-plugin
0.3.0-SNAPSHOT
code
./contract
```
运行命令
```shell
mvn toolkit:verify
```
### 3.3 使用toolkit cli工具
#### 3.3.0 获取
* 如果你使用的是正式发布版本(>=0.2.0),可以在解压二进制包后直接使用里面的脚本文件
* 在Linux及Mac环境,请使用cli.sh
* 在Windows环境,请使用cli.cmd
* 如果你是通过源码构建,可以将`cli/scripts/cli.*`与`cli/target/bin/toolkit-cli-{version}.jar`放置在同一目录,然后根据不同环境选择不同脚本
以下所有示例均通过Linux环境的cli.sh进行介绍
```shell
$ ./cli.sh help
```
#### 3.3.1 契约生成微服务工程
```shell
$ ./cli.sh codegenerate -m ServiceComb -i swagger.yaml -o ./project -p SpringMVC
```
> **codegenerate** 命令选项说明:
* -m, --microservice-framework : 指定微服务框架,现支持ServiceComb
例:-m ServiceComb
* -p, --programming-model : 指定编程模型,可选JAX-RS,POJO,SpringMVC,SpringBoot
例:-p SpringMvc
* -i, --input : 指定遵循OpenAPI规范的契约文件,支持yaml和json格式,支持指定本地和网络文件
例:-i http://petstore.swagger.io/v2/swagger.json
* -o, --output : 生成的项目代码输出路径
例:-o ./project
* --group-id : 指定生成的项目的group id
例:--group-id com.demo
* --artifact-id : 指定生成的项目的artifact id
例:--artifact-id springmvc-example
* --artifact-version : 指定生成的项目的artifact version
例:--artifact-version 1.0.0
* --api-package : 指定生成项目的api package
例:--api-package com.demo.api
* --model-package : 指定生成项目的model package
例:--model-package com.demo.model
* -t, --service-type : 指定生成的微服务项目的微服务类型。可选值为provider,consumer,all
例:--service-type provider
* --properties : 指定额外的属性值,这些属性值可以被mustach模板引用
例:--properties applicationId=app,providerServiceId=provider
#### 3.3.2 契约生成文档
```shell
$ ./cli.sh docgenerate -i swagger.yaml -o ./document
```
> **docgenerate** 命令选项说明:
* -i, --input : 指定遵循OpenAPI规范的契约文件,支持yaml和json格式,支持指定本地和网络文件
例:-i http://petstore.swagger.io/v2/swagger.json
* -o, --output : 文档输出路径
例:-o ./document
* -f, --format : 指定输出文档风格,现支持swagger-ui
例:-f swagger-ui
#### 3.3.3 契约风格检查
```shell
$ ./cli.sh checkstyle -r style-check-rules.yaml -f oas.yaml
or
$ ./cli.sh cs -r style-check-rules.yaml -f oas.yaml
```
> **checkstyle** Command argument
* -r, --rules-file. Rules properties file.
* -f, --file. OpenAPI v3 spec yaml.
见[风格检查规则](oas-validator/README-ZH.md)
#### 3.3.4 契约兼容性检查
```shell
$ ./cli.sh checkcompatibility left-oas.yaml right-oas.yaml
或者
$ ./cli.sh cc left-oas.yaml right-oas.yaml
```
> **checkcompatibility** Command argument
* <files> Two OpenAPI v3 spec yaml file
见[兼容性检查规则](oas-validator/README-ZH.md)
### 3.4 使用案例
可以在[这里](./samples/README-ZH.md)找到使用插件的一些示例
## 4 社区互动
* [提交issues](https://issues.apache.org/jira/browse/SCB)
* [gitter聊天室](https://gitter.im/ServiceCombUsers/Lobby)
* 邮件列表: [订阅](mailto:dev-subscribe@servicecomb.apache.org) [浏览](https://lists.apache.org/list.html?dev@servicecomb.apache.org)
## 5 参与开发
See [Pull Request Guide](http://servicecomb.apache.org/developers/submit-codes/) for details.
================================================
FILE: README.md
================================================
# Toolkit | [中文](./README-ZH.md) [](https://travis-ci.org/apache/servicecomb-toolkit?branch=master)[](https://coveralls.io/github/apache/servicecomb-toolkit?branch=master)[](https://www.apache.org/licenses/LICENSE-2.0.html)[](https://sonarcloud.io/dashboard?id=servicecomb-toolkit) [](https://gitter.im/ServiceCombUsers/Lobby)
Apache ServiceComb Toolkit is a contract-based microservice development toolkit
> Notice to contributors: this project is not active due to lack of maintainers. If you are interested in this project, please cantact us and we will help you to be a committer.
> Notice to users: this project is not active due to lack of maintainers. Before we find enough resources, do not use this project if possible.
## 1 Introduction
### 1.1 Conceptions
* Provides the ability to convert and verify contracts, code, and documents, helping users quickly build microservice projects based on popular microservices frameworks and popular programming models, reducing the cost of microservices entry, enabling users to focus on business development, enhance refactoring and development efficiency.

### 1.2 Features
* Code extraction service contract
In applications developed based on the SpringMVC/POJO/JAX-RS model, one-click generation of service contract files conforming to the OpenAPI specification.
* Service contract generation microservice project
Enter a service contract that conforms to the OpenAPI specification, one-click generation of a microservice project with ServiceComb/SpringCloud/Swagger as the base microservice framework and SpringMVC/POJO/JAX-RS or SpringBoot as programming model.
* Service contract and code consistency check
Verify that the actual implementation of the application (such as the data and service API) is consistent with the agreed service contract description.
* Service contract style checking and compatibility checking
The style checking checks whether the contract conforms to [OAS 3.0.2 specification] [openapi-3.0.2] and custom rules; the compatibility checking checks whether new OAS spec compatible with old spec
* Service contract/code generation document
Enter a service contract that conforms to the OpenAPI specification, one-click generation of a document in html format.
* Todo List
* Support gradle plugin, eclipse plugin, intellij plugin.
* Support for generating popular format documents such as word, pdf.
* Support contract incremental generation code.
* Make capability as a service.
* Server-side automatic / semi-automatic test
* Interface matching check
* Support for generating microservice scaffolding containing code snippets that connect to common DBs such as Mysql / Redis
### 1.3 Applicable Scene
* For users who integrate multi-vendor applications
Scene: the development languages, habits, and frameworks of different vendors are different, the entire system data and service standards are inconsistent, users are difficult to integrate, and it is difficult to manage and control the final delivery quality.
Solution:Through a uniformly defined interface description standard (service contract), a toolkit is used to generate a microservice project based on a specified microservices framework, and the consistency of the whole system is coordinated through service contract verification. Coordinate multiple development teams to reduce communication costs and avoid post-chaos.
* For users who have evolved from legacy systems to microservices
Scene: additional learning and understanding of the microservices-related framework details is required before the microservices project can be designed, built, and developed according to the selected microservices framework. For users, Need to be distracted to focus on things outside the business.
Solution: Using the toolkit to analyze the legacy application extraction service contract, and then generate the microservices project based on the specified microservices framework, you can focus on business development and reduce the learning cost of the microservices framework.
## 2 Design
### 2.1 Architecture

### 2.2 Working Principle

## 3 Quick Start
### 3.1 Build tool and plugins from source
> Build environment requirements
* [Java 8](http://java.oracle.com)
* [Apache maven 3.5.0 or greater](http://maven.apache.org/)
```shell
# Get the latest source code for toolkit from github
$ git clone https://github.com/apache/servicecomb-toolkit.git
$ cd toolkit
# Build package
$ mvn clean install
```
### 3.2 Use the toolkit-maven-plugin plugin
#### 3.2.1 configuration
Configured in the pom file of the maven project
```xml
org.apache.servicecomb.toolkit
toolkit-maven-plugin
0.3.0-SNAPSHOT
code
yaml
html
./target
./contract
./target/contract
./contract
all
domain.orgnization.project
sample
0.1.0-SNAPSHOT
domain.orgnization.project.sample
value
value
...
value
```
#### 3.2.2 Command
```shell
# Generating contract, document and microservice project
mvn toolkit:generate
# Verify code and contract consistency
mvn toolkit:verify
```
#### 3.2.2.1 Extract the microservice project, OpenAPI contract file and document from the code
Configuration(use default configuration if not set ``)
example
```xml
org.apache.servicecomb.toolkit
toolkit-maven-plugin
0.3.0-SNAPSHOT
code
./target
all
```
Run in shell
```shell
mvn toolkit:generate
```
When generating contracts from code,support for identifying restful interfaces written by the following annotations (class level)
>RestController, RestSchema, RpcSchema, RequestMapping
When generating contracts from code,the restful interface method access modifier must be specified as public
#### 3.2.2.2 Generate the microservice project and document from contract
Configuration(use default configuration if not set ``)
example
```xml
org.apache.servicecomb.toolkit
toolkit-maven-plugin
0.3.0-SNAPSHOT
contract
./target
./contract
provider
```
Run in shell
```shell
mvn toolkit:generate
```
#### 3.2.2.3 Contract verify
Configuration
example
```xml
org.apache.servicecomb.toolkit
toolkit-maven-plugin
0.3.0-SNAPSHOT
code
./contract
```
Run in shell
```shell
mvn toolkit:verify
```
### 3.3 Use the toolkit cli
* If you are using the official release version ( >=0.2.0 ), you can use the script files directly after decompressing the binary package
* In Linux and Mac environment, please use cli.sh
* In the Windows environment, please use cli.cmd
* If you are building from source, you can put `cli/scripts/cli.*` in the same directory as`cli/target/bin/toolkit-cli-{version}.jar` and then choose different scripts according to different environments
All the examples below are introduced through cli.sh for Linux environment
```shell
$ ./cli.sh help
```
#### 3.3.1 Service contract generation microservice project
```shell
$ ./cli.sh codegenerate -m ServiceComb -i swagger.yaml -o ./project -p SpringMVC
```
> **codegenerate** Command option
* -m, --microservice-framework. Specify microservices framework, now supports ServiceComb.
e.g.:-m ServiceComb
* -p, --programming-model. Specify programming model, optional JAX-RS, POJO, SpringMVC, SpringBoot.
e.g.:-p SpringMvc
* -i, --input. Specifies contract files that follow the OpenAPI specification, supports yaml and json formats, and supports specifying local and network files.
e.g.:-i http://petstore.swagger.io/v2/swagger.json
* -o, --output. Generated project code output path.
e.g.:-o ./project
* --group-id. Specify the group id of the generated project.
e.g.:--group-id com.demo
* --artifact-id. Specify the artifact id of the generated project.
e.g.:--artifact-id springmvc-example
* --artifact-version. Specify the artifact version of the generated project.
e.g.:--artifact-version 1.0.0
* --api-package : Specify the api package of the generated project.
e.g.:--api-package com.demo.api
* --model-package : Specify the model package of the generated project.
e.g.:--model-package com.demo.model
* -t, --service-type : Specify microservice type of generated microservice project. optional value is provider,consumer,all
e.g.:--service-type provider
* --properties : Specify additional attribute values that can be referenced by the mustache template
e.g.:--properties applicationId=app,providerServiceId=provider
#### 3.3.2 Service contract generation document
```shell
$ ./cli.sh docgenerate -i swagger.yaml -o ./document
```
> **docgenerate** Command option
* -i, --input. Specifies contract files that follow the OpenAPI specification, supports yaml and json formats, and supports specifying local and network files.
e.g:-i http://petstore.swagger.io/v2/swagger.json
* -o, --output. Document output path.
e.g:-o ./document
* -f, --format. Specifies the output document format, now supports swagger-ui
e.g:-f swagger-ui
#### 3.3.3 Service contract style checking
```shell
$ ./cli.sh checkstyle -r style-check-rules.yaml -f oas.yaml
or
$ ./cli.sh cs -r style-check-rules.yaml -f oas.yaml
```
> **checkstyle** Command argument
* -r, --rules-file. Rules properties file.
* -f, --file. OpenAPI v3 spec yaml.
See [style check rules](oas-validator/README.md)
#### 3.3.4 Service contract compatibility checking
```shell
$ ./cli.sh checkcompatibility left-oas.yaml right-oas.yaml
or
$ ./cli.sh cc left-oas.yaml right-oas.yaml
```
> **checkcompatibility** Command argument
* <files> Two OpenAPI v3 spec yaml file
See [compatibilty check rules](oas-validator/README.md)
### 3.4 Use case
some example of using plugin can be found [here](./samples)
## 4 Contact us
* [issues](https://issues.apache.org/jira/browse/SCB)
* [gitter](https://gitter.im/ServiceCombUsers/Lobby)
* mailing list: [subscribe](mailto:dev-subscribe@servicecomb.apache.org) [view](https://lists.apache.org/list.html?dev@servicecomb.apache.org)
## 5 Contribute
PR: [Pull request](https://github.com/apache/servicecomb-toolkit/pulls)
================================================
FILE: cli/pom.xml
================================================
toolkit
org.apache.servicecomb.toolkit
0.3.0-SNAPSHOT
../
4.0.0
cli
org.apache.servicecomb.toolkit.cli.ToolkitMain
io.airlift
airline
com.google.code.findbugs
annotations
org.apache.servicecomb.toolkit
codegen
junit
junit
test
org.apache.servicecomb.toolkit
docgen
org.apache.logging.log4j
log4j-slf4j-impl
org.apache.logging.log4j
log4j-api
org.apache.logging.log4j
log4j-core
org.apache.servicecomb.toolkit
oas-validator-style
org.apache.servicecomb.toolkit
oas-validator-compatibility
com.github.stefanbirkner
system-rules
test
org.apache.maven.plugins
maven-compiler-plugin
org.apache.maven.plugins
maven-resources-plugin
org.springframework.boot
spring-boot-maven-plugin
true
${main.class}
target/bin
toolkit-cli-${project.version}
repackage
src/main/resources
true
================================================
FILE: cli/scripts/cli.cmd
================================================
@REM Licensed to the Apache Software Foundation (ASF) under one or more
@REM contributor license agreements. See the NOTICE file distributed with
@REM this work for additional information regarding copyright ownership.
@REM The ASF licenses this file to You under the Apache License, Version 2.0
@REM (the "License"); you may not use this file except in compliance with
@REM the License. You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing, software
@REM distributed under the License is distributed on an "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@REM See the License for the specific language governing permissions and
@REM limitations under the License.
@echo off && rem
set SUCCESS_CODE=0
set ERROR_CODE=1
@REM check if java install
if "%JAVA_HOME%" == "" goto JAVA_HOME_ERROR
if not exist "%JAVA_HOME%\bin\java.exe" goto JAVA_HOME_ERROR
set jarFile=
for /f "delims=" %%t in ('dir /S /B cli-*.jar') do set jarFile=%%t
@REM check if jar file exist
if "%jarFile%" == "" (
echo Error: cli.jar not exist. make sure it is placed in the current directory or subdirectory of this script
exit /B %ERROR_CODE%
)
set allparam=
:param
set str=%1
if "%str%"=="" (
goto end
)
set allparam=%allparam% %str%
shift /0
goto param
:end
if "%allparam%"=="" (
goto eof
)
rem remove left right blank
:intercept_left
if "%allparam:~0,1%"==" " set "allparam=%allparam:~1%"&goto intercept_left
:intercept_right
if "%allparam:~-1%"==" " set "allparam=%allparam:~0,-1%"&goto intercept_right
:eof
java -Dscript.name="cli.cmd" -jar %jarFile% %allparam%
exit /B %SUCCESS_CODE%
:JAVA_HOME_ERROR
echo.
echo Error: JAVA_HOME invalid in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
exit /B %ERROR_CODE%
================================================
FILE: cli/scripts/cli.sh
================================================
#!/bin/bash
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
# check if java install
if [ -z "$JAVA_HOME" -o ! -f "$JAVA_HOME/bin/java" ]; then
echo Error: JAVA_HOME invalid in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
exit 1
fi
# resolve links - $0 may be a softlink
PRG="$0"
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
fi
done
shellDir=`dirname "$PRG"`
# check if jar file exist
jarFile=$(find ${shellDir} -name "cli-*.jar" | head -n 1)
if [[ ! -f ${jarFile} ]]; then
echo "error: cli.jar not exist. make sure it is placed in the current directory or subdirectory of this script"
exit 1
fi
java -Dscript.name="cli.sh" -jar ${jarFile} $*
================================================
FILE: cli/src/main/java/org/apache/servicecomb/toolkit/cli/CheckCompatibility.java
================================================
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.servicecomb.toolkit.cli;
import io.airlift.airline.Command;
@Command(name = "checkcompatibility",
description = "(Or cc for abbr). Check compatibility for two OpenAPI v3 spec yamls, right one should be semantically compatible with left one")
public class CheckCompatibility extends CheckCompatibilityBase {
}
================================================
FILE: cli/src/main/java/org/apache/servicecomb/toolkit/cli/CheckCompatibilityAbbr.java
================================================
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.servicecomb.toolkit.cli;
import io.airlift.airline.Command;
@Command(name = "cc",
description = "Check compatibility for two OpenAPI v3 spec yamls,"
+ " right one should be semantically compatible with left one",
hidden = true)
public class CheckCompatibilityAbbr extends CheckCompatibilityBase {
}
================================================
FILE: cli/src/main/java/org/apache/servicecomb/toolkit/cli/CheckCompatibilityBase.java
================================================
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.servicecomb.toolkit.cli;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.StringJoiner;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.FileUtils;
import org.apache.servicecomb.toolkit.oasv.common.OasObjectPropertyLocation;
import org.apache.servicecomb.toolkit.oasv.compatibility.CompatibilityCheckParser;
import org.apache.servicecomb.toolkit.oasv.compatibility.factory.DefaultOasSpecDiffValidatorFactory;
import org.apache.servicecomb.toolkit.oasv.diffvalidation.api.OasDiffValidationContext;
import org.apache.servicecomb.toolkit.oasv.diffvalidation.api.OasDiffViolation;
import org.apache.servicecomb.toolkit.oasv.diffvalidation.api.OasSpecDiffValidator;
import org.apache.servicecomb.toolkit.oasv.diffvalidation.factory.OasSpecDiffValidatorFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import io.airlift.airline.Arguments;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.parser.core.models.SwaggerParseResult;
public class CheckCompatibilityBase implements Runnable {
private final Logger LOGGER = LoggerFactory.getLogger(this.getClass());
@Arguments(
title = "files", required = true,
description = "Two OpenAPI v3 spec yamls"
)
private List filePaths;
@Override
public void run() {
if (filePaths.size() != 2) {
LOGGER.error("Require 2 files");
return;
}
OpenAPI oldOas = null;
OpenAPI newOas = null;
try {
oldOas = loadOpenApi(filePaths.get(0));
newOas = loadOpenApi(filePaths.get(1));
} catch (Exception e) {
LOGGER.error(e.getMessage());
return;
}
OasSpecDiffValidator diffValidator = createOasSpecDiffValidator();
List violations = diffValidator.validate(createContext(oldOas, newOas), oldOas, newOas);
if (CollectionUtils.isNotEmpty(violations)) {
for (OasDiffViolation violation : violations) {
LOGGER.info("left : {}\nright : {}\nerror : {}\n------",
OasObjectPropertyLocation.toPathString(violation.getLeftLocation()),
OasObjectPropertyLocation.toPathString(violation.getRightLocation()),
violation.getError()
);
}
throw new ValidationFailedException("check not passed");
}
LOGGER.info("Everything is good");
}
private OpenAPI loadOpenApi(String filePath) throws IOException {
String yaml = loadFileContent(filePath);
SwaggerParseResult oldParseResult = CompatibilityCheckParser.parseYaml(yaml);
OpenAPI openAPI = oldParseResult.getOpenAPI();
if (openAPI == null) {
StringJoiner errors = new StringJoiner("\n", "Parse errors:", "");
if (CollectionUtils.isNotEmpty(oldParseResult.getMessages())) {
for (String message : oldParseResult.getMessages()) {
errors.add(message);
}
}
throw new RuntimeException(errors.toString());
}
return openAPI;
}
private OasSpecDiffValidator createOasSpecDiffValidator() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(
DefaultOasSpecDiffValidatorFactory.class.getPackage().getName());
try {
OasSpecDiffValidatorFactory diffValidatorFactory = ctx.getBean(OasSpecDiffValidatorFactory.class);
return diffValidatorFactory.create();
} finally {
ctx.close();
}
}
private String loadFileContent(String filePath) throws IOException {
Path specPath = Paths.get(filePath);
specPath.toAbsolutePath().toString();
return FileUtils.readFileToString(specPath.toFile());
}
private OasDiffValidationContext createContext(OpenAPI leftOpenAPI, OpenAPI rightOpenAPI) {
OasDiffValidationContext context = new OasDiffValidationContext(leftOpenAPI, rightOpenAPI);
return context;
}
}
================================================
FILE: cli/src/main/java/org/apache/servicecomb/toolkit/cli/CheckStyle.java
================================================
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.servicecomb.toolkit.cli;
import io.airlift.airline.Command;
@Command(name = "checkstyle",
description = "(Or cs for abbr). Check style for OpenAPI v3 spec yaml.")
public class CheckStyle extends CheckStyleBase {
}
================================================
FILE: cli/src/main/java/org/apache/servicecomb/toolkit/cli/CheckStyleAbbr.java
================================================
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.servicecomb.toolkit.cli;
import io.airlift.airline.Command;
@Command(name = "cs",
description = "Check style for OpenAPI v3 spec yaml", hidden = true)
public class CheckStyleAbbr extends CheckStyleBase {
}
================================================
FILE: cli/src/main/java/org/apache/servicecomb/toolkit/cli/CheckStyleBase.java
================================================
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.servicecomb.toolkit.cli;
import com.google.common.base.Charsets;
import io.airlift.airline.Option;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.parser.core.models.SwaggerParseResult;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Properties;
import java.util.StringJoiner;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.FileUtils;
import org.apache.servicecomb.toolkit.oasv.FactoryOptions;
import org.apache.servicecomb.toolkit.oasv.common.OasObjectPropertyLocation;
import org.apache.servicecomb.toolkit.oasv.style.StyleCheckParser;
import org.apache.servicecomb.toolkit.oasv.style.factory.ValidatorFactoryComponents;
import org.apache.servicecomb.toolkit.oasv.validation.api.OasSpecValidator;
import org.apache.servicecomb.toolkit.oasv.validation.api.OasValidationContext;
import org.apache.servicecomb.toolkit.oasv.validation.api.OasViolation;
import org.apache.servicecomb.toolkit.oasv.validation.factory.OasSpecValidatorFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
public class CheckStyleBase implements Runnable {
private final Logger LOGGER = LoggerFactory.getLogger(this.getClass());
@Option(name = { "-r", "--rules-file" }, title = "rules properties file", required = true,
description = "rules properties file")
private String rulesFile;
@Option(name = { "-f", "--file" }, title = "OpenAPI v3 spec yaml", required = true,
description = "OpenAPI v3 spec yaml")
private String filePath;
@Override
public void run() {
FactoryOptions factoryOptions;
try {
factoryOptions = loadFactoryOptions();
} catch (IOException e) {
throw new RuntimeException(e);
}
String yaml = null;
try {
yaml = loadFileContent(filePath);
} catch (IOException e) {
throw new RuntimeException(e);
}
SwaggerParseResult parseResult = StyleCheckParser.parseYaml(yaml);
OpenAPI openAPI = parseResult.getOpenAPI();
if (openAPI == null) {
StringJoiner sj = new StringJoiner("\n");
if (CollectionUtils.isNotEmpty(parseResult.getMessages())) {
for (String message : parseResult.getMessages()) {
sj.add(message);
}
}
throw new RuntimeException(sj.toString());
}
OasSpecValidator oasSpecValidator = createOasSpecValidator(factoryOptions);
List violations = oasSpecValidator.validate(createContext(openAPI), openAPI);
if (CollectionUtils.isNotEmpty(violations)) {
for (OasViolation violation : violations) {
LOGGER.info("path : {}\nerror : {}\n------",
OasObjectPropertyLocation.toPathString(violation.getLocation()), violation.getError());
}
throw new ValidationFailedException("check not passed");
}
LOGGER.info("Everything is good");
}
private OasSpecValidator createOasSpecValidator(FactoryOptions factoryOptions) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(
ValidatorFactoryComponents.class);
try {
OasSpecValidatorFactory oasSpecValidatorFactory = ctx.getBean(OasSpecValidatorFactory.class);
return oasSpecValidatorFactory.create(factoryOptions);
} finally {
ctx.close();
}
}
private String loadFileContent(String filePath) throws IOException {
Path specPath = Paths.get(filePath);
return FileUtils.readFileToString(specPath.toFile(), Charsets.UTF_8);
}
private OasValidationContext createContext(OpenAPI openAPI) {
OasValidationContext oasValidationContext = new OasValidationContext(openAPI);
return oasValidationContext;
}
private FactoryOptions loadFactoryOptions() throws IOException {
Path specPath = Paths.get(rulesFile);
specPath.toAbsolutePath().toString();
Properties properties = new Properties();
try (FileInputStream fis = new FileInputStream(specPath.toFile())) {
properties.load(fis);
}
return new FactoryOptions(properties);
}
}
================================================
FILE: cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java
================================================
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.servicecomb.toolkit.cli;
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
import java.io.File;
import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Arrays;
import java.util.Collections;
import java.util.Optional;
import org.apache.servicecomb.toolkit.CodeGenerator;
import org.apache.servicecomb.toolkit.GeneratorFactory;
import org.apache.servicecomb.toolkit.codegen.ProjectMetaConstant;
import org.openapitools.codegen.config.CodegenConfigurator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.airlift.airline.Command;
import io.airlift.airline.Option;
@Command(name = "codegenerate",
description = "Generate multiple models of microservice project by OpenAPI specification file")
public class CodeGenerate implements Runnable {
private final static Logger LOGGER = LoggerFactory.getLogger(CodeGenerate.class);
@Option(name = {"-p", "--programming-model"}, title = "programming model", required = false,
description = "programming model, as SpringMVC, POJO, JAX-RS, and SpringBoot")
private String programmingModel;
@Option(name = {"-m", "--microservice-framework"}, title = "framework",
description = "microservice-framework")
private String framework = "ServiceComb";
@Option(name = {"-i", "--input"}, title = "OpenAPI specification file", required = true,
description = "location of the OpenAPI specification file, as URL or file (required)")
private String specFile;
@Option(name = {"-o", "--output"}, title = "output directory",
description = "location of the generated document (current dir by default)")
private String output = "";
@Option(name = {"--group-id"}, title = "group id",
description = "groupId in generated microservice project")
private String groupId;
@Option(name = {"--artifact-id"}, title = "artifact id",
description = "artifact id in generated microservice project")
private String artifactId;
@Option(name = {"--artifact-version"}, title = "artifact version",
description = "artifact version in generated microservice project")
private String artifactVersion;
@Option(name = {"--api-package"}, title = "api package",
description = "api package in generated microservice project")
private String apiPackage;
@Option(name = {"--model-package"}, title = "model package",
description = "model package in generated microservice project")
private String modelPackage;
@Option(name = {"-t", "--service-type"}, title = "service type",
description = "microservice type of generated microservice project. optional value is provider,consumer,all")
private String serviceType = "all";
@Option(
name = {"--properties"},
title = "additional properties",
description =
"usage: --properties name=value,name=value. These Properties can be referenced by the mustache templates."
+ " You can specify one or more value")
private String properties;
@Override
public void run() {
CodeGenerator codegenerator = GeneratorFactory.getGenerator(CodeGenerator.class, "default");
if (codegenerator == null) {
LOGGER.warn("Not CodeGenerator found");
return;
}
CodegenConfigurator configurator = new CodegenConfigurator();
// add additional property
Optional.ofNullable(properties).ifPresent(properties ->
Arrays.stream(properties.split(",")).forEach(property -> {
String[] split = property.split("=");
if (split != null && split.length == 2) {
configurator.addAdditionalProperty(split[0], split[1]);
}
})
);
configurator.setOutputDir(output)
.setGroupId(groupId)
.setArtifactId(artifactId)
.setArtifactVersion(artifactVersion)
.setLibrary(programmingModel)
.setGeneratorName(framework)
.setApiPackage(apiPackage)
.setModelPackage(modelPackage);
configurator.addAdditionalProperty(ProjectMetaConstant.SERVICE_TYPE, serviceType);
if (isNotEmpty(specFile)) {
File contractFile = new File(specFile);
if (contractFile.isDirectory()) {
try {
Files.walkFileTree(Paths.get(contractFile.toURI()), new SimpleFileVisitor() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
configurator.setInputSpec(file.toFile().getCanonicalPath())
.addAdditionalProperty("apiName", file.toFile().getName().split("\\.")[0]);
try {
codegenerator.configure(Collections.singletonMap("configurator", configurator));
codegenerator.generate();
} catch (RuntimeException e) {
throw new RuntimeException("Failed to generate code base on file " + file.toFile().getName());
}
return super.visitFile(file, attrs);
}
});
} catch (RuntimeException | IOException e) {
LOGGER.error(e.getMessage());
return;
}
} else {
configurator.setInputSpec(specFile).addAdditionalProperty("apiName", contractFile.getName().split("\\.")[0]);
codegenerator.configure(Collections.singletonMap("configurator", configurator));
codegenerator.generate();
}
LOGGER.info("Success to generate code, the directory is: {}", output);
}
}
}
================================================
FILE: cli/src/main/java/org/apache/servicecomb/toolkit/cli/DocGenerate.java
================================================
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.servicecomb.toolkit.cli;
import java.io.File;
import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.HashMap;
import java.util.Map;
import org.apache.servicecomb.toolkit.DocGenerator;
import org.apache.servicecomb.toolkit.GeneratorFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.airlift.airline.Command;
import io.airlift.airline.Option;
import io.swagger.parser.OpenAPIParser;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.parser.core.models.SwaggerParseResult;
@Command(name = "docgenerate", description = "Generate document by OpenAPI specification file")
public class DocGenerate implements Runnable {
private final static Logger LOGGER = LoggerFactory.getLogger(CodeGenerate.class);
@Option(name = {"-i", "--input"}, title = "OpenAPI specification file", required = true,
description = "location of the OpenAPI specification file, as URL or file (required)")
private String specFile;
@Option(name = {"-f", "--format"}, title = "document format", required = false,
description = "format of document, as swagger-ui or asciidoc-html (swagger-ui by default)")
private String format = "swagger-ui";
@Option(name = {"-o", "--output"}, title = "output directory",
description = "location of the generated document (current dir by default)")
private String output = "";
@Override
public void run() {
try {
Path specPath = Paths.get(specFile);
String[] fileName = new String[1];
DocGenerator docGenerator = GeneratorFactory.getGenerator(DocGenerator.class, format);
Map docGeneratorConfig = new HashMap<>();
if (Files.isDirectory(specPath)) {
Files.walkFileTree(specPath, new SimpleFileVisitor() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
docGeneratorConfig.put("contractContent", parseOpenApi(specPath));
docGeneratorConfig.put("outputPath",
output + File.separator + file.toFile().getName().substring(0, file.toFile().getName().indexOf(".")));
docGenerator.configure(docGeneratorConfig);
docGenerator.generate();
return super.visitFile(file, attrs);
}
});
} else if (Files.isRegularFile(specPath)) {
fileName[0] = specPath.toFile().getName();
docGeneratorConfig.put("contractContent", parseOpenApi(specPath));
docGeneratorConfig.put("outputPath", output + File.separator + new File(specFile).getName()
.substring(0, new File(specFile).getName().indexOf(".")));
docGenerator.configure(docGeneratorConfig);
docGenerator.generate();
} else {
fileName[0] = specFile;
docGeneratorConfig.put("contractContent", parseOpenApi(specPath));
docGeneratorConfig.put("outputPath", output + File.separator + new File(specFile).getName()
.substring(0, new File(specFile).getName().indexOf(".")));
docGenerator.configure(docGeneratorConfig);
docGenerator.generate();
}
LOGGER.info("Success to generate document, the directory is: {}", output);
} catch (IOException e) {
LOGGER.error(e.getMessage());
}
}
public OpenAPI parseOpenApi(Path file) {
SwaggerParseResult swaggerParseResult = new OpenAPIParser()
.readLocation(file.toString(), null, null);
OpenAPI openAPI = swaggerParseResult.getOpenAPI();
return openAPI;
}
}
================================================
FILE: cli/src/main/java/org/apache/servicecomb/toolkit/cli/ToolkitMain.java
================================================
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.servicecomb.toolkit.cli;
import java.io.IOException;
import java.util.Optional;
import java.util.Properties;
import org.apache.commons.lang3.StringUtils;
import io.airlift.airline.Cli;
import io.airlift.airline.Help;
public class ToolkitMain {
private static String projectVersion;
@SuppressWarnings("unchecked")
public static void main(String[] args) {
initialProjectVersion();
String scriptName = System.getProperty("script.name");
Cli.CliBuilder builder = null;
if (StringUtils.isNotEmpty(scriptName)) {
builder = Cli.builder(scriptName);
} else {
builder = Cli.builder("java -jar cli-" + projectVersion + ".jar");
}
builder.withDescription("Microservice development toolkit(version " + projectVersion
+ "). ");
builder.withDefaultCommand(Help.class);
builder.withCommands(
CodeGenerate.class, DocGenerate.class,
CheckStyle.class, CheckStyleAbbr.class,
CheckCompatibility.class, CheckCompatibilityAbbr.class,
Help.class
);
try {
Runnable cmd = builder.build().parse(args);
cmd.run();
} catch (ValidationFailedException ex) {
ex.printStackTrace(System.err);
System.exit(1);
}
}
private static void initialProjectVersion() {
Properties properties = new Properties();
try {
properties.load(ToolkitMain.class.getClassLoader().getResourceAsStream("application.properties"));
projectVersion = Optional.ofNullable(properties.getProperty("version")).orElse("unknown");
} catch (IOException e) {
e.printStackTrace();
}
}
}
================================================
FILE: cli/src/main/java/org/apache/servicecomb/toolkit/cli/ValidationFailedException.java
================================================
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.servicecomb.toolkit.cli;
public class ValidationFailedException extends RuntimeException {
public ValidationFailedException(String msg) {
super(msg);
}
}
================================================
FILE: cli/src/main/resources/application.properties
================================================
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
version=${project.version}
================================================
FILE: cli/src/main/resources/log4j2.xml
================================================
================================================
FILE: cli/src/test/java/org/apache/servicecomb/toolkit/cli/CliTest.java
================================================
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.servicecomb.toolkit.cli;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.ExpectedSystemExit;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import org.apache.commons.io.FileUtils;
public class CliTest {
@Rule
public final ExpectedSystemExit exit = ExpectedSystemExit.none();
@Test
public void testGenerateServiceCombCodeFromSingleContract() throws IOException {
String[] programModels = new String[] {"SpringMVC", "POJO", "JAX-RS", "SpringBoot"};
Path tempDir = Files.createTempDirectory(null);
Arrays.stream(programModels).forEach(model -> {
try {
Path tempFile = Paths.get(tempDir.toFile().getCanonicalPath() + "/" + model + "Server");
CliTest.class.getClassLoader().getResource("swagger.yaml");
String[] args = new String[] {
"codegenerate",
"-m",
"ServiceComb",
"-i",
Paths.get("./src/test/resources/swagger.yaml").toFile().getCanonicalPath(),
"-o",
tempFile.toFile().getCanonicalPath(),
"-p",
model,
"--properties",
"prop1=value,prop2=value"
};
Assert.assertTrue(!Files.exists(tempFile));
ToolkitMain.main(args);
Assert.assertTrue(Files.exists(tempFile));
Assert.assertTrue(FileUtils.sizeOfDirectory(tempFile.toFile()) > 0);
} catch (IOException e) {
e.printStackTrace();
}
});
tempDir.toFile().deleteOnExit();
}
@Test
public void testGenerateCodeFromMultiContract() throws IOException {
Path tempDir = Files.createTempDirectory(null);
Path tempFile = Paths.get(tempDir.toFile().getCanonicalPath() + "/ServiceComb");
String[] args = new String[] {
"codegenerate",
"-i",
Paths.get("./src/test/resources/contracts").toFile().getCanonicalPath(),
"--artifact-id",
"ServiceComb",
"--group-id",
"org.apache.servicecomb.demo",
"--artifact-version",
"0.0.1",
"--programming-model",
"SpringMVC",
"-o",
tempFile.toFile().getCanonicalPath()
};
Assert.assertTrue(!Files.exists(tempFile));
ToolkitMain.main(args);
Assert.assertTrue(Files.exists(tempFile));
Assert.assertTrue(FileUtils.sizeOfDirectory(tempFile.toFile()) > 0);
tempDir.toFile().deleteOnExit();
}
@Test
public void testCheckStyle() throws IOException {
exit.expectSystemExitWithStatus(1);
String[] args = new String[] {
"checkstyle",
"-r",
Paths.get("./src/test/resources/oas/style-rules.properties").toFile().getCanonicalPath(),
"-f",
Paths.get("./src/test/resources/oas/style.yaml").toFile().getCanonicalPath()
};
ToolkitMain.main(args);
}
@Test
public void testCheckStyleAbbr() throws IOException {
exit.expectSystemExitWithStatus(1);
String[] args = new String[] {
"cs",
"-r",
Paths.get("./src/test/resources/oas/style-rules.properties").toFile().getCanonicalPath(),
"-f",
Paths.get("./src/test/resources/oas/style.yaml").toFile().getCanonicalPath()
};
ToolkitMain.main(args);
}
@Test
public void testCheckCompatibility() throws IOException {
exit.expectSystemExitWithStatus(1);
String[] args = new String[] {
"checkcompatibility",
Paths.get("./src/test/resources/oas/compatibility-left.yaml").toFile().getCanonicalPath(),
Paths.get("./src/test/resources/oas/compatibility-right.yaml").toFile().getCanonicalPath()
};
ToolkitMain.main(args);
}
@Test
public void testCheckCompatibilityAbbr() throws IOException {
exit.expectSystemExitWithStatus(1);
String[] args = new String[] {
"cc",
Paths.get("./src/test/resources/oas/compatibility-left.yaml").toFile().getCanonicalPath(),
Paths.get("./src/test/resources/oas/compatibility-right.yaml").toFile().getCanonicalPath()
};
ToolkitMain.main(args);
}
}
================================================
FILE: cli/src/test/resources/contracts/CalculateEndpoint.yaml
================================================
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
---
swagger: "2.0"
info:
version: "1.0.0"
title: "swagger definition for CalculateEndpoint"
x-java-interface: "gen.swagger.CalculateEndpointIntf"
basePath: "/"
consumes:
- "application/json"
produces:
- "application/json"
paths:
/bmi:
get:
operationId: "calculate"
parameters:
- name: "number1"
in: "query"
required: false
type: "number"
format: "double"
- name: "number2"
in: "query"
required: false
type: "number"
format: "double"
responses:
200:
description: "response of 200"
schema:
$ref: "#/definitions/CalculateViewObject"
definitions:
CalculateViewObject:
type: "object"
properties:
result:
type: "number"
format: "double"
instanceId:
type: "string"
callTime:
type: "string"
x-java-class: "CalculateViewObject"
================================================
FILE: cli/src/test/resources/contracts/HelloEndPoint.yaml
================================================
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
---
swagger: "2.0"
info:
version: "1.0.0"
title: "swagger definition for HelloEndPoint"
x-java-interface: "gen.swagger.HelloEndPointIntf"
basePath: "/hello"
consumes:
- "application/json"
produces:
- "application/json"
paths:
/sayHello:
get:
operationId: "sayHello"
parameters:
- name: "name"
in: "query"
required: false
type: "string"
- name: "result"
in: "query"
required: false
type: "number"
format: "double"
- name: "instanceId"
in: "query"
required: false
type: "string"
- name: "callTime"
in: "query"
required: false
type: "string"
responses:
200:
description: "response of 200"
schema:
type: "string"
/sayHi:
get:
operationId: "sayHi"
parameters:
- name: "name"
in: "query"
required: false
type: "string"
- name: "Authorization"
in: "header"
description: "aa"
required: true
type: "string"
responses:
200:
description: "response of 200"
schema:
type: "string"
================================================
FILE: cli/src/test/resources/contracts/pojo/CodeFirstHelloEndPoint.yaml
================================================
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
---
swagger: "2.0"
info:
version: "1.0.0"
title: "swagger definition for CodeFirstHelloEndPoint"
x-java-interface: "gen.swagger.CodeFirstHelloEndPointIntf"
basePath: "/codeFirstHello"
consumes:
- "application/json"
produces:
- "application/json"
paths:
/sayHello:
post:
operationId: "sayHello"
parameters:
- name: "name"
in: "query"
required: false
type: "string"
- name: "result"
in: "query"
required: false
type: "number"
format: "double"
- name: "instanceId"
in: "query"
required: false
type: "string"
- name: "callTime"
in: "query"
required: false
type: "string"
responses:
200:
description: "response of 200"
schema:
type: "string"
/sayHi:
post:
operationId: "sayHi"
parameters:
- name: "name"
in: "query"
required: false
type: "string"
- name: "Authorization"
in: "header"
description: "aa"
required: true
type: "string"
responses:
200:
description: "response of 200"
schema:
type: "string"
================================================
FILE: cli/src/test/resources/log4j2-test.xml
================================================
================================================
FILE: cli/src/test/resources/oas/compatibility-left.yaml
================================================
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
openapi: "3.0.0"
info:
version: 1.0.0
title: Swagger petstore
license:
name: MIT
servers:
- url: http://petstore.swagger.io/v1
paths:
/pets:
get:
summary: List all pets
operationId: listpets
responses:
'200':
description: A paged array of pets
post:
summary: List all pets
operationId: foo
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
foo:
type: string
bar:
type: string
encoding:
foo:
contentType: 'application/octet-stream'
responses:
'200':
description: A paged array of pets
================================================
FILE: cli/src/test/resources/oas/compatibility-right.yaml
================================================
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
openapi: "3.0.0"
info:
version: 1.0.0
title: Swagger petstore
license:
name: MIT
servers:
- url: http://petstore.swagger.io/v1
paths:
/pets:
get:
summary: List all pets
operationId: listpets
responses:
'200':
description: A paged array of pets
post:
summary: List all pets
operationId: foo
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
foo:
type: string
bar:
type: string
encoding:
foo:
contentType: 'application/octet-stream'
bar:
contentType: 'application/octet-stream'
responses:
'200':
description: A paged array of pets
================================================
FILE: cli/src/test/resources/oas/style-rules.properties
================================================
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
# OpenAPI Object
openAPI.openapi.gte=3.0.2
openAPI.tags.size.gte=1
openAPI.security.size.eq=0
# Info Object
info.description.required=true
# Tag Object
tag.name.case=upper-camel-case
tag.name.must_be_referenced=true
tag.description.required=true
# Paths Object
paths.key.case=lower-camel-case
# Operation Object
operation.summary.required=true
operation.operationId.case=lower-camel-case
operation.tags.size.eq=1
operation.tags.element.must_reference_root_tags=true
operations.servers.size.eq=0
# Parameter Object
parameter.description.required=true
parameter.name.header.case=upper-hyphen-case
parameter.name.cookie.case=lower-camel-case
parameter.name.path.case=lower-camel-case
parameter.name.query.case=lower-camel-case
# RequestBody Object
requestBody.description.required=true
# Response Object
response.headers.key.case=upper-hyphen-case
# Schema Object
schema.title.required=true
schema.properties.key.case=lower-camel-case
# Encoding Object
encoding.headers.key.case=upper-hyphen-case
# Header Object
header.description.required=true
# Components Object
components.schemas.key.case=upper-camel-case
components.responses.key.case=upper-camel-case
components.parameters.key.case=upper-camel-case
components.examples.key.case=upper-camel-case
components.requestBodies.key.case=upper-camel-case
components.headers.key.case=upper-hyphen-case
components.links.key.case=upper-hyphen-case
components.callbacks.key.case=upper-camel-case
components.headers.key.case=upper-camel-case
================================================
FILE: cli/src/test/resources/oas/style.yaml
================================================
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
openapi: "3.0.0"
info:
version: 1.0.0
title: Pet petstore
paths:
/pets:
get:
summary: List all pets
operationId: listpets
responses:
'200':
description: A paged array of pets
post:
summary: List all pets
operationId: foo
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
foo:
type: string
bar:
type: string
encoding:
foo:
contentType: 'application/octet-stream'
responses:
'200':
description: A paged array of pets
================================================
FILE: cli/src/test/resources/swagger.yaml
================================================
---
swagger: "2.0"
info:
description: "This is a sample server Petstore server. You can find out more about\
\ Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\
\ For this sample, you can use the api key `special-key` to test the authorization\
\ filters."
version: "1.0.0"
title: "Swagger Petstore"
termsOfService: "http://swagger.io/terms/"
contact:
email: "apiteam@swagger.io"
license:
name: "Apache 2.0"
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
host: "petstore.swagger.io"
basePath: "/v2"
tags:
- name: "pet"
description: "Everything about your Pets"
externalDocs:
description: "Find out more"
url: "http://swagger.io"
- name: "store"
description: "Access to Petstore orders"
- name: "user"
description: "Operations about user"
externalDocs:
description: "Find out more about our store"
url: "http://swagger.io"
schemes:
- "https"
- "http"
paths:
/pet:
post:
tags:
- "pet"
summary: "Add a new pet to the store"
description: ""
operationId: "addPet"
consumes:
- "application/json"
- "application/xml"
produces:
- "application/xml"
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Pet object that needs to be added to the store"
required: true
schema:
$ref: "#/definitions/Pet"
responses:
405:
description: "Invalid input"
security:
- petstore_auth:
- "write:pets"
- "read:pets"
put:
tags:
- "pet"
summary: "Update an existing pet"
description: ""
operationId: "updatePet"
consumes:
- "application/json"
- "application/xml"
produces:
- "application/xml"
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Pet object that needs to be added to the store"
required: true
schema:
$ref: "#/definitions/Pet"
responses:
400:
description: "Invalid ID supplied"
404:
description: "Pet not found"
405:
description: "Validation exception"
security:
- petstore_auth:
- "write:pets"
- "read:pets"
/pet/findByStatus:
get:
tags:
- "pet"
summary: "Finds Pets by status"
description: "Multiple status values can be provided with comma separated strings"
operationId: "findPetsByStatus"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "status"
in: "query"
description: "Status values that need to be considered for filter"
required: true
type: "array"
items:
type: "string"
enum:
- "available"
- "pending"
- "sold"
default: "available"
collectionFormat: "multi"
responses:
200:
description: "successful operation"
schema:
type: "array"
items:
$ref: "#/definitions/Pet"
400:
description: "Invalid status value"
security:
- petstore_auth:
- "write:pets"
- "read:pets"
/pet/findByTags:
get:
tags:
- "pet"
summary: "Finds Pets by tags"
description: "Multiple tags can be provided with comma separated strings. Use\
\ tag1, tag2, tag3 for testing."
operationId: "findPetsByTags"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "tags"
in: "query"
description: "Tags to filter by"
required: true
type: "array"
items:
type: "string"
collectionFormat: "multi"
responses:
200:
description: "successful operation"
schema:
type: "array"
items:
$ref: "#/definitions/Pet"
400:
description: "Invalid tag value"
security:
- petstore_auth:
- "write:pets"
- "read:pets"
deprecated: true
/pet/{petId}:
get:
tags:
- "pet"
summary: "Find pet by ID"
description: "Returns a single pet"
operationId: "getPetById"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "petId"
in: "path"
description: "ID of pet to return"
required: true
type: "integer"
format: "int64"
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/Pet"
400:
description: "Invalid ID supplied"
404:
description: "Pet not found"
security:
- api_key: []
post:
tags:
- "pet"
summary: "Updates a pet in the store with form data"
description: ""
operationId: "updatePetWithForm"
consumes:
- "application/x-www-form-urlencoded"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "petId"
in: "path"
description: "ID of pet that needs to be updated"
required: true
type: "integer"
format: "int64"
- name: "name"
in: "formData"
description: "Updated name of the pet"
required: false
type: "string"
- name: "status"
in: "formData"
description: "Updated status of the pet"
required: false
type: "string"
responses:
405:
description: "Invalid input"
security:
- petstore_auth:
- "write:pets"
- "read:pets"
delete:
tags:
- "pet"
summary: "Deletes a pet"
description: ""
operationId: "deletePet"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "api_key"
in: "header"
required: false
type: "string"
- name: "petId"
in: "path"
description: "Pet id to delete"
required: true
type: "integer"
format: "int64"
responses:
400:
description: "Invalid ID supplied"
404:
description: "Pet not found"
security:
- petstore_auth:
- "write:pets"
- "read:pets"
/pet/{petId}/uploadImage:
post:
tags:
- "pet"
summary: "uploads an image"
description: ""
operationId: "uploadFile"
consumes:
- "multipart/form-data"
produces:
- "application/json"
parameters:
- name: "petId"
in: "path"
description: "ID of pet to update"
required: true
type: "integer"
format: "int64"
- name: "additionalMetadata"
in: "formData"
description: "Additional data to pass to server"
required: false
type: "string"
- name: "file"
in: "formData"
description: "file to upload"
required: false
type: "file"
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/ApiResponse"
security:
- petstore_auth:
- "write:pets"
- "read:pets"
/store/inventory:
get:
tags:
- "store"
summary: "Returns pet inventories by status"
description: "Returns a map of status codes to quantities"
operationId: "getInventory"
produces:
- "application/json"
parameters: []
responses:
200:
description: "successful operation"
schema:
type: "object"
additionalProperties:
type: "integer"
format: "int32"
security:
- api_key: []
/store/order:
post:
tags:
- "store"
summary: "Place an order for a pet"
description: ""
operationId: "placeOrder"
produces:
- "application/xml"
- "application/json"
parameters:
- in: "body"
name: "body"
description: "order placed for purchasing the pet"
required: true
schema:
$ref: "#/definitions/Order"
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/Order"
400:
description: "Invalid Order"
/store/order/{orderId}:
get:
tags:
- "store"
summary: "Find purchase order by ID"
description: "For valid response try integer IDs with value >= 1 and <= 10.\
\ Other values will generated exceptions"
operationId: "getOrderById"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "orderId"
in: "path"
description: "ID of pet that needs to be fetched"
required: true
type: "integer"
maximum: 10.0
minimum: 1.0
format: "int64"
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/Order"
400:
description: "Invalid ID supplied"
404:
description: "Order not found"
delete:
tags:
- "store"
summary: "Delete purchase order by ID"
description: "For valid response try integer IDs with positive integer value.\
\ Negative or non-integer values will generate API errors"
operationId: "deleteOrder"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "orderId"
in: "path"
description: "ID of the order that needs to be deleted"
required: true
type: "integer"
minimum: 1.0
format: "int64"
responses:
400:
description: "Invalid ID supplied"
404:
description: "Order not found"
/user:
post:
tags:
- "user"
summary: "Create user"
description: "This can only be done by the logged in user."
operationId: "createUser"
produces:
- "application/xml"
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Created user object"
required: true
schema:
$ref: "#/definitions/User"
responses:
default:
description: "successful operation"
/user/createWithArray:
post:
tags:
- "user"
summary: "Creates list of users with given input array"
description: ""
operationId: "createUsersWithArrayInput"
produces:
- "application/xml"
- "application/json"
parameters:
- in: "body"
name: "body"
description: "List of user object"
required: true
schema:
type: "array"
items:
$ref: "#/definitions/User"
responses:
default:
description: "successful operation"
/user/createWithList:
post:
tags:
- "user"
summary: "Creates list of users with given input array"
description: ""
operationId: "createUsersWithListInput"
produces:
- "application/xml"
- "application/json"
parameters:
- in: "body"
name: "body"
description: "List of user object"
required: true
schema:
type: "array"
items:
$ref: "#/definitions/User"
responses:
default:
description: "successful operation"
/user/login:
get:
tags:
- "user"
summary: "Logs user into the system"
description: ""
operationId: "loginUser"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "username"
in: "query"
description: "The user name for login"
required: true
type: "string"
- name: "password"
in: "query"
description: "The password for login in clear text"
required: true
type: "string"
responses:
200:
description: "successful operation"
schema:
type: "string"
headers:
X-Rate-Limit:
type: "integer"
format: "int32"
description: "calls per hour allowed by the user"
X-Expires-After:
type: "string"
format: "date-time"
description: "date in UTC when token expires"
400:
description: "Invalid username/password supplied"
/user/logout:
get:
tags:
- "user"
summary: "Logs out current logged in user session"
description: ""
operationId: "logoutUser"
produces:
- "application/xml"
- "application/json"
parameters: []
responses:
default:
description: "successful operation"
/user/{username}:
get:
tags:
- "user"
summary: "Get user by user name"
description: ""
operationId: "getUserByName"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "username"
in: "path"
description: "The name that needs to be fetched. Use user1 for testing. "
required: true
type: "string"
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/User"
400:
description: "Invalid username supplied"
404:
description: "User not found"
put:
tags:
- "user"
summary: "Updated user"
description: "This can only be done by the logged in user."
operationId: "updateUser"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "username"
in: "path"
description: "name that need to be updated"
required: true
type: "string"
- in: "body"
name: "body"
description: "Updated user object"
required: true
schema:
$ref: "#/definitions/User"
responses:
400:
description: "Invalid user supplied"
404:
description: "User not found"
delete:
tags:
- "user"
summary: "Delete user"
description: "This can only be done by the logged in user."
operationId: "deleteUser"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "username"
in: "path"
description: "The name that needs to be deleted"
required: true
type: "string"
responses:
400:
description: "Invalid username supplied"
404:
description: "User not found"
securityDefinitions:
petstore_auth:
type: "oauth2"
authorizationUrl: "https://petstore.swagger.io/oauth/authorize"
flow: "implicit"
scopes:
write:pets: "modify pets in your account"
read:pets: "read your pets"
api_key:
type: "apiKey"
name: "api_key"
in: "header"
definitions:
Order:
type: "object"
properties:
id:
type: "integer"
format: "int64"
petId:
type: "integer"
format: "int64"
quantity:
type: "integer"
format: "int32"
shipDate:
type: "string"
format: "date-time"
status:
type: "string"
description: "Order Status"
enum:
- "placed"
- "approved"
- "delivered"
complete:
type: "boolean"
default: false
xml:
name: "Order"
User:
type: "object"
properties:
id:
type: "integer"
format: "int64"
username:
type: "string"
firstName:
type: "string"
lastName:
type: "string"
email:
type: "string"
password:
type: "string"
phone:
type: "string"
userStatus:
type: "integer"
format: "int32"
description: "User Status"
xml:
name: "User"
Category:
type: "object"
properties:
id:
type: "integer"
format: "int64"
name:
type: "string"
xml:
name: "Category"
Tag:
type: "object"
properties:
id:
type: "integer"
format: "int64"
name:
type: "string"
xml:
name: "Tag"
Pet:
type: "object"
required:
- "name"
- "photoUrls"
properties:
id:
type: "integer"
format: "int64"
category:
$ref: "#/definitions/Category"
name:
type: "string"
example: "doggie"
photoUrls:
type: "array"
xml:
name: "photoUrl"
wrapped: true
items:
type: "string"
tags:
type: "array"
xml:
name: "tag"
wrapped: true
items:
$ref: "#/definitions/Tag"
status:
type: "string"
description: "pet status in the store"
enum:
- "available"
- "pending"
- "sold"
xml:
name: "Pet"
ApiResponse:
type: "object"
properties:
code:
type: "integer"
format: "int32"
type:
type: "string"
message:
type: "string"
externalDocs:
description: "Find out more about Swagger"
url: "http://swagger.io"
================================================
FILE: codegen/pom.xml
================================================
toolkit
org.apache.servicecomb.toolkit
0.3.0-SNAPSHOT
4.0.0
codegen
org.apache.servicecomb.toolkit
core
io.swagger
swagger-codegen
org.checkerframework
checker-compat-qual
com.google.guava
listenablefuture
org.slf4j
slf4j-simple
org.apache.logging.log4j
log4j-slf4j-impl
org.apache.logging.log4j
log4j-api
org.apache.logging.log4j
log4j-core
org.apache.logging.log4j
log4j-jcl
junit
junit
test
org.apache.maven.plugins
maven-compiler-plugin
src/main/resources
**/*.*
================================================
FILE: codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/AbstractConsumerDirectoryStrategy.java
================================================
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.servicecomb.toolkit.codegen;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.SupportingFile;
public abstract class AbstractConsumerDirectoryStrategy extends AbstractDirectoryStrategy {
@Override
public void processSupportingFile(List supportingFiles) {
correctServiceId();
}
private void correctServiceId() {
String serviceId = (String) propertiesMap.get(ProjectMetaConstant.SERVICE_ID);
propertiesMap.computeIfAbsent(GeneratorExternalConfigConstant.CONSUMER_SERVICE_ID, key -> {
if (StringUtils.isNotEmpty(serviceId)) {
return serviceId;
}
return propertiesMap.get("artifactId");
});
propertiesMap.computeIfAbsent(GeneratorExternalConfigConstant.PROVIDER_SERVICE_ID, key -> {
throw new UnsupportedOperationException("In consumer type, providerServiceId is required");
});
}
}
================================================
FILE: codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/AbstractDirectoryStrategy.java
================================================
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.servicecomb.toolkit.codegen;
import java.io.File;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.openapitools.codegen.SupportingFile;
public abstract class AbstractDirectoryStrategy implements DirectoryStrategy> {
protected Map propertiesMap = Collections.emptyMap();
protected String projectFolder = "src" + File.separator + "main";
protected String sourceFolder = projectFolder + File.separator + "java";
@Override
public void addCustomProperties(Map propertiesMap) {
this.propertiesMap = propertiesMap;
}
protected String mainClassFolder(String projectPath) {
return projectPath + File.separator + sourceFolder + File.separator + ((String) propertiesMap
.get("mainClassPackage")).replace(".", File.separator);
}
protected String resourcesFolder(String projectPath) {
return projectPath + File.separator + projectFolder + File.separator + "resources";
}
}
================================================
FILE: codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/AbstractJavaCodegenExt.java
================================================
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.servicecomb.toolkit.codegen;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.CodegenModel;
import org.openapitools.codegen.CodegenProperty;
import org.openapitools.codegen.languages.AbstractJavaCodegen;
import org.openapitools.codegen.languages.SpringCodegen;
public abstract class AbstractJavaCodegenExt extends AbstractJavaCodegen {
protected final Map directoryStrategyMap = new LinkedHashMap<>();
protected DirectoryStrategy currentDirectoryStrategy;
protected String mainClassPackage;
public AbstractJavaCodegenExt() {
modelDocTemplateFiles.remove("model_doc.mustache");
apiDocTemplateFiles.remove("api_doc.mustache");
apiTestTemplateFiles.remove("api_test.mustache");
groupId = "domain.orgnization.project";
artifactId = "sample";
apiPackage = groupId + "." + artifactId + ".api";
modelPackage = groupId + "." + artifactId + ".model";
mainClassPackage = groupId + "." + artifactId;
}
@Override
public void processOpts() {
super.processOpts();
if (StringUtils.isEmpty((String) additionalProperties.get("mainClassPackage"))) {
mainClassPackage = apiPackage.substring(0, apiPackage.lastIndexOf("."));
additionalProperties.put("mainClassPackage", mainClassPackage);
} else {
mainClassPackage = (String) additionalProperties.get("mainClassPackage");
}
}
@Override
public Map postProcessModelsEnum(Map objs) {
objs = super.postProcessModelsEnum(objs);
SpringCodegen springCodegen = new SpringCodegen();
return springCodegen.postProcessModelsEnum(objs);
}
@Override
public Map postProcessOperationsWithModels(Map objs, List