Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RESTWS-957: Fix Swagger errors displayed on the openmrs swagger api docs page #67

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,6 @@ public static enum ContentFamily {
* PRIVILEGES
*/
public static final String CREATE_ATTACHMENTS = "Create Attachments";

public static final String VIEW_ATTACHMENTS = "View Attachments";
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
import java.util.Arrays;
import java.util.List;

import io.swagger.models.Model;
import io.swagger.models.ModelImpl;
import io.swagger.models.properties.ByteArrayProperty;
import io.swagger.models.properties.DateProperty;
import io.swagger.models.properties.StringProperty;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.BooleanUtils;
Expand Down Expand Up @@ -181,6 +186,16 @@ public DelegatingResourceDescription getCreatableProperties() {
return description;
}

@Override
public Model getCREATEModel(Representation rep) {
return new ModelImpl().property("comment", new StringProperty());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we support more fields than just this, no?

}

@Override
public Model getUPDATEModel(Representation rep) {
return getCREATEModel(rep);
}

@Override
public DelegatingResourceDescription getRepresentationDescription(Representation rep) {
DelegatingResourceDescription description = new DelegatingResourceDescription();
Expand All @@ -194,6 +209,14 @@ public DelegatingResourceDescription getRepresentationDescription(Representation
return description;
}

@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 ByteArrayProperty()).property("bytesContentFamily", new ByteArrayProperty());
}

/**
* Voids the encounter if it contains no non-voided obs.
*
Expand Down
Loading