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-958: Upgrade swagger to 2.2.23 #631

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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 @@ -13,11 +13,8 @@
import java.util.List;
import java.util.regex.Pattern;

import io.swagger.models.Model;
import io.swagger.models.ModelImpl;
import org.openmrs.CareSetting;
import org.openmrs.api.context.Context;
import org.openmrs.module.webservices.docs.swagger.core.property.EnumProperty;
import org.openmrs.module.webservices.rest.web.RequestContext;
import org.openmrs.module.webservices.rest.web.RestConstants;
import org.openmrs.module.webservices.rest.web.annotation.Resource;
Expand Down Expand Up @@ -69,18 +66,8 @@ public DelegatingResourceDescription getRepresentationDescription(Representation
public DelegatingResourceDescription getCreatableProperties() {
throw new ResourceDoesNotSupportOperationException();
}

@Override
public Model getGETModel(Representation rep) {
ModelImpl model = (ModelImpl) super.getGETModel(rep);
if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) {
model
.property("careSettingType", new EnumProperty(CareSetting.CareSettingType.class));
}
return model;
}

/**

/**
* @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource#newDelegate()
*/
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@
import org.openmrs.module.webservices.rest.web.response.ResourceDoesNotSupportOperationException;
import org.openmrs.module.webservices.rest.web.response.ResponseException;

import io.swagger.models.Model;
import io.swagger.models.ModelImpl;
import io.swagger.models.properties.RefProperty;
import io.swagger.models.properties.StringProperty;

import org.openmrs.module.webservices.rest.web.RequestContext;
import org.openmrs.module.webservices.rest.web.RestConstants;

Expand Down Expand Up @@ -117,27 +112,5 @@ public DelegatingResourceDescription getCreatableProperties() {
description.addProperty("drug");
return description;
}

public Model getGETModel(Representation rep) {
ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep);
if (rep instanceof DefaultRepresentation) {
modelImpl.property("display", new StringProperty()).property("uuid", new StringProperty())
.property("drug", new RefProperty("#/definitions/DrugGetRef"))
.property("conceptReferenceTerm", new RefProperty("#/definitions/ConceptreferencetermGetRef"))
.property("conceptMapType", new RefProperty("#/definitions/ConceptmaptypeGetRef"));
} else if (rep instanceof FullRepresentation) {
modelImpl.property("display", new StringProperty()).property("uuid", new StringProperty())
.property("auditInfo", new StringProperty()).property("drug", new RefProperty("#/definitions/DrugGet"))
.property("conceptReferenceTerm", new RefProperty("#/definitions/ConceptreferencetermGet"))
.property("conceptMapType", new RefProperty("#/definitions/ConceptmaptypeGet"));
}
return modelImpl;
}

@Override
public Model getCREATEModel(Representation rep) {
return new ModelImpl().property("conceptReferenceTerm", new StringProperty().example("uuid"))
.property("conceptMapType", new StringProperty().example("uuid"))
.property("drug", new StringProperty().example("uuid"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription;
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8.DrugResource1_8;

import io.swagger.models.Model;
import io.swagger.models.ModelImpl;
import io.swagger.models.properties.RefProperty;

/**
* {@link org.openmrs.module.webservices.rest.web.annotation.Resource} for {@link org.openmrs.Drug},
* supporting standard CRUD operations
Expand Down Expand Up @@ -59,22 +55,5 @@ public DelegatingResourceDescription getCreatableProperties() {

return description;
}

public Model getGETModel(Representation rep) {
ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep);
if (rep instanceof DefaultRepresentation) {
modelImpl
.property("drugReferenceMaps", new RefProperty("#/definitions/DrugreferencemapGetRef"));
} else if (rep instanceof FullRepresentation) {
modelImpl
.property("drugReferenceMaps", new RefProperty("#/definitions/DrugreferencemapGet"));
}
return modelImpl;
}

@Override
public Model getCREATEModel(Representation rep) {
return new ModelImpl()
.property("drugReferenceMaps", new RefProperty("#/definitions/DrugreferencemapCreate"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,12 @@
*/
package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_10;

import io.swagger.models.Model;
import io.swagger.models.ModelImpl;
import io.swagger.models.properties.DateProperty;
import io.swagger.models.properties.RefProperty;
import io.swagger.models.properties.StringProperty;
import org.apache.commons.lang.StringUtils;
import org.openmrs.CareSetting;
import org.openmrs.Order;
import org.openmrs.OrderType;
import org.openmrs.Patient;
import org.openmrs.api.context.Context;
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;
Expand All @@ -31,7 +25,6 @@
import org.openmrs.module.webservices.rest.web.representation.Representation;
import org.openmrs.module.webservices.rest.web.resource.api.PageableResult;
import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription;
import org.openmrs.module.webservices.rest.web.resource.impl.EmptySearchResult;
import org.openmrs.module.webservices.rest.web.resource.impl.NeedsPaging;
import org.openmrs.module.webservices.rest.web.response.InvalidSearchException;
import org.openmrs.module.webservices.rest.web.response.ObjectNotFoundException;
Expand Down Expand Up @@ -114,45 +107,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation
return null;
}
}

@Override
public Model getCREATEModel(Representation rep) {
ModelImpl model = new ModelImpl()
.property("encounter", new StringProperty().example("uuid"))
.property("orderType", new StringProperty().example("uuid"))
.property("action", new EnumProperty(Order.Action.class))
.property("accessionNumber", new StringProperty())
.property("dateActivated", new DateProperty())
.property("scheduledDate", new DateProperty())
.property("patient", new StringProperty().example("uuid"))
.property("concept", new StringProperty().example("uuid"))
.property("careSetting", new StringProperty().example("uuid"))
.property("dateStopped", new DateProperty())
.property("autoExpireDate", new DateProperty())
.property("orderer", new StringProperty().example("uuid"))
.property("previousOrder", new StringProperty().example("uuid"))
.property("urgency", new EnumProperty(Order.Urgency.class))
.property("orderReason", new StringProperty().example("uuid"))
.property("orderReasonNonCoded", new StringProperty())
.property("instructions", new StringProperty())
.property("commentToFulfiller", new StringProperty())

.required("orderType").required("patient").required("concept");
if (rep instanceof FullRepresentation) {
model
.property("encounter", new RefProperty("#/definitions/EncounterCreate"))
.property("patient", new RefProperty("#/definitions/PatientCreate"))
.property("concept", new RefProperty("#/definitions/ConceptCreate"))
.property("orderer", new RefProperty("#/definitions/UserCreate"))
.property("previousOrder", new RefProperty("#/definitions/OrderCreate"))
.property("orderReason", new RefProperty("#/definitions/ConceptCreate"))
.property("orderReasonNonCoded", new StringProperty())
.property("instructions", new StringProperty())
.property("commentToFulfiller", new StringProperty());
}
return model;
}


/**
* @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties()
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
import java.util.List;
import java.util.regex.Pattern;

import io.swagger.models.Model;
import io.swagger.models.ModelImpl;
import io.swagger.models.properties.ArrayProperty;
import io.swagger.models.properties.RefProperty;
import io.swagger.models.properties.StringProperty;
import org.openmrs.OrderType;
import org.openmrs.api.context.Context;
import org.openmrs.module.webservices.rest.web.RequestContext;
Expand Down Expand Up @@ -151,33 +146,5 @@ public DelegatingResourceDescription getCreatableProperties() {
d.addProperty("conceptClasses");
return d;
}

@Override
public Model getGETModel(Representation rep) {
ModelImpl model = (ModelImpl) super.getGETModel(rep);
if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) {
model
.property("javaClassName", new StringProperty());
}
if (rep instanceof DefaultRepresentation) {
model
.property("conceptClasses", new ArrayProperty(new RefProperty("#/definitions/ConceptclassGetRef")))
.property("parent", new RefProperty("#/definitions/OrdertypeGetRef"));
} else if (rep instanceof FullRepresentation) {
model
.property("conceptClasses", new ArrayProperty(new RefProperty("#/definitions/ConceptclassGet")))
.property("parent", new RefProperty("#/definitions/OrdertypeGet"));
}
return model;
}

@Override
public Model getCREATEModel(Representation rep) {
return ((ModelImpl) super.getCREATEModel(rep))
.property("javaClassName", new StringProperty())
.property("parent", new StringProperty().example("uuid")) //FIXME type
.property("conceptClasses", new ArrayProperty(new StringProperty().example("uuid")))

.required("javaClassName");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_10;

import io.swagger.models.Model;
import io.swagger.v3.oas.models.media.Schema;
import org.openmrs.Person;
import org.openmrs.module.webservices.rest.web.RestConstants;
import org.openmrs.module.webservices.rest.web.annotation.Resource;
Expand Down Expand Up @@ -59,23 +59,8 @@ public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoe
description.addProperty("birthtime");
return description;
}
@Override
public Model getGETModel(Representation rep) {
return addNewProperties(super.getGETModel(rep), rep);
}

@Override
public Model getCREATEModel(Representation rep) {
return addNewProperties(super.getCREATEModel(rep), rep);
}

@Override
public Model getUPDATEModel(Representation rep) {
return addNewProperties(super.getUPDATEModel(rep), rep);
}

private Model addNewProperties(Model model, Representation rep) {


private Schema<?> addNewProperties(Schema<?> model, Representation rep) {
return model;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@
*/
package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_10;

import io.swagger.models.Model;
import io.swagger.models.ModelImpl;
import io.swagger.models.properties.ArrayProperty;
import io.swagger.models.properties.BooleanProperty;
import io.swagger.models.properties.DateProperty;
import io.swagger.models.properties.RefProperty;
import org.openmrs.PatientProgram;
import org.openmrs.PatientState;
import org.openmrs.api.context.Context;
Expand Down Expand Up @@ -98,28 +92,7 @@ public DelegatingResourceDescription getCreatableProperties() {
d.addProperty("voided");
return d;
}

@Override
public Model getCREATEModel(Representation rep) {
return ((ModelImpl) super.getCREATEModel(rep))
.property("states", new ArrayProperty(new RefProperty("#/definitions/ProgramenrollmentStateCreate")))
.property("outcome", new RefProperty("#/definitions/ConceptCreate"));
}

@Override
public Model getUPDATEModel(Representation rep) {
return new ModelImpl() //FIXME use super.
.property("dateEnrolled", new DateProperty())
.property("states", new ArrayProperty(new RefProperty("#/definitions/ProgramenrollmentStateCreate")))
.property("outcome", new RefProperty("#/definitions/ConceptCreate"))
.property("location", new RefProperty("#/definitions/LocationCreate"))
.property("voided", new BooleanProperty())
.property("dateCompleted", new DateProperty())

.required("dateEnrolled");

}


@Override
public DelegatingResourceDescription getUpdatableProperties() {
DelegatingResourceDescription d = new DelegatingResourceDescription();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
*/
package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_10;

import io.swagger.models.Model;
import io.swagger.models.ModelImpl;
import io.swagger.models.properties.RefProperty;
import io.swagger.models.properties.StringProperty;
import org.openmrs.Program;
import org.openmrs.module.webservices.rest.web.RestConstants;
import org.openmrs.module.webservices.rest.web.annotation.Resource;
Expand Down Expand Up @@ -63,18 +59,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation
}
return null;
}

@Override
public Model getCREATEModel(Representation rep) {
ModelImpl model = ((ModelImpl) super.getCREATEModel(rep))
.property("outcomesConcept", new StringProperty().example("uuid"));
if (rep instanceof FullRepresentation) {
model
.property("outcomesConcept", new RefProperty("#/definitions/ConceptCreate"));
}
return model;
}


@Override
public DelegatingResourceDescription getCreatableProperties() {
DelegatingResourceDescription description = new DelegatingResourceDescription();
Expand All @@ -86,5 +71,4 @@ public DelegatingResourceDescription getCreatableProperties() {
description.addProperty("retired");
return description;
}

}
Loading
Loading