public void localizeObjectsInSection(Content content, ObjectType section) { for (String objectName : content.getObjectNames(section)) { Reference ref = content.getObjectReference(section, objectName); JsonNode obj = content.getObject(section, objectName).get(); localizer.register(ref, obj); } }
private void setTypeNames(Content contentItem, boolean setMissingTitles) { ObjectType section = modelVersion == ObjectType.SWAGGER_MODEL_VERSION ? ObjectType.DEFINITION : modelVersion == ObjectType.OPENAPI3_MODEL_VERSION ? ObjectType.SCHEMA : null; if (section != null) { for (String name : contentItem.getObjectNames(section)) { ObjectNode schema = (ObjectNode) contentItem.getObject(section, name).get(); OpenApiMarkers.markTypeName(schema, name); if (setMissingTitles && !schema.has("title")) { schema.put("title", name); } } } } }
public Optional<JsonNode> getModelObject(Reference ref) { if (ref.isModelObjectRef()) { String urlString = cacheUrl(ref.getUrl()); Content content = contentItems.get(urlString); if (content != null) { return content.getObject(ref.getSection(), ref.getObjectName()); } } return Optional.empty(); }
private void retainObjectsInSection(Content content, ObjectType section) { for (String objectName : content.getObjectNames(section)) { Reference ref = content.getObjectReference(section, objectName); JsonNode obj = content.getObject(section, objectName).get(); localizer.register(ref, obj).retain(); } }