diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java
index ff0f6e679aeb..179917399b02 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java
@@ -26,6 +26,8 @@
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
import org.openapitools.codegen.languages.features.OptionalFeatures;
import org.openapitools.codegen.languages.features.PerformBeanValidationFeatures;
+import org.openapitools.codegen.templating.mustache.SplitStringLambda;
+import org.openapitools.codegen.templating.mustache.TrimWhitespaceLambda;
import org.openapitools.codegen.utils.URLPathUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -463,6 +465,10 @@ public void processOpts() {
(Mustache.Lambda) (fragment, writer) -> writer.write(fragment.execute().replaceAll("\"", Matcher.quoteReplacement("\\\""))));
additionalProperties.put("lambdaRemoveLineBreak",
(Mustache.Lambda) (fragment, writer) -> writer.write(fragment.execute().replaceAll("\\r|\\n", "")));
+
+ additionalProperties.put("lambdaTrimWhitespace", new TrimWhitespaceLambda());
+
+ additionalProperties.put("lambdaSplitString", new SplitStringLambda());
}
@Override
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/SplitStringLambda.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/SplitStringLambda.java
new file mode 100644
index 000000000000..89e99804aaf3
--- /dev/null
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/SplitStringLambda.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
+ * Copyright 2018 SmartBear Software
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openapitools.codegen.templating.mustache;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Locale;
+
+import com.samskivert.mustache.Mustache;
+import com.samskivert.mustache.Template.Fragment;
+
+/**
+ * Splits long fragments into smaller strings and uses a StringBuilder to merge
+ * them back.
+ *
+ * Register:
+ *
+ *
+ * additionalProperties.put("lambdaSplitString", new SplitStringLambda());
+ *
+ *
+ * Use:
+ *
+ *
+ * {{#lambdaSplitString}}{{summary}}{{/lambdaSplitString}}
+ *
+ */
+public class SplitStringLambda implements Mustache.Lambda {
+ private static final int DEFAULT_MAX_LENGTH = 65535;
+
+ private static final String SPLIT_INIT = "new StringBuilder(%d)";
+
+ private static final String SPLIT_PART = ".append(\"%s\")";
+
+ private static final String SPLIT_SUFFIX = ".toString()";
+
+ private final int maxLength;
+
+ public SplitStringLambda() {
+ this(DEFAULT_MAX_LENGTH);
+ }
+
+ public SplitStringLambda(int maxLength) {
+ this.maxLength = maxLength;
+ }
+
+ @Override
+ public void execute(Fragment fragment, Writer writer) throws IOException {
+ String input = fragment.execute();
+ int inputLength = input.length();
+
+ StringBuilder builder = new StringBuilder();
+ if (inputLength > maxLength) {
+
+ // Initialize a StringBuilder
+ builder.append(String.format(Locale.ROOT, SPLIT_INIT, inputLength));
+
+ int currentPosition = 0;
+ int currentStringLength = 0;
+ char currentLastChar = '\\';
+
+ // Split input into parts of at most maxLength and not ending with an escape character
+ // Append each part to the StringBuilder
+ while (currentPosition + maxLength < input.length()) {
+ currentStringLength = maxLength;
+ currentLastChar = input.charAt(currentPosition + currentStringLength - 1);
+ if (currentLastChar == '\\') {
+ --currentStringLength;
+ }
+
+ builder.append(String.format(Locale.ROOT, SPLIT_PART, input.substring(currentPosition, currentPosition + currentStringLength)));
+ currentPosition += currentStringLength;
+ }
+
+ // Append last part if necessary
+ if (currentPosition < input.length()) {
+ builder.append(String.format(Locale.ROOT, SPLIT_PART, input.substring(currentPosition)));
+ }
+
+ // Close the builder and merge everything back to a string
+ builder.append(SPLIT_SUFFIX);
+ } else {
+ builder.append(String.format(Locale.ROOT, "\"%s\"", input));
+ }
+
+ writer.write(builder.toString());
+ }
+
+}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/TrimWhitespaceLambda.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/TrimWhitespaceLambda.java
new file mode 100644
index 000000000000..bdf1d136534a
--- /dev/null
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/TrimWhitespaceLambda.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
+ * Copyright 2018 SmartBear Software
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openapitools.codegen.templating.mustache;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import com.samskivert.mustache.Mustache;
+import com.samskivert.mustache.Template.Fragment;
+
+/**
+ * Replaces duplicate whitespace characters in a fragment with single space.
+ *
+ * Register:
+ *
+ * additionalProperties.put("lambdaTrimWhitespace", new TrimWhitespaceLambda());
+ *
+ *
+ * Use:
+ *
+ * {{#lambdaTrimWhitespace}}{{name}}{{/lambdaTrimWhitespace}}
+ *
+ */
+public class TrimWhitespaceLambda implements Mustache.Lambda {
+ private static final String SINGLE_SPACE = " ";
+
+ private static final String WHITESPACE_REGEX = "\\s+";
+
+ @Override
+ public void execute(Fragment fragment, Writer writer) throws IOException {
+ writer.write(fragment.execute().replaceAll(WHITESPACE_REGEX, SINGLE_SPACE));
+ }
+
+}
diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/exampleString.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/exampleString.mustache
new file mode 100644
index 000000000000..1f72a330ef62
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/JavaSpring/exampleString.mustache
@@ -0,0 +1 @@
+{{#lambdaSplitString}}{{#lambdaRemoveLineBreak}}{{#lambdaEscapeDoubleQuote}}{{#lambdaTrimWhitespace}}{{{example}}}{{/lambdaTrimWhitespace}}{{/lambdaEscapeDoubleQuote}}{{/lambdaRemoveLineBreak}}{{/lambdaSplitString}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/methodBody.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/methodBody.mustache
index 40b041331ce3..e71414e99e1a 100644
--- a/modules/openapi-generator/src/main/resources/JavaSpring/methodBody.mustache
+++ b/modules/openapi-generator/src/main/resources/JavaSpring/methodBody.mustache
@@ -8,7 +8,8 @@ return CompletableFuture.supplyAsync(()-> {
{{#async}} {{/async}} {{/jdk8}}for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
{{/-first}}
{{#async}} {{/async}}{{^async}}{{#jdk8}} {{/jdk8}}{{/async}} if (mediaType.isCompatibleWith(MediaType.valueOf("{{{contentType}}}"))) {
-{{#async}} {{/async}}{{^async}}{{#jdk8}} {{/jdk8}}{{/async}} ApiUtil.setExampleResponse(request, "{{{contentType}}}", "{{#lambdaRemoveLineBreak}}{{#lambdaEscapeDoubleQuote}}{{{example}}}{{/lambdaEscapeDoubleQuote}}{{/lambdaRemoveLineBreak}}");
+{{#async}} {{/async}}{{^async}}{{#jdk8}} {{/jdk8}}{{/async}} String exampleString = {{>exampleString}};
+{{#async}} {{/async}}{{^async}}{{#jdk8}} {{/jdk8}}{{/async}} ApiUtil.setExampleResponse(request, "{{{contentType}}}", exampleString);
{{#async}} {{/async}}{{^async}}{{#jdk8}} {{/jdk8}}{{/async}} break;
{{#async}} {{/async}}{{^async}}{{#jdk8}} {{/jdk8}}{{/async}} }
{{#-last}}
@@ -36,7 +37,8 @@ Mono result = Mono.empty();
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
{{/-first}}
if (mediaType.isCompatibleWith(MediaType.valueOf("{{{contentType}}}"))) {
- result = ApiUtil.getExampleResponse(exchange, "{{#lambdaRemoveLineBreak}}{{#lambdaEscapeDoubleQuote}}{{{example}}}{{/lambdaEscapeDoubleQuote}}{{/lambdaRemoveLineBreak}}");
+ String exampleString = {{>exampleString}};
+ result = ApiUtil.getExampleResponse(exchange, exampleString);
break;
}
{{#-last}}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/templating/mustache/SplitStringLambdaTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/templating/mustache/SplitStringLambdaTest.java
new file mode 100644
index 000000000000..0224a1e695ca
--- /dev/null
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/templating/mustache/SplitStringLambdaTest.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
+ * Copyright 2018 SmartBear Software
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openapitools.codegen.templating.mustache;
+
+import static org.mockito.Mockito.when;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.samskivert.mustache.Template.Fragment;
+
+public class SplitStringLambdaTest {
+ private static final String INPUT_STRING = "1112223334";
+
+ private static final Map EXPECTED_OUTPUTS;
+ static {
+ EXPECTED_OUTPUTS = new HashMap<>();
+ EXPECTED_OUTPUTS.put(2,
+ String.format(
+ Locale.ROOT,
+ "new StringBuilder(%d).append(\"11\").append(\"12\").append(\"22\").append(\"33\").append(\"34\").toString()",
+ INPUT_STRING.length()));
+ EXPECTED_OUTPUTS.put(3,
+ String.format(
+ Locale.ROOT,
+ "new StringBuilder(%d).append(\"111\").append(\"222\").append(\"333\").append(\"4\").toString()",
+ INPUT_STRING.length()));
+ }
+
+ private static final String INPUT_QUOTED_STRING = "1\\\"11\\\"2223\\\"334";
+ private static final String INPUT_QUOTED_OUTPUT = String.format(
+ Locale.ROOT,
+ "new StringBuilder(%d).append(\"1\\\"\").append(\"11\").append(\"\\\"2\").append(\"223\").append(\"\\\"3\").append(\"34\").toString()",
+ INPUT_QUOTED_STRING.length());
+
+ @Mock
+ private Fragment fragment;
+
+ @BeforeMethod
+ public void init() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @AfterMethod
+ public void reset() {
+ Mockito.reset(fragment);
+ }
+
+ private void testString(String input, int maxLength, String expected) throws IOException {
+ when(fragment.execute()).thenReturn(input);
+
+ StringWriter output = new StringWriter();
+ new SplitStringLambda(maxLength).execute(fragment, output);
+ assertEquals(output.toString(), expected);
+ }
+
+ @Test
+ public void testSplitGroupsOf2() throws IOException {
+ int maxLength = 2;
+ testString(INPUT_STRING, maxLength, EXPECTED_OUTPUTS.get(maxLength));
+ }
+
+ @Test
+ public void testSplitGroupsOf3() throws IOException {
+ int maxLength = 3;
+ testString(INPUT_STRING, maxLength, EXPECTED_OUTPUTS.get(maxLength));
+ }
+
+ @Test
+ public void testSplitQuotedString() throws IOException {
+ int maxLength = 3;
+ testString(INPUT_QUOTED_STRING, maxLength, INPUT_QUOTED_OUTPUT);
+ }
+
+ @Test
+ public void testShortString() throws IOException {
+ testString(INPUT_STRING, INPUT_STRING.length(), String.format(Locale.ROOT, "\"%s\"", INPUT_STRING));
+ }
+
+}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/templating/mustache/TrimWhitespaceLambdaTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/templating/mustache/TrimWhitespaceLambdaTest.java
new file mode 100644
index 000000000000..556bde9e1058
--- /dev/null
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/templating/mustache/TrimWhitespaceLambdaTest.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
+ * Copyright 2018 SmartBear Software
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openapitools.codegen.templating.mustache;
+
+import static org.mockito.Mockito.when;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.io.StringWriter;
+
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.samskivert.mustache.Template.Fragment;
+
+public class TrimWhitespaceLambdaTest {
+
+ @Mock
+ private Fragment fragment;
+
+ @BeforeMethod
+ public void init() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @AfterMethod
+ public void reset() {
+ Mockito.reset(fragment);
+ }
+
+ @Test
+ public void testTrimWhitespace() throws IOException {
+ when(fragment.execute()).thenReturn("\t a b\t\tc \t");
+
+ StringWriter output = new StringWriter();
+ new TrimWhitespaceLambda().execute(fragment, output);
+ assertEquals(output.toString(), " a b c ");
+ }
+
+}
diff --git a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/PetApi.java b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/PetApi.java
index 8a3cdac2d3a1..7296fa52c150 100644
--- a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/PetApi.java
+++ b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/PetApi.java
@@ -86,11 +86,13 @@ default ResponseEntity> findPetsByStatus(@NotNull @ApiParam(value = "S
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}");
+ String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
- ApiUtil.setExampleResponse(request, "application/xml", " 123456789 doggie aeiou aeiou");
+ String exampleString = " 123456789 doggie aeiou aeiou ";
+ ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
@@ -116,11 +118,13 @@ default ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tag
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}");
+ String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
- ApiUtil.setExampleResponse(request, "application/xml", " 123456789 doggie aeiou aeiou");
+ String exampleString = " 123456789 doggie aeiou aeiou ";
+ ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
@@ -144,11 +148,13 @@ default ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",r
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}");
+ String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
- ApiUtil.setExampleResponse(request, "application/xml", " 123456789 doggie aeiou aeiou");
+ String exampleString = " 123456789 doggie aeiou aeiou ";
+ ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
@@ -210,7 +216,8 @@ default ResponseEntity uploadFile(@ApiParam(value = "ID of pet
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}");
+ String exampleString = "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
diff --git a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/StoreApi.java b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/StoreApi.java
index e12e9f1d48db..f32fb731ad05 100644
--- a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/StoreApi.java
+++ b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/StoreApi.java
@@ -74,11 +74,13 @@ default ResponseEntity getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}");
+ String exampleString = "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
- ApiUtil.setExampleResponse(request, "application/xml", " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true");
+ String exampleString = " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true ";
+ ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
@@ -99,11 +101,13 @@ default ResponseEntity placeOrder(@ApiParam(value = "order placed for pur
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}");
+ String exampleString = "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
- ApiUtil.setExampleResponse(request, "application/xml", " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true");
+ String exampleString = " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true ";
+ ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
diff --git a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/UserApi.java b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/UserApi.java
index 03897a65e143..b7f2e073c797 100644
--- a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/UserApi.java
+++ b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/UserApi.java
@@ -93,11 +93,13 @@ default ResponseEntity getUserByName(@ApiParam(value = "The name that need
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"firstName\" : \"firstName\", \"lastName\" : \"lastName\", \"password\" : \"password\", \"userStatus\" : 6, \"phone\" : \"phone\", \"id\" : 0, \"email\" : \"email\", \"username\" : \"username\"}");
+ String exampleString = "{ \"firstName\" : \"firstName\", \"lastName\" : \"lastName\", \"password\" : \"password\", \"userStatus\" : 6, \"phone\" : \"phone\", \"id\" : 0, \"email\" : \"email\", \"username\" : \"username\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
- ApiUtil.setExampleResponse(request, "application/xml", " 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123");
+ String exampleString = " 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123 ";
+ ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/AnotherFakeApi.java
index 48e06a9e5fc2..e8ead42ee124 100644
--- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/AnotherFakeApi.java
+++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/AnotherFakeApi.java
@@ -48,7 +48,8 @@ default CompletableFuture> call123testSpecialTags(@ApiPar
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"client\" : \"client\"}");
+ String exampleString = "{ \"client\" : \"client\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/FakeApi.java
index 851b3e054c74..306426fa9ed1 100644
--- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/FakeApi.java
+++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/FakeApi.java
@@ -81,7 +81,8 @@ default CompletableFuture> fakeOuterCompositeSeri
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) {
- ApiUtil.setExampleResponse(request, "*/*", "{ \"my_string\" : \"my_string\", \"my_number\" : 0.8008281904610115, \"my_boolean\" : true}");
+ String exampleString = "{ \"my_string\" : \"my_string\", \"my_number\" : 0.8008281904610115, \"my_boolean\" : true }";
+ ApiUtil.setExampleResponse(request, "*/*", exampleString);
break;
}
}
@@ -152,7 +153,8 @@ default CompletableFuture> testClientModel(@ApiParam(valu
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"client\" : \"client\"}");
+ String exampleString = "{ \"client\" : \"client\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
@@ -254,7 +256,8 @@ default CompletableFuture> uploadFileWithRequir
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}");
+ String exampleString = "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/FakeClassnameTestApi.java
index e75ef015a3aa..85db0b3e3aea 100644
--- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/FakeClassnameTestApi.java
+++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/FakeClassnameTestApi.java
@@ -50,7 +50,8 @@ default CompletableFuture> testClassname(@ApiParam(value
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"client\" : \"client\"}");
+ String exampleString = "{ \"client\" : \"client\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/PetApi.java
index d12ba9ed6429..4ce862822cd6 100644
--- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/PetApi.java
+++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/PetApi.java
@@ -90,11 +90,13 @@ default CompletableFuture>> findPetsByStatus(@NotNull @
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}");
+ String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
- ApiUtil.setExampleResponse(request, "application/xml", " 123456789 doggie aeiou aeiou");
+ String exampleString = " 123456789 doggie aeiou aeiou ";
+ ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
@@ -122,11 +124,13 @@ default CompletableFuture>> findPetsByTags(@NotNull @Ap
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}");
+ String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
- ApiUtil.setExampleResponse(request, "application/xml", " 123456789 doggie aeiou aeiou");
+ String exampleString = " 123456789 doggie aeiou aeiou ";
+ ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
@@ -152,11 +156,13 @@ default CompletableFuture> getPetById(@ApiParam(value = "ID
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}");
+ String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
- ApiUtil.setExampleResponse(request, "application/xml", " 123456789 doggie aeiou aeiou");
+ String exampleString = " 123456789 doggie aeiou aeiou ";
+ ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
@@ -221,7 +227,8 @@ default CompletableFuture> uploadFile(@ApiParam
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}");
+ String exampleString = "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/StoreApi.java
index 2dc313a53b8a..c1375bf11316 100644
--- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/StoreApi.java
+++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/StoreApi.java
@@ -76,11 +76,13 @@ default CompletableFuture> getOrderById(@Min(1L) @Max(5L)
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}");
+ String exampleString = "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
- ApiUtil.setExampleResponse(request, "application/xml", " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true");
+ String exampleString = " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true ";
+ ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
@@ -103,11 +105,13 @@ default CompletableFuture> placeOrder(@ApiParam(value = "o
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}");
+ String exampleString = "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
- ApiUtil.setExampleResponse(request, "application/xml", " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true");
+ String exampleString = " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true ";
+ ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/UserApi.java
index 8ede362ba0fe..ab1d926a2e57 100644
--- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/UserApi.java
+++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/UserApi.java
@@ -95,11 +95,13 @@ default CompletableFuture> getUserByName(@ApiParam(value =
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"firstName\" : \"firstName\", \"lastName\" : \"lastName\", \"password\" : \"password\", \"userStatus\" : 6, \"phone\" : \"phone\", \"id\" : 0, \"email\" : \"email\", \"username\" : \"username\"}");
+ String exampleString = "{ \"firstName\" : \"firstName\", \"lastName\" : \"lastName\", \"password\" : \"password\", \"userStatus\" : 6, \"phone\" : \"phone\", \"id\" : 0, \"email\" : \"email\", \"username\" : \"username\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
- ApiUtil.setExampleResponse(request, "application/xml", " 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123");
+ String exampleString = " 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123 ";
+ ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/AnotherFakeApi.java
index 9a93b057baad..9c42b1915cf8 100644
--- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/AnotherFakeApi.java
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/AnotherFakeApi.java
@@ -46,7 +46,8 @@ default ResponseEntity call123testSpecialTags(@ApiParam(value = "client
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"client\" : \"client\"}");
+ String exampleString = "{ \"client\" : \"client\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/FakeApi.java
index 68ff26c0e132..78052f181030 100644
--- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/FakeApi.java
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/FakeApi.java
@@ -79,7 +79,8 @@ default ResponseEntity fakeOuterCompositeSerialize(@ApiParam(val
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) {
- ApiUtil.setExampleResponse(request, "*/*", "{ \"my_string\" : \"my_string\", \"my_number\" : 0.8008281904610115, \"my_boolean\" : true}");
+ String exampleString = "{ \"my_string\" : \"my_string\", \"my_number\" : 0.8008281904610115, \"my_boolean\" : true }";
+ ApiUtil.setExampleResponse(request, "*/*", exampleString);
break;
}
}
@@ -148,7 +149,8 @@ default ResponseEntity testClientModel(@ApiParam(value = "client model"
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"client\" : \"client\"}");
+ String exampleString = "{ \"client\" : \"client\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
@@ -248,7 +250,8 @@ default ResponseEntity uploadFileWithRequiredFile(@ApiParam(va
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}");
+ String exampleString = "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/FakeClassnameTestApi.java
index 483949a5cb6b..71fc4168f87c 100644
--- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/FakeClassnameTestApi.java
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/FakeClassnameTestApi.java
@@ -48,7 +48,8 @@ default ResponseEntity testClassname(@ApiParam(value = "client model" ,r
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"client\" : \"client\"}");
+ String exampleString = "{ \"client\" : \"client\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/PetApi.java
index be0c56e311ed..d0f2893bda61 100644
--- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/PetApi.java
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/PetApi.java
@@ -88,11 +88,13 @@ default ResponseEntity> findPetsByStatus(@NotNull @ApiParam(value = "S
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}");
+ String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
- ApiUtil.setExampleResponse(request, "application/xml", " 123456789 doggie aeiou aeiou");
+ String exampleString = " 123456789 doggie aeiou aeiou ";
+ ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
@@ -118,11 +120,13 @@ default ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tag
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}");
+ String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
- ApiUtil.setExampleResponse(request, "application/xml", " 123456789 doggie aeiou aeiou");
+ String exampleString = " 123456789 doggie aeiou aeiou ";
+ ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
@@ -146,11 +150,13 @@ default ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",r
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}");
+ String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
- ApiUtil.setExampleResponse(request, "application/xml", " 123456789 doggie aeiou aeiou");
+ String exampleString = " 123456789 doggie aeiou aeiou ";
+ ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
@@ -213,7 +219,8 @@ default ResponseEntity uploadFile(@ApiParam(value = "ID of pet
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}");
+ String exampleString = "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/StoreApi.java
index b9b13f85b21d..9fd364923e15 100644
--- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/StoreApi.java
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/StoreApi.java
@@ -74,11 +74,13 @@ default ResponseEntity getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}");
+ String exampleString = "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
- ApiUtil.setExampleResponse(request, "application/xml", " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true");
+ String exampleString = " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true ";
+ ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
@@ -99,11 +101,13 @@ default ResponseEntity placeOrder(@ApiParam(value = "order placed for pur
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}");
+ String exampleString = "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
- ApiUtil.setExampleResponse(request, "application/xml", " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true");
+ String exampleString = " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true ";
+ ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/UserApi.java
index 4e63f5635ff7..bcaa945800f9 100644
--- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/UserApi.java
+++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/UserApi.java
@@ -93,11 +93,13 @@ default ResponseEntity getUserByName(@ApiParam(value = "The name that need
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"firstName\" : \"firstName\", \"lastName\" : \"lastName\", \"password\" : \"password\", \"userStatus\" : 6, \"phone\" : \"phone\", \"id\" : 0, \"email\" : \"email\", \"username\" : \"username\"}");
+ String exampleString = "{ \"firstName\" : \"firstName\", \"lastName\" : \"lastName\", \"password\" : \"password\", \"userStatus\" : 6, \"phone\" : \"phone\", \"id\" : 0, \"email\" : \"email\", \"username\" : \"username\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
- ApiUtil.setExampleResponse(request, "application/xml", " 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123");
+ String exampleString = " 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123 ";
+ ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/AnotherFakeApiController.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/AnotherFakeApiController.java
index 5043c58114fe..fb922708cb05 100644
--- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/AnotherFakeApiController.java
+++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/AnotherFakeApiController.java
@@ -34,7 +34,8 @@ public AnotherFakeApiController(NativeWebRequest request) {
public ResponseEntity call123testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"client\" : \"client\"}");
+ String exampleString = "{ \"client\" : \"client\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeApiController.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeApiController.java
index dc60b7280558..1778cc30e75d 100644
--- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeApiController.java
+++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeApiController.java
@@ -54,7 +54,8 @@ public ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Inpu
public ResponseEntity fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body) {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) {
- ApiUtil.setExampleResponse(request, "*/*", "{ \"my_string\" : \"my_string\", \"my_number\" : 0.8008281904610115, \"my_boolean\" : true}");
+ String exampleString = "{ \"my_string\" : \"my_string\", \"my_number\" : 0.8008281904610115, \"my_boolean\" : true }";
+ ApiUtil.setExampleResponse(request, "*/*", exampleString);
break;
}
}
@@ -85,7 +86,8 @@ public ResponseEntity testBodyWithQueryParams(@NotNull @ApiParam(value = "
public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"client\" : \"client\"}");
+ String exampleString = "{ \"client\" : \"client\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
@@ -126,7 +128,8 @@ public ResponseEntity testQueryParameterCollectionFormat(@NotNull @ApiPara
public ResponseEntity uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}");
+ String exampleString = "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java
index a3b9ad557a77..d2642a4ceeb2 100644
--- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java
+++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java
@@ -34,7 +34,8 @@ public FakeClassnameTestApiController(NativeWebRequest request) {
public ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"client\" : \"client\"}");
+ String exampleString = "{ \"client\" : \"client\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/PetApiController.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/PetApiController.java
index 53c37962bdfc..b1e82a3f7376 100644
--- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/PetApiController.java
+++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/PetApiController.java
@@ -46,11 +46,13 @@ public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",requi
public ResponseEntity> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) List status) {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}");
+ String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
- ApiUtil.setExampleResponse(request, "application/xml", " 123456789 doggie aeiou aeiou");
+ String exampleString = " 123456789 doggie aeiou aeiou ";
+ ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
@@ -61,11 +63,13 @@ public ResponseEntity> findPetsByStatus(@NotNull @ApiParam(value = "St
public ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags) {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}");
+ String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
- ApiUtil.setExampleResponse(request, "application/xml", " 123456789 doggie aeiou aeiou");
+ String exampleString = " 123456789 doggie aeiou aeiou ";
+ ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
@@ -76,11 +80,13 @@ public ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags
public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathVariable("petId") Long petId) {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}");
+ String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
- ApiUtil.setExampleResponse(request, "application/xml", " 123456789 doggie aeiou aeiou");
+ String exampleString = " 123456789 doggie aeiou aeiou ";
+ ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
@@ -101,7 +107,8 @@ public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that
public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
- ApiUtil.setExampleResponse(request, "application/json", "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}");
+ String exampleString = "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\" }";
+ ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/StoreApiController.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/StoreApiController.java
index acddbe963522..63aa57e3c02d 100644
--- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/StoreApiController.java
+++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/StoreApiController.java
@@ -45,11 +45,13 @@ public ResponseEntity