Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a ParamConverterProvider for array support #4684

Merged
merged 3 commits into from
Jan 22, 2021

Conversation

jbescos
Copy link
Member

@jbescos jbescos commented Jan 15, 2021

Relates to this: jakartaee/rest#890

Primitive types are not supported. That is said here in the part 'T satisfies 1, 3 or 4 above.':
jakartaee/rest#891

@senivam
Copy link
Contributor

senivam commented Jan 15, 2021

shouldn't it be for jakartified spec only?

Signed-off-by: Jorge Bescos Gascon <[email protected]>
Copy link
Contributor

@jansupol jansupol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make tests for cases 3 and 4, too.
for 4 for instance:

    public static class ArrayTestBean {
        private final String value;

        private ArrayTestBean(String value) {
            this.value = value;
        }

        public static ArrayTestBean fromString(String bean) {
            return new ArrayTestBean(bean);
        }

        @Override
        public String toString() {
            return value;
        }
    }

        @Path("/queryBeanArray")
        @GET
        public Response queryBeanArray(@QueryParam(PARAM_NAME) ArrayTestBean[] data) {
            StringBuilder sb = new StringBuilder(data.length);
            for (ArrayTestBean d : data) {
                sb.append(d);
            }
            return Response.ok(sb.toString()).build();
        }

        @Path("/queryBeanList")
        @GET
        public Response queryBeanList(@QueryParam(PARAM_NAME) List<ArrayTestBean> data) {
            StringBuilder sb = new StringBuilder(data.size());
            for (ArrayTestBean d : data) {
                sb.append(d);
            }
            return Response.ok(sb.toString()).build();
        }

    @Test
    public void queryBean() {
        Response expected = target("/test/queryBeanList").queryParam(PARAM_NAME, "1", "2").request().get();
        Response arrayResponse = target("/test/queryBeanArray").queryParam(PARAM_NAME, "1", "2").request().get();
        verifyStr(expected, arrayResponse);
    }

@@ -0,0 +1,108 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this test in this package? Assumingly it should be next to similar tests, in tests/e2e-server perhaps?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know. By default I was adding tests in JDK connector.

*
* @param type the type class to manage runtime generic.
* @param parameterName extracted parameter name.
* @param defaultValue default parameter value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no defaultValue param

@jansupol
Copy link
Contributor

shouldn't it be for jakartified spec only?

For 3.1, it would be a MUST. For 2.x, it is an enhancement.

Signed-off-by: Jorge Bescos Gascon <[email protected]>
Signed-off-by: Jorge Bescos Gascon <[email protected]>
@jbescos
Copy link
Member Author

jbescos commented Jan 21, 2021

Primitive types are supported in the last commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants