提供普通标量的鞑靼花插件

tartiflette-plugin-scalars的Python项目详细描述


Tartiflete插件标量

提供通用标量的Tartiflette插件,用于数据验证和强类型API模式。在

要求

Python>;=3.6 酒石粉>;=1.0.0

安装

只需使用pip安装:

pip install tartiflette-plugin-scalars

然后开始编码,通过导入将其添加到tartiflette的create engine的modules列表中:

^{pr2}$

配置

您可以通过在create_engine期间传递配置dict来配置插件。 此配置可用于禁用或重命名某些标量,如下所示:

engine = await create_engine(
    sdl=sdl,
    modules=[
        {
            "name": "tartiflette_plugin_scalars",
            "config": {
                "datetime": {"name": "MyDatetime"},
                "postal_code": {"enabled": False},
            },
        }
    ],
    schema_name="scalars",
)

一些插件还接受更具体的配置值,可以是 在名为options的子字典中指定。选择是 在实例化时作为**kwargs传递给init()方法的标量。在

engine = await create_engine(
    sdl=sdl,
    modules=[
        {
            "name": "tartiflette_plugin_scalars",
            "config": {
                "datetime": {"name": "MyDatetime"},
                "postal_code": {"enabled": False, "options": {"key": "value"}},
            },
        }
    ],
    schema_name="scalars",
)

实现标量:

NameConfiguration keyDescription
EmailAddressemail_addressRepresents an email addresses
DateTimedatetimeRepresents a non naive datetime object
NaiveDateTimenaive_datetimeRepresents an optionally naive datetime object
DurationdurationRepresents a timedelta object
NegativeFloatnegative_floatRepresents a negative floating point number
NegativeIntnegative_intRepresents a negative integer
NonNegativeFloatnon_negative_floatRepresents a positive or 0 floating point number
NonNegativeIntnon_negative_intRepresents a positive or 0 integer
PositiveFloatpositive_floatRepresents a positive floating point number
PositiveIntpositive_intRepresents a positive integer
NonPositiveFloatnon_positive_floatRepresents a negative or 0 floating point number
NonPositiveIntnon_positive_intRepresents a negative or 0 integer
LonglongRepresents integers between 0 and 2^63
BigIntbig_intRepresents arbitrary length integers
UnsignedIntunsigned_intRepresents integers between 0 and 2^32
PhoneNumberphone_numberRepresents a phone number
PostalCodepostal_codeRepresents a postal code
URLurlRepresents an Uniform Resource Locator
GUIDguidRepresents a Globally Unique IDentifier
UUIDuuidRepresents a Universally Unique IDentifier
HexColorCodehex_color_codeHexadecimal representation of a color
HSLhslHue, Saturation and Lightness of a color
HSLAhslaHue, Saturation, Lightness and Alpha of a color
RGBrgbRed, Green, Blue of a color
RGBArgbaRed, Green, Blue and Alpha of a color
IPv4ipv4Represents an Internet Protocol version 4 address
IPv6ipv6Represents an Internet Protocol version 6 address
MACmacRepresents a Media Access Control address
ISBNisbnRepresents an International Standard Book Number
PortportRepresents a TCP / UDP port
USCurrencyus_currencyRepresents an amount of USD
JSONjsonRepresents a JSON value
JSONObjectjson_objectRepresents a JSON object
GeoJSONgeo_jsonRepresents a GeoJSON value

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
未安装java Android应用程序   编译运行java程序错误“线程中异常”main“java.lang.NoClassDefFoundError:驱动程序”   java通过Azure Devops管道中的Appcenter任务执行Appium测试用例   java文本视图的值被切换   java tinylog2不创建日志文件   如何在Java中连接字符串?   java如何将imageView放置在另一个imageView的屏幕上,无论屏幕大小或纵横比如何,都始终位于同一位置?   java有一种方法可以根据另一个字符串列表过滤出包含字符串元素的对象列表中的元素   Java优先级队列和可比接口   java如何在安卓中以编程方式添加或删除意图过滤器?   块Blob的java Azure存储服务REST API:内容长度问题   java既没有BindingResult,也没有bean名称“matrix[0][0]”的普通目标对象可用作请求属性   同步方法中的java线程锁定   JavaSpringAOP不使用MVC结构