servicecomb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: [Discuss] Do we need to add some reminder logs on SwaggerGeneratorContext selection?
Date Thu, 25 Oct 2018 02:05:07 GMT
+1, we need to let user know how the framework exactly works.

Willem Jiang

Twitter: willemjiang
Weibo: 姜宁willem

On Thu, Oct 25, 2018 at 9:36 AM yhs0092 <yhs0092@163.com> wrote:
>
> OK, JIRA issue has been created, https://issues.apache.org/jira/browse/SCB-979
> As for pojo mode, I think maybe we can check the annotations on the REST interface class.
If the PojoSwaggerGeneratorContext is selected and @RequestMapping or @Path is found, we can
print some extra reminder log. The log level is INFO, so we don't mean that it must be a problem.
>
>
> Yours sincerely
>
>
> Yao Haishi
> yhs0092@163.com
>
>
> On 10/24/2018 21:46,wjm wjm<zzzwjm@gmail.com> wrote:
> log the selected mode is necessary
> but pojo mode not know what's other mode......
>
> Willem Jiang <willem.jiang@gmail.com> 于2018年10月24日周三 下午8:30写道:
>
> Hi Haishi
>
> It's important to let the user know about if there is some fallback
> mechanism is used. In this way we could save user lot of time for the
> trouble shooting. We also need to inform the user from log if there
> are some important configuration information is loaded.
>
> BTW, Please fill a JIRA to track this issue.
>
> Willem Jiang
>
> Twitter: willemjiang
> Weibo: 姜宁willem
>
> On Wed, Oct 24, 2018 at 4:14 PM yhs0092 <yhs0092@163.com> wrote:
>
> Hi guys.
> Yesterday, a user asked me about a 404 error. He packed his JavaChassis
> project into a jar file and ran it on his laptop. But when he invoked the
> rest interface by Postman, a 404 error was returned, while if he ran the
> project in Eclipse, this problem did not occur.
>
>
> Finally we found out there was something wrong with maven. On his
> laptop, if maven packaging command was run in Windows CMD, the output jar
> file lacked swagger-generator-springmvc dependency jar.
> As the implementations of SwaggerGeneratorContext are loaded by SPI
> mechanism, there is no error when some classes are abscent. When the
> expected SpringmvcSwaggerGeneratorContext is abscent, the
> PojoSwaggerGeneratorContext will be used as default. As a result, the
> @RequestMapping tagged on REST interface class is ignored, and the name of
> the class is used as basePath instead of the value specified in
> @RequestMapping.
>
>
> After cleaning local maven repo, the problem disappeared. But in this
> case, there is almost no log for helping locate the problem cause.
>
>
> So do we need to add some log to indicate the potential problem?
> Currently I think we can add log to show which SwaggerGeneratorContext
> is selected to generate swagger schema. And if PojoSwaggerGeneratorContext
> is selected, we can add some extra logic to check whether there is @Path or
> @RequestMapping and remind developer to be aware of the dependency jar
> files.
> Any ideas?
>
>
>
>
> Yours sincerely
>
>
> Yao Haishi
> yhs0092@163.com
>
>

Mime
View raw message