-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implements #152 adds endpoint to list service capabilities #153
Conversation
karolkalinski
commented
Nov 12, 2020
- new endpoint services/{serviceName}/versions/{version:.+}/capabilities/{protocol} created
- new endpoint CORS policy allows request from any domain: Access-Control-Allow-Origin: *
Pull Request Test Coverage Report for Build 611
💛 - Coveralls |
@ApiResponse(code = 200, message = "Success", response = ServiceContractsDto.class), | ||
@ApiResponse(code = 400, message = "Bad Request"), | ||
@ApiResponse(code = 500, message = "Failure")}) | ||
public String getCapabilities( @PathVariable String serviceName, @PathVariable String version, @PathVariable(name = "protocol") String protocol) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should return contracts with their mime type as they are registered
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Endpoint modified to return mime type of a contract.
return Optional.ofNullable(storage.get(serviceId)) | ||
.flatMap {sc -> sc.getMappedCapabilities(protocol, {it -> it})} | ||
.map{it -> it.getCapabilities() } | ||
.flatMap{ it -> Optional.of(it.get(0)) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we make such assumption in the repository?
@@ -99,6 +104,20 @@ public ServiceContractsDto getContracts(@PathVariable(name = "serviceName") Stri | |||
return mapper.toDto(this.serviceContractsRepository.findOne(new ServiceId(serviceName, version)).orElseThrow(ResourceNotFoundException::new)); | |||
} | |||
|
|||
@GetMapping(value = "services/{serviceName}/versions/{version:.+}/capabilities/{protocol}", produces = MediaType.ALL_VALUE) | |||
@CrossOrigin() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add it in a separate pull request and wherever applicable.
@@ -7,12 +7,14 @@ | |||
import com.hltech.judged.server.domain.contracts.ServiceContracts; | |||
import com.hltech.judged.server.domain.contracts.ServiceContractsRepository; | |||
import lombok.RequiredArgsConstructor; | |||
import org.jetbrains.annotations.NotNull; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this jetbrains import required?