Я написал ниже Resource
Класс:
@clinic_api_ns.route("/patient/profile")
class PatientProfile(Resource):
def get(self):
patient = request.args.get(patient)
relative = request.args.get(relative)
relationType = request.args.get(relationType)
contactNumber = request.args.get(contactNumber)
townCity = request.args.get(townCity)
return controller.get_patient_profile(patient, relative, relationType, contactNumber, townCity)
, чтобы получить профиль пациента, я мог использовать переданные параметры через URL, такие как http://ip.address/api/clinic/patient/profile?patient=<patientName>&relative=<relativeName>&relationType=<relation>
, но это выдает ошибкув документации swagger и даже если я попытался добавить @_api_ns.expect(patient_profile, validate=True)
, где patient_profile
равно
class PatientProfile(object):
profile = clinic_api_ns.model("profile", {
"patient": fields.String(required=True, description="name of the patient."),
"relative": fields.String(required=True, description="name of parent or husband."),
"relation": fields.String(required=True, description="type of relation with patient."),
"contactnumber": fields.String(required=True, description="contact number of the patient."),
"townCity": fields.String(required=True, description="town or city the patient belongs to."),
})