public String getString(String key, ObjectNode node, boolean required, String location, ParseResult result) { return getString(key, node, required, location, result, null); }
private String parameterDefault(ObjectNode node, String type, String location, ParseResult result) { String key = "default"; if (type != null && type.equals("array")) { ArrayNode array = getArray(key, node, false, location, result); return array != null ? array.toString() : null; } return getString(key, node, false, location, result); }
public Contact contact(ObjectNode node, String location, ParseResult result) { if(node == null) return null; Contact contact = new Contact(); String value = getString("name", node, false, location + ".name", result); contact.name(value); value = getString("url", node, false, location + ".url", result); contact.url(value); value = getString("email", node, false, location + ".email", result); contact.email(value); // extra keys Set<String> keys = getKeys(node); for(String key : keys) { if(!CONTACT_KEYS.contains(key)) { result.extra(location + ".contact", key, node.get(key)); } } return contact; }
public License license(ObjectNode node, String location, ParseResult result) { if(node == null) return null; License license = new License(); String value = getString("name", node, true, location, result); license.name(value); value = getString("url", node, false, location, result); license.url(value); // extra keys Set<String> keys = getKeys(node); for(String key : keys) { if(key.startsWith("x-")) { license.setVendorExtension(key, extension(node.get(key))); } else if(!LICENSE_KEYS.contains(key)) { result.extra(location + ".license", key, node.get(key)); } } return license; }
public ExternalDocs externalDocs(ObjectNode node, String location, ParseResult result) { ExternalDocs output = null; if(node != null) { output = new ExternalDocs(); Set<String> keys = getKeys(node); String value = getString("description", node, false, location, result); output.description(value); value = getString("url", node, true, location, result); output.url(value); // extra keys for(String key : keys) { if(key.startsWith("x-")) { output.setVendorExtension(key, extension(node.get(key))); } else if(!EXTERNAL_DOCS_KEYS.contains(key)) { result.extra(location + ".externalDocs", key, node.get(key)); } } } return output; }
String type = getString("type", node, true, location, result); if(type != null) { if(type.equals("basic")) { String position = getString("in", node, true, location, result); String name = getString("name", node, true, location, result); .name(name) .in(in); String description = getString("description", node, false, location, result); output.setDescription(description);
public Tag tag(ObjectNode node, String location, ParseResult result) { Tag tag = null; if(node != null) { tag = new Tag(); Set<String> keys = getKeys(node); String value = getString("name", node, true, location, result); tag.name(value); value = getString("description", node, false, location, result); tag.description(value); ObjectNode externalDocs = getObject("externalDocs", node, false, location, result); ExternalDocs docs = externalDocs(externalDocs, location + "externalDocs", result); tag.externalDocs(docs); // extra keys for(String key : keys) { if(key.startsWith("x-")) { tag.setVendorExtension(key, extension(node.get(key))); } else if(!TAG_KEYS.contains(key)) { result.extra(location + ".externalDocs", key, node.get(key)); } } } return tag; }
public Info info(ObjectNode node, String location, ParseResult result) { if(node == null) return null; Info info = new Info(); String value = getString("title", node, true, location, result); info.title(value); value = getString("description", node, false, location, result); info.description(value); value = getString("termsOfService", node, false, location, result); info.termsOfService(value); ObjectNode obj = getObject("contact", node, false, "contact", result); Contact contact = contact(obj, location, result); info.contact(contact); obj = getObject("license", node, false, location, result); License license = license(obj, location, result); info.license(license); value = getString("version", node, false, location, result); info.version(value); // extra keys Set<String> keys = getKeys(node); for(String key : keys) { if(key.startsWith("x-")) { info.setVendorExtension(key, extension(node.get(key))); } else if(!INFO_KEYS.contains(key)) { result.extra(location, key, node.get(key)); } } return info; }
output.tags(tags); String value = getString("summary", obj, false, location, result); output.summary(value); value = getString("description", obj, false, location, result); output.description(value); value = getString("operationId", obj, false, location, result, operationIDs); output.operationId(value); while (it.hasNext()) { JsonNode n = it.next(); String s = getString(n, location + ".consumes", result); if (s != null) { output.consumes(s); while (it.hasNext()) { JsonNode n = it.next(); String s = getString(n, location + ".produces", result); if (s != null) { output.produces(s); while (it.hasNext()) { JsonNode n = it.next(); String s = getString(n, location + ".schemes", result); if (s != null) { Scheme scheme = Scheme.forValue(s);
String value = getString("in", obj, true, location, result); if(value != null) { String type = getString("type", obj, false, location, result); String format = getString("format", obj, false, location, result); AbstractSerializableParameter<?> sp = null; String paramType = getString("type", obj, true, location, result); Map<PropertyBuilder.PropertyId, Object> map = new LinkedHashMap<PropertyBuilder.PropertyId, Object>(); sp.setMinLength(minLength); String pat = getString("pattern", obj, false, location, result); map.put(PATTERN, pat); sp.setPattern(pat); String collectionFormat = getString("collectionFormat", obj, false, location, result); sp.setCollectionFormat(collectionFormat); String pat = getString("pattern", obj, false, location, result); if(pat != null) { bp.setPattern(pat); value = getString("name", obj, true, location, result); output.setName(value); value = getString("description", obj, false, location, result); output.setDescription(value);
String value = getString("description", node, true, location, result); output.description(value);
String value = getString("swagger", on, true, location, result); swagger.setSwagger(value); value = getString("host", on, false, location, result); swagger.setHost(value); value = getString("basePath", on, false, location, result); swagger.setBasePath(value); while (it.hasNext()) { JsonNode n = it.next(); String s = getString(n, location + ".schemes", result); if (s != null) { Scheme scheme = Scheme.forValue(s); while (it.hasNext()) { JsonNode n = it.next(); String s = getString(n, location + ".consumes", result); if (s != null) { swagger.consumes(s); while (it.hasNext()) { JsonNode n = it.next(); String s = getString(n, location + ".produces", result); if (s != null) { swagger.produces(s);
String value = null; String type = getString("type", node, false, location, result); Model m = new ModelImpl(); if("array".equals(type)) { value = getString("default", node, false, location, result); impl.setDefaultValue(value); value = getString("format", node, false, location, result); impl.setFormat(value); value = getString("discriminator", node, false, location, result); impl.setDiscriminator(value); value = getString("pattern", node, false, location, result); impl.setPattern(value); value = getString("description", node, false, location, result); model.setDescription(value); value = getString("title", node, false, location, result); model.setTitle(value);