tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TOMEE-2289) MicroProfile OpenAPI Example
Date Wed, 02 Jan 2019 12:39:00 GMT

    [ https://issues.apache.org/jira/browse/TOMEE-2289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16732020#comment-16732020
] 

ASF GitHub Bot commented on TOMEE-2289:
---------------------------------------

Github user ivanjunckes commented on a diff in the pull request:

    https://github.com/apache/tomee/pull/340#discussion_r244725773
  
    --- Diff: examples/mp-openapi/src/main/java/org/superbiz/openapi/WeatherService.java ---
    @@ -0,0 +1,52 @@
    +package org.superbiz.openapi;
    +
    +
    +
    +import javax.enterprise.context.ApplicationScoped;
    +
    +import javax.ws.rs.GET;
    +import javax.ws.rs.Path;
    +import javax.ws.rs.PathParam;
    +import javax.ws.rs.core.Response;
    +
    +import org.eclipse.microprofile.openapi.annotations.Operation;
    +import org.eclipse.microprofile.openapi.annotations.parameters.Parameter;
    +import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
    +import org.eclipse.microprofile.openapi.annotations.media.Content;
    +import org.eclipse.microprofile.openapi.annotations.media.Schema;
    +
    +
    +
    +
    +
    +@Path("/weather")
    +@ApplicationScoped
    +public class WeatherService {
    +
    +    @Path("/status/{day}/")   
    +    @GET
    +    @Operation(summary = "Finds weather for day specified in the URL ", description =
"Describes how the day will be.")
    +    @APIResponse(responseCode = "400", description = "Weather for this day not found")
    +    public Response dayStatus( @Parameter(description = "The day for which the weather
needs to be fetched.", required = true) @PathParam("day") String day	) {
    +    	
    +    	if(day.equalsIgnoreCase("tomorrow"))
    +    		return Response.status(Response.Status.NOT_FOUND).build();
    +    	String message=day+ "is a sunny day.";
    +        return Response.status(Response.Status.OK)
    +        	      .entity(message)
    +        	      .build();        	         	
    +    }
    +
    +    @Path("/detailedWeather/{day}/")   
    +    @GET
    +    @APIResponse(description = "Detailed Weather", content=@Content(mediaType="application/json",
schema= @Schema(implementation=Weather.class)))
    +    public Weather getDetailedWeather( @Parameter(description = "The day for which the
detailed weather needs to be fetched.", required = true) @PathParam("day") String day) {
    +    	
    +        Weather w=new Weather();
    --- End diff --
    
    Space is missing in several places, between variable and value assingments. Please format
the class correctly.


> MicroProfile OpenAPI Example
> ----------------------------
>
>                 Key: TOMEE-2289
>                 URL: https://issues.apache.org/jira/browse/TOMEE-2289
>             Project: TomEE
>          Issue Type: Sub-task
>          Components: Examples and Documentation
>    Affects Versions: 8.0.0-M1
>            Reporter: Ivan Junckes Filho
>            Assignee: Ivan Junckes Filho
>            Priority: Minor
>              Labels: examples, pull-request-available
>
> We would like to write an example for MicroProfile OpenApi.
> Here is the MicroProfile specification url:
> [https://download.eclipse.org/microprofile/microprofile-open-api-1.0.1/microprofile-openapi-spec.html]
> Fork / clone the TomEE project from here:
> [https://github.com/apache/tomee]
> Example name should be _mp-openapi_, following the standard already in the project.
> All the examples are in:
> [https://github.com/apache/tomee/tree/master/examples]
> See this example of Microprofile Metrics for reference:
> [https://github.com/apache/tomee/tree/master/examples/mp-metrics-counted]
>  
> What you have to do is:
> 1 - Create a JAX-RS endpoint with some methods (Using the same domain from metrics -
WeatherService would be good)
> 2 - Annotate with OpenApi annotations
> 3 - Write a test to assert the response in JSON and YAML
> 4 - Make sure all the tests pass
> After that submit a PR and we'll review it.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message