diff --git a/omod/pom.xml b/omod/pom.xml index 9f40234..5161da0 100644 --- a/omod/pom.xml +++ b/omod/pom.xml @@ -94,6 +94,28 @@ ${webservices.restVersion} provided test-jar + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + diff --git a/omod/src/main/java/org/openmrs/module/attachments/rest/AttachmentResource.java b/omod/src/main/java/org/openmrs/module/attachments/rest/AttachmentResource.java index da3f9f1..1d119c1 100644 --- a/omod/src/main/java/org/openmrs/module/attachments/rest/AttachmentResource.java +++ b/omod/src/main/java/org/openmrs/module/attachments/rest/AttachmentResource.java @@ -10,10 +10,11 @@ import java.util.Arrays; import java.util.List; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.DateProperty; -import io.swagger.models.properties.StringProperty; +import io.swagger.v3.oas.models.media.DateTimeSchema; +import io.swagger.v3.oas.models.media.ObjectSchema; +import io.swagger.v3.oas.models.media.Schema; +import io.swagger.v3.oas.models.media.StringSchema; +import io.swagger.v3.oas.models.media.UUIDSchema; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; @@ -31,7 +32,6 @@ import org.openmrs.module.attachments.ComplexObsSaver; import org.openmrs.module.attachments.obs.Attachment; import org.openmrs.module.attachments.obs.ValueComplex; -import org.openmrs.module.webservices.docs.swagger.core.property.EnumProperty; import org.openmrs.module.webservices.rest.web.ConversionUtil; import org.openmrs.module.webservices.rest.web.RequestContext; import org.openmrs.module.webservices.rest.web.RestConstants; @@ -191,17 +191,18 @@ public DelegatingResourceDescription getCreatableProperties() { } @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl().property("comment", new StringProperty()).property("dateTime", new DateProperty()) - .property("filename", new StringProperty()).property("bytesMimeType", new StringProperty()) - - .property("bytesContentFamily", new EnumProperty(AttachmentsConstants.ContentFamily.class)) - .property("complexData", new StringProperty(StringProperty.Format.URI)); + public Schema getCREATESchema(Representation rep) { + return new ObjectSchema().addProperty("comment", new StringSchema()).addProperty("dateTime", new DateTimeSchema()) + .addProperty("filename", new StringSchema()).addProperty("bytesMimeType", new StringSchema()) + .addProperty("bytesContentFamily", + new Schema() + ._enum(Arrays.asList(AttachmentsConstants.ContentFamily.values()))) + .addProperty("complexData", new Schema().format("uri")); } @Override - public Model getUPDATEModel(Representation rep) { - return getCREATEModel(rep); + public Schema getUPDATESchema(Representation rep) { + return getCREATESchema(rep); } @Override @@ -218,12 +219,13 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - return model.property("uuid", new StringProperty()).property("dateTime", new DateProperty()) - .property("filename", new StringProperty()).property("comment", new StringProperty()) - .property("bytesMimeType", new StringProperty()) - .property("bytesContentFamily", new EnumProperty(AttachmentsConstants.ContentFamily.class)); + public Schema getGETSchema(Representation rep) { + Schema model = super.getGETSchema(rep); + return model.addProperty("uuid", new UUIDSchema()).addProperty("dateTime", new DateTimeSchema()) + .addProperty("filename", new StringSchema()).addProperty("comment", new StringSchema()) + .addProperty("bytesMimeType", new StringSchema()) + .addProperty("bytesContentFamily", new Schema() + ._enum(Arrays.asList(AttachmentsConstants.ContentFamily.values()))); } /** diff --git a/pom.xml b/pom.xml index 06d5c19..2db21c0 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,7 @@ 2.2.0 - 2.33.0 + 2.46.0-SNAPSHOT 0.2.8 3.0.1 UTF-8