Skip to content

Commit 64fec76

Browse files
committed
chore: change sample example
1 parent 1ec832b commit 64fec76

34 files changed

Lines changed: 170 additions & 102 deletions

File tree

  • samples
    • openapi3
      • client/petstore
        • spring-stubs-skip-default-interface/src/main/java/org/openapitools/api
        • spring-stubs/src/main/java/org/openapitools/api
      • server/petstore
        • spring-boot-oneof-interface/src/main/java/org/openapitools/api
        • spring-boot-oneof-sealed/src/main/java/org/openapitools/api
        • spring-boot-oneof/src/main/java/org/openapitools/api
        • spring-boot-springdoc/src/main/java/org/openapitools/api
        • springboot-3/src/main/java/org/openapitools/api
        • springboot-delegate/src/main/java/org/openapitools/api
        • springboot-implicitHeaders/src/main/java/org/openapitools/api
        • springboot-source/src/main/java/org/openapitools/api
        • springboot/src/main/java/org/openapitools/api
    • server/petstore
      • spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/api
      • spring-boot-nullable-set/src/main/java/org/openapitools/api
      • springboot-api-response-examples/src/main/java/org/openapitools/api
      • springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api
      • springboot-beanvalidation/src/main/java/org/openapitools/api
      • springboot-builtin-validation/src/main/java/org/openapitools/api
      • springboot-delegate-j8/src/main/java/org/openapitools/api
      • springboot-delegate-no-response-entity/src/main/java/org/openapitools/api
      • springboot-delegate/src/main/java/org/openapitools/api
      • springboot-file-delegate-optional/src/main/java/org/openapitools/api
      • springboot-implicitHeaders-annotationLibrary/src/main/java/org/openapitools/api
      • springboot-implicitHeaders/src/main/java/org/openapitools/api
      • springboot-lombok-data/src/main/java/org/openapitools/api
      • springboot-lombok-tostring/src/main/java/org/openapitools/api
      • springboot-petstore-with-api-response-examples/src/main/java/org/openapitools/api
      • springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api
      • springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api
      • springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api
      • springboot-spring-pageable/src/main/java/org/openapitools/api
      • springboot-spring-provide-args/src/main/java/org/openapitools/api
      • springboot-useoptional/src/main/java/org/openapitools/api
      • springboot-virtualan/src/main/java/org/openapitools/virtualan/api
      • springboot/src/main/java/org/openapitools/api

samples/openapi3/client/petstore/spring-stubs-skip-default-interface/src/main/java/org/openapitools/api/ApiUtil.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ public class ApiUtil {
99
public static void setExampleResponse(NativeWebRequest req, String contentType, String example) {
1010
try {
1111
HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class);
12-
res.setCharacterEncoding("UTF-8");
13-
res.addHeader("Content-Type", contentType);
14-
res.getWriter().print(example);
12+
if (res != null) {
13+
res.setCharacterEncoding("UTF-8");
14+
res.addHeader("Content-Type", contentType);
15+
res.getWriter().print(example);
16+
}
1517
} catch (IOException e) {
1618
throw new RuntimeException(e);
1719
}

samples/openapi3/client/petstore/spring-stubs/src/main/java/org/openapitools/api/ApiUtil.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ public class ApiUtil {
99
public static void setExampleResponse(NativeWebRequest req, String contentType, String example) {
1010
try {
1111
HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class);
12-
res.setCharacterEncoding("UTF-8");
13-
res.addHeader("Content-Type", contentType);
14-
res.getWriter().print(example);
12+
if (res != null) {
13+
res.setCharacterEncoding("UTF-8");
14+
res.addHeader("Content-Type", contentType);
15+
res.getWriter().print(example);
16+
}
1517
} catch (IOException e) {
1618
throw new RuntimeException(e);
1719
}

samples/openapi3/server/petstore/spring-boot-oneof-interface/src/main/java/org/openapitools/api/ApiUtil.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ public class ApiUtil {
99
public static void setExampleResponse(NativeWebRequest req, String contentType, String example) {
1010
try {
1111
HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class);
12-
res.setCharacterEncoding("UTF-8");
13-
res.addHeader("Content-Type", contentType);
14-
res.getWriter().print(example);
12+
if (res != null) {
13+
res.setCharacterEncoding("UTF-8");
14+
res.addHeader("Content-Type", contentType);
15+
res.getWriter().print(example);
16+
}
1517
} catch (IOException e) {
1618
throw new RuntimeException(e);
1719
}

samples/openapi3/server/petstore/spring-boot-oneof-sealed/src/main/java/org/openapitools/api/ApiUtil.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ public class ApiUtil {
99
public static void setExampleResponse(NativeWebRequest req, String contentType, String example) {
1010
try {
1111
HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class);
12-
res.setCharacterEncoding("UTF-8");
13-
res.addHeader("Content-Type", contentType);
14-
res.getWriter().print(example);
12+
if (res != null) {
13+
res.setCharacterEncoding("UTF-8");
14+
res.addHeader("Content-Type", contentType);
15+
res.getWriter().print(example);
16+
}
1517
} catch (IOException e) {
1618
throw new RuntimeException(e);
1719
}

samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/api/ApiUtil.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ public class ApiUtil {
99
public static void setExampleResponse(NativeWebRequest req, String contentType, String example) {
1010
try {
1111
HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class);
12-
res.setCharacterEncoding("UTF-8");
13-
res.addHeader("Content-Type", contentType);
14-
res.getWriter().print(example);
12+
if (res != null) {
13+
res.setCharacterEncoding("UTF-8");
14+
res.addHeader("Content-Type", contentType);
15+
res.getWriter().print(example);
16+
}
1517
} catch (IOException e) {
1618
throw new RuntimeException(e);
1719
}

samples/openapi3/server/petstore/spring-boot-springdoc/src/main/java/org/openapitools/api/ApiUtil.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ public class ApiUtil {
99
public static void setExampleResponse(NativeWebRequest req, String contentType, String example) {
1010
try {
1111
HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class);
12-
res.setCharacterEncoding("UTF-8");
13-
res.addHeader("Content-Type", contentType);
14-
res.getWriter().print(example);
12+
if (res != null) {
13+
res.setCharacterEncoding("UTF-8");
14+
res.addHeader("Content-Type", contentType);
15+
res.getWriter().print(example);
16+
}
1517
} catch (IOException e) {
1618
throw new RuntimeException(e);
1719
}

samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/api/ApiUtil.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ public class ApiUtil {
99
public static void setExampleResponse(NativeWebRequest req, String contentType, String example) {
1010
try {
1111
HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class);
12-
res.setCharacterEncoding("UTF-8");
13-
res.addHeader("Content-Type", contentType);
14-
res.getWriter().print(example);
12+
if (res != null) {
13+
res.setCharacterEncoding("UTF-8");
14+
res.addHeader("Content-Type", contentType);
15+
res.getWriter().print(example);
16+
}
1517
} catch (IOException e) {
1618
throw new RuntimeException(e);
1719
}

samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/ApiUtil.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ public class ApiUtil {
99
public static void setExampleResponse(NativeWebRequest req, String contentType, String example) {
1010
try {
1111
HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class);
12-
res.setCharacterEncoding("UTF-8");
13-
res.addHeader("Content-Type", contentType);
14-
res.getWriter().print(example);
12+
if (res != null) {
13+
res.setCharacterEncoding("UTF-8");
14+
res.addHeader("Content-Type", contentType);
15+
res.getWriter().print(example);
16+
}
1517
} catch (IOException e) {
1618
throw new RuntimeException(e);
1719
}

samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/ApiUtil.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ public class ApiUtil {
99
public static void setExampleResponse(NativeWebRequest req, String contentType, String example) {
1010
try {
1111
HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class);
12-
res.setCharacterEncoding("UTF-8");
13-
res.addHeader("Content-Type", contentType);
14-
res.getWriter().print(example);
12+
if (res != null) {
13+
res.setCharacterEncoding("UTF-8");
14+
res.addHeader("Content-Type", contentType);
15+
res.getWriter().print(example);
16+
}
1517
} catch (IOException e) {
1618
throw new RuntimeException(e);
1719
}

samples/openapi3/server/petstore/springboot-source/src/main/java/org/openapitools/api/ApiUtil.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ public class ApiUtil {
99
public static void setExampleResponse(NativeWebRequest req, String contentType, String example) {
1010
try {
1111
HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class);
12-
res.setCharacterEncoding("UTF-8");
13-
res.addHeader("Content-Type", contentType);
14-
res.getWriter().print(example);
12+
if (res != null) {
13+
res.setCharacterEncoding("UTF-8");
14+
res.addHeader("Content-Type", contentType);
15+
res.getWriter().print(example);
16+
}
1517
} catch (IOException e) {
1618
throw new RuntimeException(e);
1719
}

0 commit comments

Comments
 (0)