Skip to content

[Java] Fixed defaultValue escaping in Vert.x server template#5321

Merged
wing328 merged 3 commits intoOpenAPITools:masterfrom
MarcelTon:master
Jan 28, 2021
Merged

[Java] Fixed defaultValue escaping in Vert.x server template#5321
wing328 merged 3 commits intoOpenAPITools:masterfrom
MarcelTon:master

Conversation

@MarcelTon
Copy link
Copy Markdown
Contributor

Line 55 and 84 were missing the triple-HTLM escape brackets (line 71 had this correctly) leading to code generation such as:

        vertx.eventBus().<JsonObject> consumer(LISTACCOUNTS_SERVICE_ID).handler(message -> {
            try {
                // Workaround for #allParams section clearing the vendorExtensions map
                String serviceId = "listAccounts";
                String emailAddressParam = message.body().getString("emailAddress");
                String emailAddress = (emailAddressParam == null) ? null : emailAddressParam;
                JsonArray profileIdParam = message.body().getJsonArray("profileId");
                List<String> profileId = (profileIdParam == null) ? new ArrayList&lt;&gt;() : Json.mapper.readValue(profileIdParam.encode(),
                    Json.mapper.getTypeFactory().constructCollectionType(List.class, String.class));
                String schoolIdParam = message.body().getString("schoolId");
                String schoolId = (schoolIdParam == null) ? null : schoolIdParam;
                service.listAccounts(emailAddress, profileId, schoolId).subscribe(
                    result -> {
                        message.reply(new JsonArray(Json.encode(result)).encodePrettily());
                    },
                    error -> {
                        manageError(message, error, "listAccounts");
                    });
            } catch (Exception e) {
                logUnexpectedError("listAccounts", e);
                message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage());
            }
        });

Note the ArrayList&lt;&gt;() notation.

@MarcelTon
Copy link
Copy Markdown
Contributor Author

Apologies, I'm new to the OpenSource experience. I ran all Java/Vert.x related scripts and committed the, albeit small, changes. Unit and integration tests pass.

PR checklist

  • Read the contribution guidelines.
  • If contributing template-only or documentation-only changes which will change sample output, build the project before.
  • Run the shell script(s) under ./bin/ (or Windows batch scripts under.\bin\windows) to update Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit, and these must match the expectations made by your contribution. You only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh if updating the code or mustache templates for a language ({LANG}) (e.g. php, ruby, python, etc).
  • File the PR against the correct branch: master, 4.3.x, 5.0.x. Default: master.
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.

@bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10) @bkabrda (2020/01)

@MarcelTon MarcelTon changed the title Fixed defaultValue escaping in Vert.x server template [BUG][Java]Fixed defaultValue escaping in Vert.x server template Feb 16, 2020
Copy link
Copy Markdown
Contributor

@lwlee2608 lwlee2608 left a comment

Choose a reason for hiding this comment

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

Very minor fix. Should be good

@MarcelTon
Copy link
Copy Markdown
Contributor Author

Very minor fix. Should be good

Thnx @lwlee2608 ! Do you now what the release schedule/trigger is for the project?

@MarcelTon
Copy link
Copy Markdown
Contributor Author

@wing328 could I ask you if I still need to do something/help with something to get this in the next release? I know it's tiny, but since we're using a List in one of our API's it does break code generation - and I am new to open source and now doubting why this wasn't in the release 4 days ago. Sorry if it's an obvious question.

@MarcelTon
Copy link
Copy Markdown
Contributor Author

Please?

@mrulli
Copy link
Copy Markdown

mrulli commented Nov 29, 2020

Hello, we are getting this error too with version 4.3.1 of openapi-generator. Any update on this? Thanks.

@wing328
Copy link
Copy Markdown
Member

wing328 commented Jan 27, 2021

@MarcelTon thanks for PR and my apologies for missing it. I've pushed an update to resolve the merge conflicts and will merge if all the tests pass.

@wing328 wing328 merged commit 5b82ed9 into OpenAPITools:master Jan 28, 2021
@wing328 wing328 changed the title [BUG][Java]Fixed defaultValue escaping in Vert.x server template [Java] Fixed defaultValue escaping in Vert.x server template Feb 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants