json_schema.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:fleaker 作者: croscon 项目源码 文件源码
def generate_json_schema(cls, schema, context=DEFAULT_DICT):
        """Generate a JSON Schema from a Marshmallow schema.

        Args:
            schema (marshmallow.Schema|str): The Marshmallow schema, or the
                Python path to one, to create the JSON schema for.

        Keyword Args:
            file_pointer (file, optional): The path or pointer to the file
                to write this schema to. If not provided, the schema will be
                dumped to ``sys.stdout``.

        Returns:
            dict: The JSON schema in dictionary form.
        """
        schema = cls._get_schema(schema)

        # Generate the JSON Schema
        return cls(context=context).dump(schema).data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号