Search in sources :

Example 46 with ApiResponses

use of io.swagger.v3.oas.models.responses.ApiResponses in project snow-owl by b2ihealthcare.

the class SnomedClassificationRestService method beginClassification.

@Operation(summary = "Start a classification on a branch", description = "Classification runs are async jobs. The call to this method immediately returns with a unique URL " + "pointing to the classification run.<p>The URL can be used to fetch the state of the classification " + "to determine whether it's completed or not.")
@ApiResponses({ @ApiResponse(responseCode = "201", description = "Created"), @ApiResponse(responseCode = "404", description = "Branch not found") })
@PostMapping(consumes = { AbstractRestService.JSON_MEDIA_TYPE })
@ResponseStatus(value = HttpStatus.CREATED)
public Promise<ResponseEntity<?>> beginClassification(@Parameter(description = "Classification parameters") @RequestBody final ClassificationRunRestInput request, @RequestHeader(value = X_AUTHOR, required = false) final String author) {
    ApiValidation.checkInput(request);
    final UriComponentsBuilder linkTo = MvcUriComponentsBuilder.fromController(SnomedClassificationRestService.class);
    return ClassificationRequests.prepareCreateClassification().setReasonerId(request.getReasonerId()).setUserId(author).build(request.getPath()).execute(getBus()).then(id -> {
        final URI resourceUri = linkTo.pathSegment(id).build().toUri();
        return ResponseEntity.created(resourceUri).build();
    });
}
Also used : UriComponentsBuilder(org.springframework.web.util.UriComponentsBuilder) MvcUriComponentsBuilder(org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder) URI(java.net.URI) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Example 47 with ApiResponses

use of io.swagger.v3.oas.models.responses.ApiResponses in project snow-owl by b2ihealthcare.

the class SnomedDescriptionRestService method create.

@Operation(summary = "Create Description", description = "Creates a new Description directly on a version.")
@ApiResponses({ @ApiResponse(responseCode = "201", description = "Created"), @ApiResponse(responseCode = "404", description = "Branch not found") })
@PostMapping(consumes = { AbstractRestService.JSON_MEDIA_TYPE })
@ResponseStatus(HttpStatus.CREATED)
public ResponseEntity<Void> create(@Parameter(description = "The resource path", required = true) @PathVariable(value = "path") final String path, @Parameter(description = "Description parameters") @RequestBody final SnomedResourceRequest<SnomedDescriptionRestInput> body, @RequestHeader(value = X_AUTHOR, required = false) final String author) {
    final SnomedDescriptionRestInput change = body.getChange();
    final String commitComment = body.getCommitComment();
    final String defaultModuleId = body.getDefaultModuleId();
    final String createdDescriptionId = change.toRequestBuilder().commit().setDefaultModuleId(defaultModuleId).setAuthor(author).setCommitComment(commitComment).build(path).execute(getBus()).getSync(COMMIT_TIMEOUT, TimeUnit.MINUTES).getResultAs(String.class);
    return ResponseEntity.created(getResourceLocationURI(path, createdDescriptionId)).build();
}
Also used : SnomedDescriptionRestInput(com.b2international.snowowl.snomed.core.rest.domain.SnomedDescriptionRestInput) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Example 48 with ApiResponses

use of io.swagger.v3.oas.models.responses.ApiResponses in project snow-owl by b2ihealthcare.

the class SnomedReferenceSetMemberRestService method create.

@Operation(summary = "Create a reference set member", description = "Creates a new reference set member directly on a branch. " + "On top of the basic member properties you can include other properties relevant for specific reference set member types." + "For example: query type reference set members support _query_ and _refsetDescription_ properties. " + "_Query_ defines the ESCG query of the new member, while the _refsetDescription_ will be used as the description of the new target simple type reference set.")
@ApiResponses({ @ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Branch not found") })
@PostMapping(consumes = { AbstractRestService.JSON_MEDIA_TYPE })
public ResponseEntity<Void> create(@Parameter(description = "The resource path", required = true) @PathVariable(value = "path") final String path, @Parameter(description = "Reference set member parameters") @RequestBody final SnomedResourceRequest<SnomedRefSetMemberRestInput> body, @RequestHeader(value = X_AUTHOR, required = false) final String author) {
    final SnomedRefSetMemberRestInput change = body.getChange();
    final String commitComment = body.getCommitComment();
    final String defaultModuleId = body.getDefaultModuleId();
    final String id = change.getId();
    // Check for correct UUID format in id input
    UUID.fromString(id);
    final String createdRefSetMemberId = change.toRequestBuilder().commit().setDefaultModuleId(defaultModuleId).setAuthor(author).setCommitComment(commitComment).build(path).execute(getBus()).getSync(COMMIT_TIMEOUT, TimeUnit.MINUTES).getResultAs(String.class);
    return ResponseEntity.created(getResourceLocationURI(path, createdRefSetMemberId)).build();
}
Also used : SnomedRefSetMemberRestInput(com.b2international.snowowl.snomed.core.rest.domain.SnomedRefSetMemberRestInput) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Example 49 with ApiResponses

use of io.swagger.v3.oas.models.responses.ApiResponses in project snow-owl by b2ihealthcare.

the class SnomedReferenceSetMemberRestService method update.

@Operation(summary = "Update Reference Set Member", description = "Updates properties of the specified Reference Set Member." + "The following properties are allowed to change (other properties will be simply ignored):" + "- activity status flag (active)" + "- module Concept (moduleId)" + "- query field of query type reference set members")
@ApiResponses({ @ApiResponse(responseCode = "204", description = "No Content"), @ApiResponse(responseCode = "404", description = "Branch or member not found") })
@PutMapping(value = "/{id}", consumes = { AbstractRestService.JSON_MEDIA_TYPE })
@ResponseStatus(HttpStatus.NO_CONTENT)
public void update(@Parameter(description = "The resource path", required = true) @PathVariable(value = "path") final String path, @Parameter(description = "The reference set member identifier") @PathVariable(value = "id") final String memberId, @Parameter(description = "Updated Reference Set parameters") @RequestBody final SnomedResourceRequest<SnomedMemberRestUpdate> body, @Parameter(description = "Force update flag") @RequestParam(defaultValue = "false", required = false) final Boolean force, @RequestHeader(value = X_AUTHOR, required = false) final String author) {
    final SnomedMemberRestUpdate update = body.getChange();
    final String commitComment = body.getCommitComment();
    final String defaultModuleId = body.getDefaultModuleId();
    SnomedRequests.prepareUpdateMember(memberId).setSource(update.getSource()).force(force).commit().setDefaultModuleId(defaultModuleId).setAuthor(author).setCommitComment(commitComment).build(path).execute(getBus()).getSync(COMMIT_TIMEOUT, TimeUnit.MINUTES);
}
Also used : SnomedMemberRestUpdate(com.b2international.snowowl.snomed.core.rest.domain.SnomedMemberRestUpdate) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Example 50 with ApiResponses

use of io.swagger.v3.oas.models.responses.ApiResponses in project snow-owl by b2ihealthcare.

the class SnomedReferenceSetMemberRestService method executeAction.

@Operation(summary = "Executes an action", description = "Executes an action specified via the request body on a reference set member." + "<p>Supported actions are:" + "&bull; 'sync' - Executes sync action on a query type member" + "&bull; 'create|update|delete' - allowed (mainly resolved and used in bulk requests), but in case of single member action use the dedicated endpoints instead" + "</p>")
@ApiResponses({ @ApiResponse(responseCode = "200", description = "Action execution successful"), @ApiResponse(responseCode = "204", description = "No content"), @ApiResponse(responseCode = "404", description = "Branch or member not found") })
@PostMapping(value = "/{id}/actions", consumes = { AbstractRestService.JSON_MEDIA_TYPE }, produces = { AbstractRestService.JSON_MEDIA_TYPE })
@ResponseBody
public Object executeAction(@Parameter(description = "The resource path", required = true) @PathVariable(value = "path") final String path, @Parameter(description = "The reference set member identifier") @PathVariable(value = "id") final String memberId, @Parameter(description = "Reference set member action") @RequestBody final SnomedResourceRequest<RestRequest> body, @RequestHeader(value = X_AUTHOR, required = false) final String author) {
    final RequestResolver<TransactionContext> resolver = new RefSetMemberRequestResolver();
    final RestRequest change = body.getChange();
    final String commitComment = body.getCommitComment();
    final String defaultModuleId = body.getDefaultModuleId();
    change.setSource("memberId", memberId);
    return SnomedRequests.prepareCommit().setDefaultModuleId(defaultModuleId).setAuthor(author).setBody(change.resolve(resolver)).setCommitComment(commitComment).build(path).execute(getBus()).getSync();
}
Also used : RestRequest(com.b2international.snowowl.snomed.core.rest.request.RestRequest) TransactionContext(com.b2international.snowowl.core.domain.TransactionContext) RefSetMemberRequestResolver(com.b2international.snowowl.snomed.core.rest.request.RefSetMemberRequestResolver) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Aggregations

Operation (io.swagger.v3.oas.annotations.Operation)99 ApiResponses (io.swagger.v3.oas.annotations.responses.ApiResponses)99 ApiResponses (io.swagger.v3.oas.models.responses.ApiResponses)48 ApiResponse (io.swagger.v3.oas.models.responses.ApiResponse)47 ProtectedApi (org.gluu.oxtrust.service.filter.ProtectedApi)47 Operation (io.swagger.v3.oas.models.Operation)39 PathItem (io.swagger.v3.oas.models.PathItem)35 OpenAPI (io.swagger.v3.oas.models.OpenAPI)34 Test (org.testng.annotations.Test)31 ArrayList (java.util.ArrayList)23 Schema (io.swagger.v3.oas.models.media.Schema)22 Content (io.swagger.v3.oas.models.media.Content)21 StringSchema (io.swagger.v3.oas.models.media.StringSchema)21 MediaType (io.swagger.v3.oas.models.media.MediaType)20 ObjectSchema (io.swagger.v3.oas.models.media.ObjectSchema)19 IntegerSchema (io.swagger.v3.oas.models.media.IntegerSchema)17 Path (javax.ws.rs.Path)17 Produces (javax.ws.rs.Produces)17 ArraySchema (io.swagger.v3.oas.models.media.ArraySchema)16 Components (io.swagger.v3.oas.models.Components)10