cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J. Fiala (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CXF-6965) CXF Swagger2Feature does not correctly support QueryParam("") and DataHandler
Date Sat, 09 Jul 2016 13:51:11 GMT

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

J. Fiala edited comment on CXF-6965 at 7/9/16 1:50 PM:
-------------------------------------------------------

h3. 1. Example for nested parameters @QueryParam("") not supported in Swagger:
{code}
@Path("/myService") 
public class MyServiceImpl {

@Consumes({ MediaType.APPLICATION_JSON })
	@Produces({ MediaType.APPLICATION_JSON })
	@POST
	  @Path("/hello")
	public void hello(@QueryParam("")MyQueryParams params) {
		
	}

}

public class MyQueryParams {
	String param1;
	String param2;
//....
}
{code}

will render in WADL (CORRECT):
{code}
<resource path="/hello">
<method name="POST">
<request>
<param name="param2" style="query" type="xs:string"/>
<param name="param1" style="query" type="xs:string"/>
</request>
{code}

and in Swagger (WRONG - nested parameters not picked up): 
{code}
"/myService/hello": {

    "post": {
        "tags": [
            "myService"
        ],
        "operationId": "hello",
        "consumes": [
            "application/json"
        ],
        "produces": [
            "application/json"
        ],
        "parameters": [
            {
                "name": "",
                "in": "query",
                "required": false,
                "type": "string"
            }
        ],
{code}

h3. 2. Example for DataHandler not supported in WADL (pls move to separate issue for WadlGenerator):

{code}
@Consumes({ MediaType.MULTIPART_FORM_DATA })
	@Produces({ MediaType.APPLICATION_JSON })
	@POST
	@Path("/helloMultipart")
	public void helloMultipart(@Multipart(value= "payload" , type=MediaType.APPLICATION_OCTET_STREAM)
DataHandler handler) {

	}
{code}

is renderd in WADL (WRONG):
{code}
<resource path="/helloMultipart"><method name="POST"><request><representation
mediaType="application/x-www-form-urlencoded"/></request>
{code}

this would be the basic correct WADL rendering:
{code}
<resource path="/helloMultipart"><method name="POST"><request><representation
mediaType="multipart/form-data"/></request>
{code}

Which will become after wadl2java:
{code}
postHelloMultipart(MultipartBody body);
{code}

Of course it would be nice to have all the Multipart rendered correctly in WADL as well.

h3. 3. Example for DataHandler not supported in Swagger:
{code}
"/myService/helloMultipart": {

    "post": {
        "tags": [
            "myService"
        ],
        "operationId": "helloMultipart",
        "consumes": [
            "multipart/form-data"
        ],
        "produces": [
            "application/json"
        ],
        "parameters": [
            {
                "in": "body",
                "name": "body",
                "required": false,
                "schema": {
                    "$ref": "#/definitions/DataHandler"
                }
            }
        ],
{code}
It will also add the definitions for DataHandler, DataSource, DataFlavour, InputStream, CommandInfo,
Outputstream, which makes no sense in the Swagger file.

This would be the correct rendering (type=file)
{code}
{

    "name": "payload",
    "in": "formData",
    "description": "",
    "required": false,
    "type": "file"

}
{code}


was (Author: jfx):
h3. Example for nested parameters @QueryParam("") not supported in Swagger:
{code}
@Path("/myService") 
public class MyServiceImpl {

@Consumes({ MediaType.APPLICATION_JSON })
	@Produces({ MediaType.APPLICATION_JSON })
	@POST
	  @Path("/hello")
	public void hello(@QueryParam("")MyQueryParams params) {
		
	}

}

public class MyQueryParams {
	String param1;
	String param2;
//....
}
{code}

will render in WADL (CORRECT):
{code}
<resource path="/hello">
<method name="POST">
<request>
<param name="param2" style="query" type="xs:string"/>
<param name="param1" style="query" type="xs:string"/>
</request>
{code}

and in Swagger (WRONG - nested parameters not picked up): 
{code}
"/bestand/hello": {

    "post": {
        "tags": [
            "bestand"
        ],
        "operationId": "hello",
        "consumes": [
            "application/json"
        ],
        "produces": [
            "application/json"
        ],
        "parameters": [
            {
                "name": "",
                "in": "query",
                "required": false,
                "type": "string"
            }
        ],
{code}

> CXF Swagger2Feature does not correctly support QueryParam("") and DataHandler
> -----------------------------------------------------------------------------
>
>                 Key: CXF-6965
>                 URL: https://issues.apache.org/jira/browse/CXF-6965
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>            Reporter: Sergey Beryozkin
>            Priority: Minor
>             Fix For: 3.2.0, 3.1.8
>
>
> See https://github.com/swagger-api/swagger-codegen/issues/2017#issuecomment-230426728



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message