How to use the flasgger.swag_from function in flasgger

To help you get started, we’ve selected a few flasgger examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flasgger / flasgger / examples / validation.py View on Github external
@swag_from("test_validation.yml")
def manualvalidation_bp():
    """
    In this example you need to call validate() manually
    passing received data, Definition (schema: id), specs filename
    """
    data = request.json
    validate(data, 'User', "test_validation.yml")
    return jsonify(data)
github DSM-DMS / DMS-Backend / Server / app / views / v2 / admin / excel / goingout.py View on Github external
    @swag_from(GOINGOUT_EXCEL_DOWNLOAD_GET)
    def get(self):
        """
        외출신청 정보 엑셀 다운로드
        """
        self.generate_excel()

        return self.get_response_object_with_excel_file()
github DSM-DMS / DMS / server / server-flask / app / views / student / account / signup.py View on Github external
    @swag_from(SIGNUP_POST)
    def post(self):
        """
        회원가입
        """
        uuid = request.form['uuid']
        id = request.form['id']
        pw = request.form['pw']

        m = sha256()
        m.update(pw.encode('utf-8'))
        pw = m.hexdigest()

        student = SignupRequiredModel.objects(uuid=uuid).first()
        if student:
            # Valid UUID
            StudentModel(id=id, pw=pw, name=student.name, number=student.number).save()
github lyft / amundsenmetadatalibrary / metadata_service / api / table.py View on Github external
    @swag_from('swagger_doc/common/description_put.yml')
    def put(self, id: str) -> Iterable[Any]:
        """
        Updates table description (passed as a request body)
        :param table_uri:
        :return:
        """
        try:
            description = json.loads(request.data).get('description')
            self.client.put_table_description(table_uri=id, description=description)
            return None, HTTPStatus.OK

        except NotFoundException:
            return {'message': 'table_uri {} does not exist'.format(id)}, HTTPStatus.NOT_FOUND
github DSM-DMS / DMS / server / server-flask / app / views / admin / post / faq.py View on Github external
    @swag_from(FAQ_DELETE)
    @jwt_required
    def delete(self):
        """
        FAQ 제거
        """
        admin = AdminModel.objects(id=get_jwt_identity()).first()
        if not admin:
            return Response('', 403)

        id = request.form.get('id')

        FAQModel.objects(id=id).first().delete()

        return Response('', 200)
github Meteorix / flaskweb / simple / app.py View on Github external
@swag_from("simple_get.yml", methods=["GET"])
@swag_from("simple_post.yml", methods=["POST"])
def post_or_get_example():
    if request.method == "GET":
        get_input = request.args["get_input"]
        get_output = "output of " + get_input
        return jsonify({"get_output": get_output})
    else:
        post_input = request.form["post_input"]
        post_output = "output of " + post_input
        return jsonify({"post_output": post_output})
github DSM-DMS / DMS-Backend / Server / app / views / student / apply / extension.py View on Github external
    @swag_from(EXTENSION_DELETE)
    @jwt_required
    @BaseResource.student_only
    def delete(self):
        """
        11시 연장신청 취소
        """
        student = StudentModel.objects(id=get_jwt_identity()).first()

        student.update(extension_apply_11=None)

        return Response('', 200)
github IKNL / vantage / vantage6_server / vantage6 / server / resource / result.py View on Github external
    @swag_from(str(Path(r"swagger/patch_result_with_id.yaml")), endpoint="result_with_id")
    def patch(self, id):
        """Update a Result."""
        data = request.get_json()
        result = db_Result.get(id)

        if result.organization_id != g.node.organization_id:
            log.info(
                f"{g.node.name} tries to update a result that does not belong "
                f"to him. ({result.organization_id}/{g.node.organization_id})"
            )
            return {"msg": "This is not your result to PATCH!"}, HTTPStatus.UNAUTHORIZED

        if result.finished_at is not None:
            return {"msg": "Cannot update an already finished result!"}, HTTPStatus.BAD_REQUEST
github DSM-DMS / DMS-Backend / Server / app / views / v2 / admin / excel / stay.py View on Github external
    @swag_from(STAY_EXCEL_DOWNLOAD_GET)
    def get(self):
        """
        잔류신청 정보 엑셀 다운로드
        """
        self.generate_excel()

        return self.get_response_object_with_excel_file()
github DSM-DMS / DMS-Backend / Server / app / views / v2 / student / apply / extension.py View on Github external
    @swag_from(EXTENSION_GET)
    @auth_required(StudentModel)
    def get(self):
        """
        학생 12시 연장 신청 정보 조회
        """
        extension = ExtensionApply12Model.objects(student=g.user).first()

        return self.unicode_safe_json_dumps({
            'classNum': extension.class_,
            'seatNum': extension.seat
        }) if extension else Response('', 204)