@Override public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException { RefProperty refProperty = (RefProperty) object; Map<String, String> json = new HashMap<String, String>(2); if (refProperty.getType().equalsIgnoreCase(RefProperty.TYPE)) { json.put(DOLLAR + RefProperty.TYPE, refProperty.get$ref()); } serializer.write(json); } }
private Property resolveProperty(Property property) { if(property instanceof RefProperty ){ String ref= ((RefProperty)property).get$ref(); ref = ref.substring(ref.lastIndexOf("/") + 1); Model resolved = schemas.get(ref);
private Property resolveProperty(Property property) { if(property instanceof RefProperty ){ String ref= ((RefProperty)property).get$ref(); ref = ref.substring(ref.lastIndexOf("/") + 1); Model resolved = schemas.get(ref);
if (ref.get$ref().indexOf("#/definitions") == 0) { String updatedRef = "#/components/schemas" + ref.get$ref().substring("#/definitions".length()); ref.set$ref(updatedRef); result.set$ref(ref.get$ref()); } else if (schema instanceof ArrayProperty) { ArraySchema arraySchema = Json.mapper().convertValue(schema, ArraySchema.class);
if (ref.get$ref().indexOf("#/definitions") == 0) { String updatedRef = "#/components/schemas" + ref.get$ref().substring("#/definitions".length()); ref.set$ref(updatedRef); result.set$ref(ref.get$ref()); } else if (schema instanceof ArrayProperty) { ArraySchema arraySchema = Json.mapper().convertValue(schema, ArraySchema.class);
if (ref.get$ref().indexOf("#/definitions") == 0) { String updatedRef = "#/components/schemas" + ref.get$ref().substring("#/definitions".length()); ref.set$ref(updatedRef); result.set$ref(ref.get$ref()); } else if (schema instanceof ArrayProperty) { ArraySchema arraySchema = Json.mapper().convertValue(schema, ArraySchema.class);
if(((RefProperty)(arrayModel.getItems())).get$ref() != null) { arrayModel.setItems(resolveProperty(arrayModel.getItems())); } else {
if(((RefProperty)(arrayModel.getItems())).get$ref() != null) { arrayModel.setItems(resolveProperty(arrayModel.getItems())); } else {
protected Object _safeResolve(final RefProperty ref) { return this.safeResolve(ref, ref.get$ref(), RefType.DEFINITION, ref.getSimpleRef(), ref.getRefFormat()); }
private void processRefProperty(RefProperty subRef, String externalFile) { if (isAnExternalRefFormat(subRef.getRefFormat())) { String joinedRef = join(externalFile, subRef.get$ref()); String processRef = processRefToExternalDefinition(joinedRef, subRef.getRefFormat()); if(processRef.startsWith("http") || processRef.startsWith("https:")) { subRef.set$ref(processRef); }else { subRef.set$ref(RefType.DEFINITION.getInternalPrefix()+processRef); } } else { String processRef = processRefToExternalDefinition(externalFile + subRef.get$ref(), RefFormat.RELATIVE); subRef.set$ref(RefType.DEFINITION.getInternalPrefix()+processRef); } }
protected Object _resolve(final RefProperty ref) { return this.resolve(ref.get$ref(), RefType.DEFINITION, ref.getSimpleRef(), ref.getRefFormat()); }
public static String determineSchemaReference(final Property schema) { if (schema instanceof RefProperty) { return ((RefProperty) schema).get$ref(); } else if (schema instanceof ArrayProperty) { final Property property = ((ArrayProperty) schema).getItems(); return determineSchemaReference(property); } throw new IllegalArgumentException("Only references to schemas are supported"); }
public static String determineSchemaReference(final Property schema) { if (schema instanceof RefProperty) { return ((RefProperty) schema).get$ref(); } else if (schema instanceof ArrayProperty) { final Property property = ((ArrayProperty) schema).getItems(); return determineSchemaReference(property); } throw new IllegalArgumentException("Only references to schemas are supported"); }
protected void updateLocalRefs(Property property, String pathRef) { if(property instanceof RefProperty) { RefProperty ref = (RefProperty) property; if(isLocalRef(ref.get$ref())) { ref.set$ref(computeLocalRef(ref.get$ref(), pathRef)); }/*else if(isLocalRef(ref.getOriginalRef())) { ref.set$ref(computeLocalRef(ref.getOriginalRef(), pathRef)); }*/ } }
private void processRefProperty(RefProperty refProperty) { // TODO: if the parent document is remote, then this will be remote by definition. if (isAnExternalRefFormat(refProperty.getRefFormat())) { final String newRef = externalRefProcessor.processRefToExternalDefinition(refProperty.get$ref(), refProperty.getRefFormat()); if (newRef != null) { refProperty.set$ref(RefType.DEFINITION.getInternalPrefix()+newRef); } } }
protected <T> void updateLocalRefs(String file, Property schema) { if(schema instanceof RefProperty) { RefProperty ref = (RefProperty) schema; String updatedLocation = merge(file, ref.get$ref()); ref.set$ref(updatedLocation); } }
public static String determineSchemaReference(final Property schema) { if (schema instanceof RefProperty) { return ((RefProperty) schema).get$ref(); } else if (schema instanceof ArrayProperty) { final Property property = ((ArrayProperty) schema).getItems(); return determineSchemaReference(property); } throw new IllegalArgumentException("Only references to schemas are supported"); }
public static String determineSchemaReference(final Property schema) { if (schema instanceof RefProperty) { return ((RefProperty) schema).get$ref(); } else if (schema instanceof ArrayProperty) { final Property property = ((ArrayProperty) schema).getItems(); return determineSchemaReference(property); } throw new IllegalArgumentException("Only references to schemas are supported"); }
private void processDiscriminatorAsRefProperty(RefProperty subRef, String externalFile) { if (isAnExternalRefFormat(subRef.getRefFormat())) { String joinedRef = join(externalFile, subRef.get$ref()); subRef.set$ref(processRefToExternalDefinition(joinedRef, subRef.getRefFormat())); } else { String processRef = processRefToExternalDefinition(externalFile + subRef.get$ref(), RefFormat.RELATIVE); subRef.set$ref(RefType.DEFINITION.getInternalPrefix()+processRef); } }