1010import java .util .Arrays ;
1111import java .util .List ;
1212
13- import io .swagger .models .Model ;
14- import io .swagger .models .ModelImpl ;
15- import io .swagger .models .properties .DateProperty ;
16- import io .swagger .models .properties .StringProperty ;
13+ import io .swagger .v3 .oas .models .media .DateTimeSchema ;
14+ import io .swagger .v3 .oas .models .media .ObjectSchema ;
15+ import io .swagger .v3 .oas .models .media .Schema ;
16+ import io .swagger .v3 .oas .models .media .StringSchema ;
17+ import io .swagger .v3 .oas .models .media .UUIDSchema ;
1718import org .apache .commons .codec .binary .Base64 ;
1819import org .apache .commons .lang3 .BooleanUtils ;
1920import org .apache .commons .lang3 .StringUtils ;
3132import org .openmrs .module .attachments .ComplexObsSaver ;
3233import org .openmrs .module .attachments .obs .Attachment ;
3334import org .openmrs .module .attachments .obs .ValueComplex ;
34- import org .openmrs .module .webservices .docs .swagger .core .property .EnumProperty ;
3535import org .openmrs .module .webservices .rest .web .ConversionUtil ;
3636import org .openmrs .module .webservices .rest .web .RequestContext ;
3737import org .openmrs .module .webservices .rest .web .RestConstants ;
@@ -191,17 +191,18 @@ public DelegatingResourceDescription getCreatableProperties() {
191191 }
192192
193193 @ Override
194- public Model getCREATEModel (Representation rep ) {
195- return new ModelImpl ().property ("comment" , new StringProperty ()).property ("dateTime" , new DateProperty ())
196- .property ("filename" , new StringProperty ()).property ("bytesMimeType" , new StringProperty ())
197-
198- .property ("bytesContentFamily" , new EnumProperty (AttachmentsConstants .ContentFamily .class ))
199- .property ("complexData" , new StringProperty (StringProperty .Format .URI ));
194+ public Schema <?> getCREATESchema (Representation rep ) {
195+ return new ObjectSchema ().addProperty ("comment" , new StringSchema ()).addProperty ("dateTime" , new DateTimeSchema ())
196+ .addProperty ("filename" , new StringSchema ()).addProperty ("bytesMimeType" , new StringSchema ())
197+ .addProperty ("bytesContentFamily" ,
198+ new Schema <AttachmentsConstants .ContentFamily >()
199+ ._enum (Arrays .asList (AttachmentsConstants .ContentFamily .values ())))
200+ .addProperty ("complexData" , new Schema <String >().format ("uri" ));
200201 }
201202
202203 @ Override
203- public Model getUPDATEModel (Representation rep ) {
204- return getCREATEModel (rep );
204+ public Schema <?> getUPDATESchema (Representation rep ) {
205+ return getCREATESchema (rep );
205206 }
206207
207208 @ Override
@@ -218,12 +219,13 @@ public DelegatingResourceDescription getRepresentationDescription(Representation
218219 }
219220
220221 @ Override
221- public Model getGETModel (Representation rep ) {
222- ModelImpl model = (ModelImpl ) super .getGETModel (rep );
223- return model .property ("uuid" , new StringProperty ()).property ("dateTime" , new DateProperty ())
224- .property ("filename" , new StringProperty ()).property ("comment" , new StringProperty ())
225- .property ("bytesMimeType" , new StringProperty ())
226- .property ("bytesContentFamily" , new EnumProperty (AttachmentsConstants .ContentFamily .class ));
222+ public Schema <?> getGETSchema (Representation rep ) {
223+ Schema <?> model = super .getGETSchema (rep );
224+ return model .addProperty ("uuid" , new UUIDSchema ()).addProperty ("dateTime" , new DateTimeSchema ())
225+ .addProperty ("filename" , new StringSchema ()).addProperty ("comment" , new StringSchema ())
226+ .addProperty ("bytesMimeType" , new StringSchema ())
227+ .addProperty ("bytesContentFamily" , new Schema <AttachmentsConstants .ContentFamily >()
228+ ._enum (Arrays .asList (AttachmentsConstants .ContentFamily .values ())));
227229 }
228230
229231 /**
0 commit comments