Make certain that you to apply these modifications, the swagger.yml document from Part 1 should be modified

Make certain that you to apply these modifications, the swagger.yml document from Part 1 should be modified

Here’s precisely what the previous code does:

Traces 1 – 9 transfer some Flask modules to develop majority API reactions, along with importing the db instance from your config.py section. As well, it imports the SQLAlchemy Person and Marshmallow PersonSchema course to access someone data counter and serialize the outcomes.

Series 11 initiate the meaning of read_all() that replies to the others API URL endpoint take /api/people and return all of the it can capture video at the individual database table sorted in ascending order by last name.

Contours 19 – 22 instruct SQLAlchemy to query the person data counter for all you documents, sort these people in ascending order (the traditional sorting order), and return a long list of individual Python objects because adjustable someone .

Range 24 is how the Marshmallow PersonSchema type classification becomes useful. One build an example of PersonSchema , driving it the parameter many=True . This says to PersonSchema to expect an interable to serialize, that is certainly just what the everyone variable is. Continua la lectura de Make certain that you to apply these modifications, the swagger.yml document from Part 1 should be modified