• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python parser.parse_raml函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中ramlfications.parser.parse_raml函数的典型用法代码示例。如果您正苦于以下问题:Python parse_raml函数的具体用法?Python parse_raml怎么用?Python parse_raml使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了parse_raml函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: validate

def validate(raml, config_file=None):
    """
    Module helper function to validate a RAML File.  First loads \
    the RAML file \
    with :py:class:`.loader.RAMLLoader` then validates with \
    :py:func:`.validate.validate_raml`.

    :param str raml: Either string path to the RAML file, a file object, \or
        a string representation of RAML.
    :param str config_file:  String path to desired config file, if any.
    :return: No return value if successful
    :raises LoadRAMLError: If error occurred trying to load the RAML file
        (see :py:class:`.loader.RAMLLoader`)
    :raises InvalidRootNodeError: API metadata is invalid according to RAML \
        `specification <http://raml.org/spec.html>`_.
    :raises InvalidResourceNodeError: API resource endpoint is invalid \
        according to RAML `specification <http://raml.org/spec.html>`_.
    :raises InvalidParameterError: Named parameter is invalid \
        according to RAML `specification <http://raml.org/spec.html>`_.
    :raises InvalidRAMLError: RAML file is invalid according to RAML \
        `specification <http://raml.org/spec.html>`_.
    """
    loader = load(raml)
    config = setup_config(config_file)
    config["validate"] = True
    parse_raml(loader, config)
开发者ID:jenner,项目名称:ramlfications,代码行数:26,代码来源:__init__.py


示例2: test_resource_type_empty_mapping_headers

def test_resource_type_empty_mapping_headers():
    raml_file = os.path.join(EXAMPLES + "empty-mapping.raml")
    loaded_raml_file = load_file(raml_file)
    config = setup_config(EXAMPLES + "test-config.ini")
    config['validate'] = False
    api = pw.parse_raml(loaded_raml_file, config)

    base_res_type = api.resource_types[0]

    assert len(base_res_type.headers) == 3
    assert base_res_type.headers[-1].description is None
开发者ID:AndreasBackx,项目名称:ramlfications,代码行数:11,代码来源:test_parser.py


示例3: test_resource_response_no_desc

def test_resource_response_no_desc():
    raml_file = os.path.join(EXAMPLES + "empty-mapping.raml")
    loaded_raml_file = load_file(raml_file)
    config = setup_config(EXAMPLES + "test-config.ini")
    config['validate'] = False
    api = pw.parse_raml(loaded_raml_file, config)

    res = api.resources[-1]
    response = res.responses[-1]

    assert response.code == 204
    assert response.description is None
开发者ID:AndreasBackx,项目名称:ramlfications,代码行数:12,代码来源:test_parser.py


示例4: validate

def validate(raml, config_file=None):
    """
    Module helper function to validate a RAML File.  First loads \
    the RAML file \
    with :py:class:`.loader.RAMLLoader` then validates with \
    :py:func:`.validate.validate_raml`.

    :param str raml: Either string path to the RAML file, a file object, \or
        a string representation of RAML.
    :param str config_file:  String path to desired config file, if any.
    :return: No return value if successful
    :raises LoadRAMLError: If error occurred trying to load the RAML file
        (see :py:class:`.loader.RAMLLoader`)
    :raises InvalidRamlFileError: If error occurred trying to validate the RAML
        file (see :py:mod:`.validate`)

    """
    loader = load(raml)
    config = setup_config(config_file)
    config["validate"] = True
    parse_raml(loader, config)
开发者ID:postatum,项目名称:ramlfications,代码行数:21,代码来源:__init__.py


示例5: test_resource_type_empty_mapping

def test_resource_type_empty_mapping():
    raml_file = os.path.join(EXAMPLES + "empty-mapping-resource-type.raml")
    loaded_raml_file = load_file(raml_file)
    config = setup_config(EXAMPLES + "test-config.ini")
    config['validate'] = False
    api = pw.parse_raml(loaded_raml_file, config)

    assert len(api.resource_types) == 1

    res = api.resource_types[0]

    assert res.name == "emptyType"
    assert res.raw == {}
开发者ID:AndreasBackx,项目名称:ramlfications,代码行数:13,代码来源:test_parser.py


示例6: parse

def parse(raml, config_file=None):
    """
    Module helper function to parse a RAML File.  First loads the RAML file
    with :py:class:`.loader.RAMLLoader` then parses with
    :py:func:`.parser.parse_raml` to return a :py:class:`.raml.RAMLRoot`
    object.

    :param raml: Either string path to the RAML file, a file object, or \
        a string representation of RAML.
    :param str config_file:  String path to desired config file, if any.
    :return: parsed API
    :rtype: RAMLRoot
    :raises LoadRAMLError: If error occurred trying to load the RAML file
        (see :py:class:`.loader.RAMLLoader`)
    :raises RAMLParserError: If error occurred during parsing of RAML file
        (see :py:class:`.raml.RAMLRoot`)
    :raises InvalidRamlFileError: RAML file is invalid according to RAML \
        `specification <http://raml.org/spec.html>`_.
    """
    loader = load(raml)
    config = setup_config(config_file)
    return parse_raml(loader, config)
开发者ID:postatum,项目名称:ramlfications,代码行数:22,代码来源:__init__.py


示例7: inherited_resources

def inherited_resources():
    raml_file = os.path.join(EXAMPLES, "resource-type-inherited.raml")
    loaded_raml = load_file(raml_file)
    config = setup_config(EXAMPLES + "test-config.ini")
    config["validate"] = False
    return pw.parse_raml(loaded_raml, config)
开发者ID:AndreasBackx,项目名称:ramlfications,代码行数:6,代码来源:test_parser.py


示例8: resources

def resources():
    raml_file = os.path.join(EXAMPLES + "complete-valid-example.raml")
    loaded_raml_file = load_file(raml_file)
    config = setup_config(EXAMPLES + "test-config.ini")
    api = pw.parse_raml(loaded_raml_file, config)
    return api.resources
开发者ID:AndreasBackx,项目名称:ramlfications,代码行数:6,代码来源:test_parser.py


示例9: test_parse_raml

def test_parse_raml(loaded_raml):
    config = setup_config(EXAMPLES + "test-config.ini")
    root = pw.parse_raml(loaded_raml, config)
    assert isinstance(root, RootNode)
开发者ID:AndreasBackx,项目名称:ramlfications,代码行数:4,代码来源:test_parser.py


示例10: md_includes

def md_includes():
    raml_file = os.path.join(EXAMPLES + "md_includes.raml")
    loaded_raml_file = load_file(raml_file)
    config = setup_config(EXAMPLES + "test-config.ini")
    return pw.parse_raml(loaded_raml_file, config)
开发者ID:AndreasBackx,项目名称:ramlfications,代码行数:5,代码来源:test_parser.py


示例11: undef_uri_params_resources

def undef_uri_params_resources():
    raml_file = os.path.join(EXAMPLES, "undefined-uri-params.raml")
    loaded_raml = load_file(raml_file)
    config = setup_config(EXAMPLES + "test-config.ini")
    config['validate'] = False
    return pw.parse_raml(loaded_raml, config)
开发者ID:AndreasBackx,项目名称:ramlfications,代码行数:6,代码来源:test_parser.py


示例12: uri_param_resources

def uri_param_resources():
    raml_file = os.path.join(EXAMPLES, "preserve-uri-order.raml")
    loaded_raml = load_file(raml_file)
    config = setup_config(EXAMPLES + "test-config.ini")
    config['validate'] = False
    return pw.parse_raml(loaded_raml, config)
开发者ID:AndreasBackx,项目名称:ramlfications,代码行数:6,代码来源:test_parser.py


示例13: resource_protocol

def resource_protocol():
    raml_file = os.path.join(EXAMPLES, "protocols.raml")
    loaded_raml = load_file(raml_file)
    config = setup_config(EXAMPLES + "test-config.ini")
    config['validate'] = False
    return pw.parse_raml(loaded_raml, config)
开发者ID:AndreasBackx,项目名称:ramlfications,代码行数:6,代码来源:test_parser.py


示例14: api

def api(raml):
    config_file = os.path.join(EXAMPLES, "twitter-config.ini")
    config = setup_config(config_file)
    return pw.parse_raml(raml, config)
开发者ID:econchick,项目名称:ramlfications,代码行数:4,代码来源:test_twitter.py


示例15: test_parse_raml

def test_parse_raml(raml):
    config_file = os.path.join(EXAMPLES, "twitter-config.ini")
    config = setup_config(config_file)
    root = pw.parse_raml(raml, config)
    assert isinstance(root, RootNode)
开发者ID:econchick,项目名称:ramlfications,代码行数:5,代码来源:test_twitter.py


示例16: external_resource_with_multiple_methods

def external_resource_with_multiple_methods():
    raml_file = os.path.join(
        EXAMPLES + "external_resource_with_multiple_methods.raml")
    loaded_raml_file = load_file(raml_file)
    config = setup_config(EXAMPLES + "test-config.ini")
    return pw.parse_raml(loaded_raml_file, config)
开发者ID:bpowell65536,项目名称:ramlfications,代码行数:6,代码来源:test_parser.py



注:本文中的ramlfications.parser.parse_raml函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python ramp_mod.ramp函数代码示例发布时间:2022-05-26
下一篇:
Python config.setup_config函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap