gpt4 book ai didi

api - 用 RAML 描述 URI 参数

转载 作者:行者123 更新时间:2023-12-03 03:41:41 24 4
gpt4 key购买 nike

我在 RAML 中声明 REST 服务 API stub 。我的Web应用程序提供了设备,可以通过id或代码列出、获取设备。当我想要整个列表时,我不会指定任何 URI 参数,但是,为了获取具体的设备,我会指定。这是它当前的状态:

/equipment:
get:
body:
application/json:
application/xml:
description:
List all the equipment
/id/{equipmentId}:
get:
body:
application/json:
application/xml:
description:
Get an equipment by id
/code/{code}:
get:
body:
application/json:
application/xml:
description:
Get an equipment by code

在这里,在description字段中我写下了当前调用执行的内容。但是,我想为 URI 本身中传递的参数添加描述(idcode)。有办法实现吗?

最佳答案

您缺少描述 equipmentIdcode 参数的 uriParameters 部分。在此类部分中,您可以指定常用的:typedescription...

请参阅规范中的模板 URI 和 URI 参数部分:https://github.com/raml-org/raml-spec/blob/master/versions/raml-08/raml-08.md#template-uris-and-uri-parameters

关于api - 用 RAML 描述 URI 参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25998115/

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