Skip to content
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

Merged
merged 7 commits into from
Nov 23, 2020

Conversation

karolkalinski
Copy link

  • new endpoint services/{serviceName}/versions/{version:.+}/capabilities/{protocol} created
  • new endpoint CORS policy allows request from any domain: Access-Control-Allow-Origin: *

@coveralls
Copy link

coveralls commented Nov 13, 2020

Pull Request Test Coverage Report for Build 611

  • 8 of 8 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.05%) to 96.314%

Totals Coverage Status
Change from base Build 589: 0.05%
Covered Lines: 601
Relevant Lines: 624

💛 - 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) {
Copy link
Collaborator

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

Copy link
Author

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)) }
Copy link
Collaborator

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()
Copy link
Collaborator

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;
Copy link
Collaborator

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?

@karolkalinski karolkalinski merged commit 789f42c into master Nov 23, 2020
@karolkalinski karolkalinski deleted the openapi-renderer-integration branch November 23, 2020 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants