You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicecomb.apache.org by wjm wjm <zz...@gmail.com> on 2019/01/26 03:42:31 UTC

Re: [Discuss] Should we support inner class param type defined inREST service class?

just trace it, no need to do anything now.

bismy <bi...@qq.com> 于2019年1月26日周六 上午9:19写道:

> I'd prefer not to support this feature, at least not encourage users to
> use this feature. Because we consider service interfaces and related models
> as public components to other services. The implementation class (that is
> the REST service implementation) is not a public component.
>
>
> This feature may not work fine when we distribute services using JAVA API(
> that the client import the exposed JAVA api to call the remote service).
>
>
>
>
> ------------------ 原始邮件 ------------------
> 发件人: "yhs0092"<yh...@163.com>;
> 发送时间: 2019年1月25日(星期五) 中午12:54
> 收件人: "dev@servicecomb.apache.org"<de...@servicecomb.apache.org>;
>
> 主题: Re:  [Discuss] Should we support inner class param type defined inREST
> service class?
>
>
>
> A new issue[1] is created. I'll analyse the root cause later.
>
>
> [1] https://issues.apache.org/jira/browse/SCB-1133
>
>
> Yours sincerely
>
>
> Yao Haishi
> yhs0092@163.com
>
>
> On 1/25/2019 10:46,wjm wjm<zz...@gmail.com> wrote:
> +1
>
> but if too complex, can IMPL it in weak type engine.
>
> yhs0092 <yh...@163.com> 于2019年1月25日周五 上午9:55写道:
>
> Hello, I find out that currently it's not supported to define a inner
> class type in the REST service class as parameter. Should we allow such use
> case?
>
>
> For example, a REST service like below will cause
> javassist.NotFoundException:
> training.demo.provider.service.TestRestService.TestBodyParam
> @RestSchema(schemaId = "testSchema")
> @RequestMapping(path = "test")
> public class TestRestService {
> @PostMapping(path = "post")
> public String post(@RequestBody TestBodyParam body) {
> return null == body ? "null" : body.toString();
> }
>
> public static class TestBodyParam {
> // fields omitted
> }
> }
>
>
> But inner class field in an independent param class is OK:
> @RestSchema(schemaId = "testSchema")
> @RequestMapping(path = "test")
> public class TestRestService {
> @PostMapping(path = "post")
> public String post(@RequestBody TestBodyParam body) {
> return null == body ? "null" : body.toString();
> }
> }
> // define param type in an independent class
> public class TestBodyParam {
> private InnerBody innerBody;
> public static class InnerBody {
>
> // fields omitted
> }
> // fields omitted
> }
>
>
> As described above, in some case, the inner class param type works well.
> If you think this feature should be provided, I'll create a JIRA issue to
> track it.
>
>
> Yours sincerely
>
>
> Yao Haishi
> yhs0092@163.com