[Java-server] Fix improper quoting of default values for query parameters#708
Merged
jmini merged 3 commits intoOpenAPITools:masterfrom Aug 21, 2018
Merged
[Java-server] Fix improper quoting of default values for query parameters#708jmini merged 3 commits intoOpenAPITools:masterfrom
jmini merged 3 commits intoOpenAPITools:masterfrom
Conversation
Conflicts: modules/openapi-generator/src/main/resources/JavaJaxRS/spec/queryParams.mustache
Member
|
Thank you a lot, I have merged If the CI is green I will merge this PR. Tested locally with openapi: 3.0.0
info:
title: Issue 540 example
version: 1.0.0
paths:
/foo:
get:
parameters:
- name: bar
in: query
required: false
schema:
type: string
default: foobar
responses:
default:
description: successful operation
components:
schemas:
SomeObj:
properties:
property:
type: integer
format: int64 |
jmini
approved these changes
Aug 21, 2018
Member
|
@OmriHarary thanks for the fix, which is included in the v3.2.2 stable release: https://twitter.com/oas_generator/status/1032252335131512832 |
jmini
added a commit
to jmini/openapi-experiments
that referenced
this pull request
Aug 22, 2018
A-Joshi
pushed a commit
to ihsmarkitoss/openapi-generator
that referenced
this pull request
Feb 27, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR checklist
./bin/to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.shand./bin/security/{LANG}-petstore.shif updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\.master,4.0.x. Default:master.cc: @bbdouglas @JFCote @sreeshas @jfiala @lukoyanov @cbornet @jeff9finger
Description of the PR
Fixes issue described in #540 where non-enum string default values for query parameters were being surrounded with two sets of quotes so generated code would not compile.
Modified templates for
spring,java-pkmst,java-msf4j,jaxrs-cxf,jaxrs-spec,jaxrs-cxf-cdi,jaxrs-cxf-client,jaxrs-jersey, andjaxrs-resteasygenerators to only add double quotes around non-string and string enum default values, sinceAbstractJavaCodegen.toDefaultValue()already adds the quotes to non-enum string values.The issue is also present in code generated by
java-play-framework, but attempted fixes caused problems with non-query params and likely require more substantial changes.Also fixes a related issue with
java-vertxgeneration where the quotes on string default values were being HTML escaped, and string enum default values were not being quoted at all.