1111import java .util .List ;
1212import java .util .stream .Collectors ;
1313
14- import io .swagger .models .Model ;
15- import io .swagger .models .ModelImpl ;
16- import io .swagger .models .properties .DateProperty ;
17- import io .swagger .models .properties .StringProperty ;
14+ import io .swagger .v3 .oas .models .media .DateTimeSchema ;
15+ import io .swagger .v3 .oas .models .media .ObjectSchema ;
16+ import io .swagger .v3 .oas .models .media .Schema ;
17+ import io .swagger .v3 .oas .models .media .StringSchema ;
18+ import io .swagger .v3 .oas .models .media .UUIDSchema ;
1819import org .apache .commons .codec .binary .Base64 ;
1920import org .apache .commons .collections .CollectionUtils ;
2021import org .apache .commons .lang3 .BooleanUtils ;
3738import org .openmrs .module .attachments .ComplexObsSaver ;
3839import org .openmrs .module .attachments .obs .Attachment ;
3940import org .openmrs .module .attachments .obs .ValueComplex ;
40- import org .openmrs .module .webservices .docs .swagger .core .property .EnumProperty ;
4141import org .openmrs .module .webservices .rest .web .ConversionUtil ;
4242import org .openmrs .module .webservices .rest .web .RequestContext ;
4343import org .openmrs .module .webservices .rest .web .RestConstants ;
@@ -216,17 +216,18 @@ public DelegatingResourceDescription getCreatableProperties() {
216216 }
217217
218218 @ Override
219- public Model getCREATEModel (Representation rep ) {
220- return new ModelImpl ().property ("comment" , new StringProperty ()).property ("dateTime" , new DateProperty ())
221- .property ("filename" , new StringProperty ()).property ("bytesMimeType" , new StringProperty ())
222-
223- .property ("bytesContentFamily" , new EnumProperty (AttachmentsConstants .ContentFamily .class ))
224- .property ("complexData" , new StringProperty (StringProperty .Format .URI ));
219+ public Schema <?> getCREATESchema (Representation rep ) {
220+ return new ObjectSchema ().addProperty ("comment" , new StringSchema ()).addProperty ("dateTime" , new DateTimeSchema ())
221+ .addProperty ("filename" , new StringSchema ()).addProperty ("bytesMimeType" , new StringSchema ())
222+ .addProperty ("bytesContentFamily" ,
223+ new Schema <AttachmentsConstants .ContentFamily >()
224+ ._enum (Arrays .asList (AttachmentsConstants .ContentFamily .values ())))
225+ .addProperty ("complexData" , new Schema <String >().format ("uri" ));
225226 }
226227
227228 @ Override
228- public Model getUPDATEModel (Representation rep ) {
229- return getCREATEModel (rep );
229+ public Schema <?> getUPDATESchema (Representation rep ) {
230+ return getCREATESchema (rep );
230231 }
231232
232233 @ Override
@@ -243,12 +244,13 @@ public DelegatingResourceDescription getRepresentationDescription(Representation
243244 }
244245
245246 @ Override
246- public Model getGETModel (Representation rep ) {
247- ModelImpl model = (ModelImpl ) super .getGETModel (rep );
248- return model .property ("uuid" , new StringProperty ()).property ("dateTime" , new DateProperty ())
249- .property ("filename" , new StringProperty ()).property ("comment" , new StringProperty ())
250- .property ("bytesMimeType" , new StringProperty ())
251- .property ("bytesContentFamily" , new EnumProperty (AttachmentsConstants .ContentFamily .class ));
247+ public Schema <?> getGETSchema (Representation rep ) {
248+ Schema <?> model = super .getGETSchema (rep );
249+ return model .addProperty ("uuid" , new UUIDSchema ()).addProperty ("dateTime" , new DateTimeSchema ())
250+ .addProperty ("filename" , new StringSchema ()).addProperty ("comment" , new StringSchema ())
251+ .addProperty ("bytesMimeType" , new StringSchema ())
252+ .addProperty ("bytesContentFamily" , new Schema <AttachmentsConstants .ContentFamily >()
253+ ._enum (Arrays .asList (AttachmentsConstants .ContentFamily .values ())));
252254 }
253255
254256 /**
0 commit comments