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 Wed, 24 Oct 2018 12:30:10 GMT
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