Fix /encodedpayload/create swagger docs
@@ -59,14 +59,8 @@ public class EncodedPayloadResource {
this.transactionManager = Objects.requireNonNull(transactionManager);
}
- @Operation(
- summary = "/encodedpayload/create",
- operationId = "encrypt",
- description = "encrypt a payload and return the result; does not store to the database or push to peers")
- @ApiResponse(
- responseCode = "200",
- description = "encrypted payload",
- content = @Content(schema = @Schema(implementation = PayloadEncryptResponse.class)))
+ // hide this operation from swagger generation; the /encodedpayload/create operation is overloaded and must be documented in a single place
+ @Hidden
@POST
@Path("create")
@Consumes(APPLICATION_JSON)
@@ -133,7 +127,7 @@ public class EncodedPayloadResource {
return Response.ok(response).type(APPLICATION_JSON).build();
}
- // hide this operation from swagger generation; the /decrypt operation is overloaded and must be documented in a single place
+ // hide this operation from swagger generation; the /encodedpayload/decrypt operation is overloaded and must be documented in a single place
@Hidden
@POST
@Path("decrypt")
@@ -181,16 +175,25 @@ public class EncodedPayloadResource {
return Response.ok(receiveResponse).type(APPLICATION_JSON).build();
}
+ // path /encodedpayload/create is overloaded (application/json and application/vnd.tessera-2.1+json); swagger annotations cannot handle situations like this so this operation documents both
@POST
@Path("create")
@Operation(
summary = "/encodedpayload/create",
operationId = "encrypt",
- description = "encrypt a payload and return the result; does not store to the database or push to peers")
+ description = "encrypt a payload and return the result; does not store to the database or push to peers",
+ requestBody = @RequestBody(
+ content = {
+ @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = SendRequest.class)),
+ @Content(mediaType = MIME_TYPE_JSON_2_1, schema = @Schema(implementation = SendRequest.class))
+ }
+ ))
@ApiResponse(
responseCode = "200",
description = "encrypted payload",
- content = @Content(schema = @Schema(implementation = PayloadEncryptResponse.class)))
+ content = {
+ @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = PayloadEncryptResponse.class)),
+ @Content(mediaType = MIME_TYPE_JSON_2_1, schema = @Schema(implementation = PayloadEncryptResponse.class))})
@Consumes(MIME_TYPE_JSON_2_1)
@Produces(MIME_TYPE_JSON_2_1)
public Response createEncodedPayload21(@NotNull @Valid final SendRequest sendRequest) {
@@ -255,7 +258,7 @@ public class EncodedPayloadResource {
return Response.ok(response).type(MIME_TYPE_JSON_2_1).build();
}
- // path /decrypt is overloaded (application/json and application/vnd.tessera-2.1+json); swagger annotations cannot handle situations like this so this operation documents both
+ // path /encodedpayload/decrypt is overloaded (application/json and application/vnd.tessera-2.1+json); swagger annotations cannot handle situations like this so this operation documents both
@POST
@Path("decrypt")
@Operation(
