【问题标题】:Apiary: Is there a way to define options for parameters?Apiary:有没有办法为参数定义选项?
【发布时间】:2014-06-24 13:58:14
【问题描述】:

我想为 Apiary 参数定义选项,我目前在描述中列出它们:

  • 测量=m(可选,字符串,m)...测量例如m = 米,km = 公里,yd = 码,mi = 英里

【问题讨论】:

    标签: parameters options apiblueprint apiary.io apiary


    【解决方案1】:

    您可以枚举 URI 查询参数的可能值并在参数讨论中讨论它,如下所示:

    + Parameters
        + measurement = `m` (optional, string) ... measurement units
    
            Any discussion here...
    
            e.g. explanation of **values** listed bellow are.
    
            + Values
                + `m`
                + `mi`
                + `yd`
    

    另请参阅Documenting query parameters with API Blueprint 问题。

    【讨论】:

      【解决方案2】:

      您可以在端点中定义可选参数,如下所示:

      /api/data{?measurement}
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2021-12-27
        • 2010-12-07
        • 2013-04-16
        • 1970-01-01
        • 1970-01-01
        • 2016-04-19
        • 2023-02-03
        相关资源
        最近更新 更多