You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2018/09/17 12:31:50 UTC
[juneau] branch master updated: Make SwaggerUI more resilient to
serializer/parser issues.
This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new 31462c4 Make SwaggerUI more resilient to serializer/parser issues.
31462c4 is described below
commit 31462c402cec13e38cca0b3f925b34d21f806b8c
Author: JamesBognar <ja...@apache.org>
AuthorDate: Mon Sep 17 08:31:37 2018 -0400
Make SwaggerUI more resilient to serializer/parser issues.
---
.../apache/juneau/dto/swagger/ui/SwaggerUI.java | 57 +++++++++++++---------
1 file changed, 33 insertions(+), 24 deletions(-)
diff --git a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/ui/SwaggerUI.java b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/ui/SwaggerUI.java
index 3b6023d..bb2e335 100644
--- a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/ui/SwaggerUI.java
+++ b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/ui/SwaggerUI.java
@@ -311,23 +311,28 @@ public class SwaggerUI extends PojoSwap<Swagger,Div> {
boolean isBody = "body".equals(pi.getIn());
ObjectMap m = new ObjectMap();
- if (isBody) {
- SchemaInfo si = pi.getSchema();
- if (si != null)
- m.put("model", si.copy().resolveRefs(s.swagger, new ArrayDeque<String>(), s.resolveRefsMaxDepth));
- } else {
- ObjectMap om = pi
- .copy()
- .resolveRefs(s.swagger, new ArrayDeque<String>(), s.resolveRefsMaxDepth)
- .asMap()
- .keepAll("format","pattern","collectionFormat","maximum","minimum","multipleOf","maxLength","minLength","maxItems","minItems","allowEmptyValue","exclusiveMaximum","exclusiveMinimum","uniqueItems","items","default","enum");
- m.put("model", om.isEmpty() ? i("none") : om);
- }
- Map<String,?> examples = pi.getExamples();
- if (examples != null)
- for (Map.Entry<String,?> e : examples.entrySet())
- m.put(e.getKey(), e.getValue());
+ try {
+ if (isBody) {
+ SchemaInfo si = pi.getSchema();
+ if (si != null)
+ m.put("model", si.copy().resolveRefs(s.swagger, new ArrayDeque<String>(), s.resolveRefsMaxDepth));
+ } else {
+ ObjectMap om = pi
+ .copy()
+ .resolveRefs(s.swagger, new ArrayDeque<String>(), s.resolveRefsMaxDepth)
+ .asMap()
+ .keepAll("format","pattern","collectionFormat","maximum","minimum","multipleOf","maxLength","minLength","maxItems","minItems","allowEmptyValue","exclusiveMaximum","exclusiveMinimum","uniqueItems","items","default","enum");
+ m.put("model", om.isEmpty() ? i("none") : om);
+ }
+
+ Map<String,?> examples = pi.getExamples();
+ if (examples != null)
+ for (Map.Entry<String,?> e : examples.entrySet())
+ m.put(e.getKey(), e.getValue());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
if (m.isEmpty())
return null;
@@ -339,15 +344,19 @@ public class SwaggerUI extends PojoSwap<Swagger,Div> {
SchemaInfo si = ri.getSchema();
ObjectMap m = new ObjectMap();
- if (si != null) {
- si = si.copy().resolveRefs(s.swagger, new ArrayDeque<String>(), s.resolveRefsMaxDepth);
- m.put("model", si);
- }
+ try {
+ if (si != null) {
+ si = si.copy().resolveRefs(s.swagger, new ArrayDeque<String>(), s.resolveRefsMaxDepth);
+ m.put("model", si);
+ }
- Map<String,?> examples = ri.getExamples();
- if (examples != null)
- for (Map.Entry<String,?> e : examples.entrySet())
- m.put(e.getKey(), e.getValue());
+ Map<String,?> examples = ri.getExamples();
+ if (examples != null)
+ for (Map.Entry<String,?> e : examples.entrySet())
+ m.put(e.getKey(), e.getValue());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
if (m.isEmpty())
return null;