Java Code Examples for org.eclipse.microprofile.openapi.annotations.ExternalDocumentation

The following examples show how to use org.eclipse.microprofile.openapi.annotations.ExternalDocumentation. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: microprofile-open-api   Source File: UserResource.java    License: Apache License 2.0 6 votes vote down vote up
@GET
@Path("/logout")
@APIResponse(
            responseCode = "200",
            description = "Successful user logout."
            )
@ExternalDocumentation(
        description = "Policy on user security.",
        url = "http://exampleurl.com/policy"
        )
@Operation(
    summary = "Logs out current logged in user session",
    operationId = "logOutUser"
    /* tags = {"user"}, // intentionally removed to have a method with no tags */)
public Response logoutUser() {
return Response.ok().entity("").build();
}
 
Example 2
@GET
@Path("/now")
@Produces(MediaType.APPLICATION_JSON)
@Tag(name = "time", description = "time service methods")
@ExternalDocumentation(description = "Basic World Clock API Home.",
        url = "http://worldclockapi.com/")
@Operation(summary = "Queries the WorldClockApi using the MP-RestClient",
        description = "Uses the WorldClockApi type proxy injected by the MP-RestClient to access the worldclockapi.com service")
public Now utc() {
    return clockApi.utc();
}
 
Example 3
Source Project: microprofile-open-api   Source File: PetResource.java    License: Apache License 2.0 5 votes vote down vote up
@GET
@Path("/findByTags")
@Produces("application/json")
@Callback(
    name = "tagsCallback",
    callbackUrlExpression = "http://petstoreapp.com/pet",
    operations = @CallbackOperation(
        method = "GET",
        summary = "Finds Pets by tags",
        description = "Find Pets by tags; Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.",
        responses = {
            @APIResponse(
                responseCode = "400",
                description = "Invalid tag value",
                content = @Content(mediaType = "none")
            ),
            @APIResponse(
                responseCode = "200",
                content = @Content(
                    mediaType = "application/json",
                    schema = @Schema(type = SchemaType.ARRAY, implementation = Pet.class))
                )
        }
    )
)
@APIResponseSchema(Pet[].class)
@Deprecated
public Response findPetsByTags(
    @HeaderParam("apiKey") String apiKey,
    @Parameter(
        name = "tags",
        description = "Tags to filter by",
        required = true,
        deprecated = true,
        schema = @Schema(implementation = String.class, deprecated = true,
          externalDocs = @ExternalDocumentation(description = "Pet Types", url = "http://example.com/pettypes"),
          enumeration = { "Cat", "Dog", "Lizard" }, defaultValue = "Dog" ))
    @QueryParam("tags") String tags) {
        return Response.ok(petData.findPetByTags(tags)).build();
    }
 
Example 4
@GET
@Produces(MediaType.TEXT_PLAIN)
@Tag(name = "tag3", description = "TAG3 from TagTestResource2#getValue1", externalDocs = @ExternalDocumentation(description = "Ext doc from TagTestResource2#getValue1"))
public String getValue1() {
    return null;
}
 
Example 5
@GET
@Tag(
        name = "Get Flights",
        description = "method to retrieve all flights available",
        externalDocs = @ExternalDocumentation(
            description = "A list of all the flights offered by the app",
            url = "http://airlinesratingapp.com/ourflights")
    )
@Tag(ref="Availability")
@APIResponse(
        responseCode = "200",
        description = "successful operation",
        content = @Content(
            mediaType = "application/json",
            schema = @Schema(
                type = SchemaType.ARRAY,
                implementation = Flight.class
            )
        )
    )
@APIResponse(
        responseCode = "404",
        description = "No available flights found",
        content = @Content(
            mediaType = "n/a")
    )
@Operation(
    summary = "Retrieve all available flights",
    operationId = "getFlights")
@Produces("application/json")
public Response getFlights(
    @Parameter(
        ref = "#/components/parameters/departureDate"
    )
    @QueryParam("departureDate") String departureDate,
    @Parameter(
        name = "airportFrom",
        required = true,
        allowEmptyValue = true,
        description = "Airport the customer departs from",
        schema = @Schema(
            implementation = String.class)
    )
    @QueryParam("airportFrom") String airportFrom,
    @Parameter(
        name = "returningDate",
        required = true,
        allowReserved = true,
        description = "Customer return date",
        schema = @Schema(
            implementation = String.class)
        )
    @QueryParam("returningDate") String returningDate,
    @Parameter(
        name = "airportTo",
        required = true,
        description = "Airport the customer returns to",
        schema = @Schema(
            implementation = String.class)
    )
    @QueryParam("airportTo") String airportTo,
    @Parameter(
        name = "numberOfAdults",
        required = true,
        description = "Number of adults on the flight",
        schema = @Schema(
            minimum = "0",
            implementation = String.class)
    )
    @QueryParam("numberOfAdults") int numberOfAdults,
    @Parameter(
        name = "numberOfChildren",
        required = true,
        deprecated = true,
        description = "Number of children on the flight",
        schema = @Schema(
            minimum = "0",
            implementation = String.class)
    )
    @QueryParam("numberOfChildren") int numberOfChildren){
    return Response.ok().entity(findFlights(airportFrom, airportTo, departureDate, returningDate)).build();
}
 
Example 6
Source Project: microprofile-open-api   Source File: UserResource.java    License: Apache License 2.0 4 votes vote down vote up
@GET
@Path("/login")
@Tag()
@ExternalDocumentation(
        description = "Policy on user security.",
        url = "http://exampleurl.com/policy"
)
@APIResponse(
        responseCode = "200",
        description = "Successful user login.",
        content = @Content(
            schema = @Schema(implementation = User.class)
        )
    )
@APIResponse(
        responseCode = "400",
        description = "Invalid username/password supplied"
        )
@Operation(
    summary = "Logs user into the system",
    operationId = "logInUser"
)

@SecurityScheme(
    ref = "#/components/securitySchemes/httpTestScheme"
)
@SecurityRequirement(
    name = "httpTestScheme"
)
public Response loginUser(
    @Parameter(
        name = "username",
        description = "The user name for login",
        schema = @Schema(type = SchemaType.STRING),
        required = true
        )
    @QueryParam("username") String username,
    @Parameter(
        name = "password",
        description = "The password for login in clear text",
        schema = @Schema(type = SchemaType.STRING),
        required = true)
    @QueryParam("password") String password) {
        return Response.ok()
            .entity("logged in user session:" + System.currentTimeMillis())
            .build();
    }