gpt4 book ai didi

api - RAML 中的 POST 参数支持

转载 作者:行者123 更新时间:2023-12-04 13:16:01 24 4
gpt4 key购买 nike

请问RAML中是否支持POST参数.如果有 - 语法是什么。我浏览了规范 0.8和规范1.0大致(实际上我绑定(bind)到 0.8 ,因为许多工具还不支持 1.0)。我没有找到 POST 参数支持,但也许我只是错过了一些东西。

那么我所说的 POST 参数是什么意思呢?这些可以是两者中的任何一个(对不起,我不知道他们的正式名称,如果有的话):

  • HTTP 普通参数,key=value , 一行中的每个参数,如
    name=John Doe
    amount=5
    这不是很方便(例如没有嵌套)
  • 参数作为 JSON 对象,只是一个允许其所有语法的 JSON(服务器端需要解析这个 json);如:
    {"name":"John Doe","amount":"5"}

  • 不同的服务器端 API 实现使用第一个或第二个。无论如何, RAML 如何支持这些?

    最佳答案

    如本引用中所示 https://github.com/raml-org/raml-spec/wiki/Breaking-Changes :

    对于 raml 0.8:

    body:
    application/x-www-form-urlencoded:
    formParameters:
    name:
    description: name on account
    type: string
    example: Naruto Uzumaki
    gender:
    enum: ["male", "female"]

    在 raml 1.0 中等效于:
    body:
    application/x-www-form-urlencoded:
    properties:
    name:
    description: name on account
    type: string
    example: Naruto Uzumaki
    gender:
    enum: ["male", "female"]

    所以它改变的是属性一的 formParameters 属性。

    关于api - RAML 中的 POST 参数支持,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35438447/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com