@@ 68-91 (lines=24) @@ | ||
65 | return toDtos(collect, serviceName, serviceVersion); |
|
66 | } |
|
67 | ||
68 | @GetMapping(value = "/environment-compatibility-report/{serviceName}:{serviceVersion:.+}", produces = MediaType.APPLICATION_JSON_VALUE) |
|
69 | @ApiOperation(value = "Get validation report for contract between given service and given environment", nickname = "Validate against environment") |
|
70 | @ApiResponses(value = { |
|
71 | @ApiResponse(code = 200, message = "Success", response = String.class, responseContainer = "list"), |
|
72 | @ApiResponse(code = 500, message = "Failure"), |
|
73 | @ApiResponse(code = 404, message = "Service not found") |
|
74 | }) |
|
75 | public List<ContractValidationReportDto> validateAgainstEnvironments( |
|
76 | @PathVariable("serviceName") String serviceName, |
|
77 | @PathVariable("serviceVersion") String serviceVersion, |
|
78 | @RequestParam("environment") List<String> environments |
|
79 | ) { |
|
80 | ServiceContracts validatedServiceContracts = this.serviceContractsRepository.find(serviceName, serviceVersion) |
|
81 | .orElseThrow(ResourceNotFoundException::new); |
|
82 | ||
83 | List<EnvironmentValidatorResult> collect = this.validators.stream() |
|
84 | .map(validator -> |
|
85 | this.judgeD.validateServiceAgainstEnv( |
|
86 | validatedServiceContracts, |
|
87 | environments, |
|
88 | validator |
|
89 | )) |
|
90 | .collect(Collectors.toList()); |
|
91 | return toDtos(collect, serviceName, serviceVersion); |
|
92 | } |
|
93 | } |
|
94 | ||
@@ 42-65 (lines=24) @@ | ||
39 | this.validators = validators; |
|
40 | } |
|
41 | ||
42 | @GetMapping(value = "/environment-compatibility-report/{environment}/{serviceName}:{serviceVersion:.+}", produces = MediaType.APPLICATION_JSON_VALUE) |
|
43 | @ApiOperation(value = "Get validation report for contract between given service and given environment", nickname = "Validate against environment") |
|
44 | @ApiResponses(value = { |
|
45 | @ApiResponse(code = 200, message = "Success", response = String.class, responseContainer = "list"), |
|
46 | @ApiResponse(code = 500, message = "Failure"), |
|
47 | @ApiResponse(code = 404, message = "Service not found") |
|
48 | }) |
|
49 | public List<ContractValidationReportDto> validateAgainstEnvironment( |
|
50 | @PathVariable("environment") String environment, |
|
51 | @PathVariable("serviceName") String serviceName, |
|
52 | @PathVariable("serviceVersion") String serviceVersion |
|
53 | ) { |
|
54 | ServiceContracts validatedServiceContracts = this.serviceContractsRepository.find(serviceName, serviceVersion) |
|
55 | .orElseThrow(ResourceNotFoundException::new); |
|
56 | ||
57 | List<EnvironmentValidatorResult> collect = this.validators.stream() |
|
58 | .map(validator -> |
|
59 | this.judgeD.validateServiceAgainstEnv( |
|
60 | validatedServiceContracts, |
|
61 | environment, |
|
62 | validator |
|
63 | )) |
|
64 | .collect(Collectors.toList()); |
|
65 | return toDtos(collect, serviceName, serviceVersion); |
|
66 | } |
|
67 | ||
68 | @GetMapping(value = "/environment-compatibility-report/{serviceName}:{serviceVersion:.+}", produces = MediaType.APPLICATION_JSON_VALUE) |