Here’s precisely what the above rule has been doing:
Outlines 1 – 9 significance some Flask segments to create others API responses, along with importing the db case from the config.py module. Furthermore, it imports the SQLAlchemy people and Marshmallow PersonSchema sessions to gain access to the person database dining table and serialize the outcomes.
Line 11 begins this is of read_all() that reacts into the RELAX API Address endpoint attain /api/people and return all reports from inside the people databases table sorted in ascending purchase by latest identity.
Traces 19 – 22 inform SQLAlchemy to question the individual databases desk for the documents, kind them in rising purchase (the standard sorting purchase), and come back a summary of individual Python objects just like the varying group .
Range 24 is how the Marshmallow PersonSchema course description gets valuable. You produce an example associated with PersonSchema , passing they the factor many=True . This tells PersonSchema you may anticipate an interable to serialize, that’s precisely what the individuals variable was.
Line 25 utilizes the PersonSchema case changeable ( person_schema ), contacting its dump() way with all the folks checklist. Continue reading “To help that apply these modifications, the swagger.yml file from role 1 will have to be modified”