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

[JAVA] [library: vertx] Fix improper initialization of main router in MainApiVerticle template #7230

Closed
ccozzolino opened this issue Dec 20, 2017 · 0 comments

Comments

@ccozzolino
Copy link
Contributor

Description

The current template for MainApiVerticle incorrectly instantiates the protected main Router and does not re-use that router member with the instantiated SwaggerRouter. I propose that we modify the template as follows:

Initiantiate the router as part of the init flow to ensure that the vertx instance is not null:

    Router router;

    @Override
    public void init(Vertx vertx, Context context) {
    	super.init(vertx, context);
    	router = Router.router(vertx);
    }

Also, pass the router member as the first parameter of the SwaggerRouter creation:

Router swaggerRouter = SwaggerRouter.swaggerRouter(router, swagger, vertx.eventBus(), new OperationIdServiceIdResolver());
Swagger-codegen version

2.2.3 and above

Swagger declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
@ccozzolino ccozzolino changed the title [JAVA] [library: vertx] Improvement: Make MainApiVerticle template more flexible [JAVA] [library: vertx] Fix improper initialization of main router in MainApiVerticle template Dec 20, 2017
@wing328 wing328 added this to the v2.3.1 milestone Jan 7, 2018
@wing328 wing328 closed this as completed Jan 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants