|
@@ 55-70 (lines=16) @@
|
| 52 |
|
)); |
| 53 |
|
} |
| 54 |
|
|
| 55 |
|
@PostMapping(value = "/new/contracts/{provider}/{version:.+}", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) |
| 56 |
|
@ApiOperation(value = "Register contracts for a version of a service", nickname = "register contracts") |
| 57 |
|
@ApiResponses(value = { |
| 58 |
|
@ApiResponse(code = 200, message = "Success", response = ServiceContractsDto.class), |
| 59 |
|
@ApiResponse(code = 400, message = "Bad Request"), |
| 60 |
|
@ApiResponse(code = 500, message = "Failure")}) |
| 61 |
|
public ServiceContractsDto newCreate(@PathVariable(name = "provider") String provider, @PathVariable(name = "version") String version, @RequestBody ServiceContractsForm form) { |
| 62 |
|
return toDto(this.serviceContractsRepository.persist( |
| 63 |
|
new ServiceContracts( |
| 64 |
|
provider, |
| 65 |
|
version, |
| 66 |
|
mapToEntity(form.getCapabilities()), |
| 67 |
|
form.getExpectations().entrySet().stream() |
| 68 |
|
.collect(Collectors.toMap( |
| 69 |
|
Map.Entry::getKey, |
| 70 |
|
entry -> mapToEntity(entry.getValue()) |
| 71 |
|
) |
| 72 |
|
) |
| 73 |
|
) |
|
@@ 33-48 (lines=16) @@
|
| 30 |
|
this.serviceContractsRepository = serviceContractsRepository; |
| 31 |
|
} |
| 32 |
|
|
| 33 |
|
@PostMapping(value = "/contracts/{provider}/{version:.+}", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) |
| 34 |
|
@ApiOperation(value = "Register contracts for a version of a service", nickname = "register contracts") |
| 35 |
|
@ApiResponses(value = { |
| 36 |
|
@ApiResponse(code = 200, message = "Success", response = ServiceContractsDto.class), |
| 37 |
|
@ApiResponse(code = 400, message = "Bad Request"), |
| 38 |
|
@ApiResponse(code = 500, message = "Failure")}) |
| 39 |
|
public ServiceContractsDto create(@PathVariable(name = "provider") String provider, @PathVariable(name = "version") String version, @RequestBody ServiceContractsForm form) { |
| 40 |
|
return toDto(this.serviceContractsRepository.persist( |
| 41 |
|
new ServiceContracts( |
| 42 |
|
provider, |
| 43 |
|
version, |
| 44 |
|
mapToEntity(form.getCapabilities()), |
| 45 |
|
form.getExpectations().entrySet().stream() |
| 46 |
|
.collect(Collectors.toMap( |
| 47 |
|
Map.Entry::getKey, |
| 48 |
|
entry -> mapToEntity(entry.getValue()) |
| 49 |
|
) |
| 50 |
|
) |
| 51 |
|
) |