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> getInventory() { public ResponseEntity getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathVariable("order_id") Long orderId) { 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; } } @@ -60,11 +62,13 @@ public ResponseEntity getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "I public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) { 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/src/main/java/org/openapitools/api/UserApiController.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/UserApiController.java index 40b796dc32d1..6c7ad6eaf7eb 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/UserApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/UserApiController.java @@ -55,11 +55,13 @@ public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathVariable("username") String username) { 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/springboot-beanvalidation/src/main/java/org/openapitools/api/AnotherFakeApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/AnotherFakeApiController.java index 28462f31ab3b..a01520a180f9 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/AnotherFakeApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/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/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApiController.java index d03f6b39ba5b..af119a493c4a 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/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/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java index b749d734b415..378b0d9a486d 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/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/springboot-beanvalidation/src/main/java/org/openapitools/api/PetApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/PetApiController.java index bf3d57f90aad..b263f984ecd7 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/PetApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/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/springboot-beanvalidation/src/main/java/org/openapitools/api/StoreApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/StoreApiController.java index 28ce69c093d5..6d52b0acce56 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/StoreApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/StoreApiController.java @@ -45,11 +45,13 @@ public ResponseEntity> getInventory() { public ResponseEntity getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathVariable("order_id") Long orderId) { 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; } } @@ -60,11 +62,13 @@ public ResponseEntity getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "I public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) { 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/springboot-beanvalidation/src/main/java/org/openapitools/api/UserApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/UserApiController.java index 58f252ae90a7..d87450cf58ed 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/UserApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/UserApiController.java @@ -55,11 +55,13 @@ public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathVariable("username") String username) { 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/springboot-delegate-j8/src/main/java/org/openapitools/api/AnotherFakeApiDelegate.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/AnotherFakeApiDelegate.java index bdefef0d331b..a8c46f16e4a7 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/AnotherFakeApiDelegate.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/AnotherFakeApiDelegate.java @@ -30,7 +30,8 @@ default ResponseEntity call123testSpecialTags(Client body) { 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/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApiDelegate.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApiDelegate.java index 03441e760eb4..9f4a2692e9e8 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApiDelegate.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApiDelegate.java @@ -56,7 +56,8 @@ default ResponseEntity fakeOuterCompositeSerialize(OuterComposit 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; } } @@ -105,7 +106,8 @@ default ResponseEntity testClientModel(Client body) { 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; } } @@ -201,7 +203,8 @@ default ResponseEntity uploadFileWithRequiredFile(Long petId, 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/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeClassnameTestApiDelegate.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeClassnameTestApiDelegate.java index 3e95af6de1c6..df29ad43a893 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeClassnameTestApiDelegate.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeClassnameTestApiDelegate.java @@ -30,7 +30,8 @@ default ResponseEntity testClassname(Client body) { 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/springboot-delegate-j8/src/main/java/org/openapitools/api/PetApiDelegate.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/PetApiDelegate.java index b2b7360f4dc6..ea1a5ebed508 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/PetApiDelegate.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/PetApiDelegate.java @@ -49,11 +49,13 @@ default ResponseEntity> findPetsByStatus(List status) { 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; } } @@ -69,11 +71,13 @@ default ResponseEntity> findPetsByTags(List tags) { 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; } } @@ -89,11 +93,13 @@ default ResponseEntity getPetById(Long petId) { 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; } } @@ -129,7 +135,8 @@ default ResponseEntity uploadFile(Long petId, 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/springboot-delegate-j8/src/main/java/org/openapitools/api/StoreApiDelegate.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/StoreApiDelegate.java index 995ff1dc25f9..036309ceb6ff 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/StoreApiDelegate.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/StoreApiDelegate.java @@ -47,11 +47,13 @@ default ResponseEntity getOrderById(Long orderId) { 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; } } @@ -67,11 +69,13 @@ default ResponseEntity placeOrder(Order body) { 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/springboot-delegate-j8/src/main/java/org/openapitools/api/UserApiDelegate.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/UserApiDelegate.java index bc3af7039732..c90d5e722193 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/UserApiDelegate.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/UserApiDelegate.java @@ -63,11 +63,13 @@ default ResponseEntity getUserByName(String username) { 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/springboot-implicitHeaders/src/main/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/AnotherFakeApi.java index 29b51909fd90..669a46f41402 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/AnotherFakeApi.java @@ -48,7 +48,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/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java index 3d76194529fe..1a15a9f04406 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java @@ -85,7 +85,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; } } @@ -164,7 +165,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; } } @@ -282,7 +284,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/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeClassnameTestApi.java index cf696d7bd304..ae5ef51ea074 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeClassnameTestApi.java @@ -50,7 +50,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/springboot-implicitHeaders/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/PetApi.java index f576eb40b0b1..b0c9925f23c6 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/PetApi.java @@ -95,11 +95,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; } } @@ -127,11 +129,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; } } @@ -157,11 +161,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; } } @@ -230,7 +236,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/springboot-implicitHeaders/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/StoreApi.java index 27165f532d08..9824a85a8de3 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/StoreApi.java @@ -80,11 +80,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; } } @@ -107,11 +109,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/springboot-implicitHeaders/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/UserApi.java index 6a63e6c793f9..b7b789d57eb2 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/UserApi.java @@ -103,11 +103,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/springboot-reactive/src/main/java/org/openapitools/api/AnotherFakeApiDelegate.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/AnotherFakeApiDelegate.java index a67f2f5387cf..549a66207fa0 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/AnotherFakeApiDelegate.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/AnotherFakeApiDelegate.java @@ -35,7 +35,8 @@ default Mono> call123testSpecialTags(Mono body, exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"client\" : \"client\"}"); + String exampleString = "{ \"client\" : \"client\" }"; + result = ApiUtil.getExampleResponse(exchange, exampleString); break; } } diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiDelegate.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiDelegate.java index 2c23dcd502b4..c61a3d26c7c7 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiDelegate.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiDelegate.java @@ -67,7 +67,8 @@ default Mono> fakeOuterCompositeSerialize(Mono> testClientModel(Mono body, exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"client\" : \"client\"}"); + String exampleString = "{ \"client\" : \"client\" }"; + result = ApiUtil.getExampleResponse(exchange, exampleString); break; } } @@ -244,7 +246,8 @@ default Mono> uploadFileWithRequiredFile(Long p exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}"); + String exampleString = "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\" }"; + result = ApiUtil.getExampleResponse(exchange, exampleString); break; } } diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeClassnameTestApiDelegate.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeClassnameTestApiDelegate.java index d99a67396261..0373ca1aec33 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeClassnameTestApiDelegate.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeClassnameTestApiDelegate.java @@ -35,7 +35,8 @@ default Mono> testClassname(Mono body, exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"client\" : \"client\"}"); + String exampleString = "{ \"client\" : \"client\" }"; + result = ApiUtil.getExampleResponse(exchange, exampleString); break; } } diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApiDelegate.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApiDelegate.java index 630d4a3f99d6..f8f3d8fd98c8 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApiDelegate.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApiDelegate.java @@ -60,11 +60,13 @@ default Mono>> findPetsByStatus(List status, exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"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\" }"; + result = ApiUtil.getExampleResponse(exchange, exampleString); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - result = ApiUtil.getExampleResponse(exchange, " 123456789 doggie aeiou aeiou"); + String exampleString = " 123456789 doggie aeiou aeiou "; + result = ApiUtil.getExampleResponse(exchange, exampleString); break; } } @@ -81,11 +83,13 @@ default Mono>> findPetsByTags(List tags, exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"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\" }"; + result = ApiUtil.getExampleResponse(exchange, exampleString); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - result = ApiUtil.getExampleResponse(exchange, " 123456789 doggie aeiou aeiou"); + String exampleString = " 123456789 doggie aeiou aeiou "; + result = ApiUtil.getExampleResponse(exchange, exampleString); break; } } @@ -102,11 +106,13 @@ default Mono> getPetById(Long petId, exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"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\" }"; + result = ApiUtil.getExampleResponse(exchange, exampleString); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - result = ApiUtil.getExampleResponse(exchange, " 123456789 doggie aeiou aeiou"); + String exampleString = " 123456789 doggie aeiou aeiou "; + result = ApiUtil.getExampleResponse(exchange, exampleString); break; } } @@ -149,7 +155,8 @@ default Mono> uploadFile(Long petId, exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}"); + String exampleString = "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\" }"; + result = ApiUtil.getExampleResponse(exchange, exampleString); break; } } diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/StoreApiDelegate.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/StoreApiDelegate.java index 72fb559347e2..672d1dbb8d37 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/StoreApiDelegate.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/StoreApiDelegate.java @@ -57,11 +57,13 @@ default Mono> getOrderById(Long orderId, exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"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\" }"; + result = ApiUtil.getExampleResponse(exchange, exampleString); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - result = ApiUtil.getExampleResponse(exchange, " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true"); + String exampleString = " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true "; + result = ApiUtil.getExampleResponse(exchange, exampleString); break; } } @@ -78,11 +80,13 @@ default Mono> placeOrder(Mono body, exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"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\" }"; + result = ApiUtil.getExampleResponse(exchange, exampleString); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - result = ApiUtil.getExampleResponse(exchange, " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true"); + String exampleString = " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true "; + result = ApiUtil.getExampleResponse(exchange, exampleString); break; } } diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApiDelegate.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApiDelegate.java index 156ba16a7693..13994de33a82 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApiDelegate.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApiDelegate.java @@ -80,11 +80,13 @@ default Mono> getUserByName(String username, exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"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\" }"; + result = ApiUtil.getExampleResponse(exchange, exampleString); break; } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - result = ApiUtil.getExampleResponse(exchange, " 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123"); + String exampleString = " 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123 "; + result = ApiUtil.getExampleResponse(exchange, exampleString); break; } } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/AnotherFakeApi.java index 9a93b057baad..9c42b1915cf8 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/springboot-useoptional/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/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java index bc118661dbdd..3910c5797c4d 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-useoptional/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/springboot-useoptional/src/main/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeClassnameTestApi.java index 483949a5cb6b..71fc4168f87c 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/springboot-useoptional/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/springboot-useoptional/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/PetApi.java index 84413287f672..beb6a1e9e610 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot-useoptional/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/springboot-useoptional/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/StoreApi.java index b9b13f85b21d..9fd364923e15 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-useoptional/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/springboot-useoptional/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/UserApi.java index 4e63f5635ff7..bcaa945800f9 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot-useoptional/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/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/AnotherFakeApi.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/AnotherFakeApi.java index b7618b9d629b..12599cc0cc0a 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/AnotherFakeApi.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/AnotherFakeApi.java @@ -50,7 +50,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/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java index 66625909854b..26ed3ba5425f 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java @@ -85,7 +85,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; } } @@ -159,7 +160,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; } } @@ -266,7 +268,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/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeClassnameTestApi.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeClassnameTestApi.java index d43199bbe13d..ba3d5a054ca8 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeClassnameTestApi.java @@ -52,7 +52,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/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/PetApi.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/PetApi.java index adc1d0361250..9d2a8d3788a6 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/PetApi.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/PetApi.java @@ -94,11 +94,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; } } @@ -125,11 +127,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; } } @@ -154,11 +158,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; } } @@ -224,7 +230,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/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/StoreApi.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/StoreApi.java index d7c3e5ad9863..4d1986221f44 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/StoreApi.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/StoreApi.java @@ -80,11 +80,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; } } @@ -106,11 +108,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/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/UserApi.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/UserApi.java index f660e7a899e2..3dea9f76518c 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/UserApi.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/UserApi.java @@ -101,11 +101,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/springboot/src/main/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/AnotherFakeApi.java index 9a93b057baad..9c42b1915cf8 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/springboot/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/springboot/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApi.java index 57da91087ca6..b51f20e16123 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot/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/springboot/src/main/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeClassnameTestApi.java index 483949a5cb6b..71fc4168f87c 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/springboot/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/springboot/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/PetApi.java index be0c56e311ed..d0f2893bda61 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot/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/springboot/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/StoreApi.java index b9b13f85b21d..9fd364923e15 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot/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/springboot/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/UserApi.java index 4e63f5635ff7..bcaa945800f9 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot/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; } }