【问题标题】:How to supply example value for string array parameter in api-blueprint如何在 api-blueprint 中为字符串数组参数提供示例值
【发布时间】:2017-04-06 20:17:14
【问题描述】:

我正在 api-blueprint 中使用这个 API。

## Variables [/Variables{?names}]

### Retrieve the variables [GET]

+ Parameter
    + names: `First` (array[string]) - The variables names.

我正在尝试将 names 的默认值设置为多个值

/Variables?names=first&names=second

但我不知道如何指定它。我用谷歌搜索,无法确定这是否受支持。希望这里有人知道答案。

我发现的另一个极端情况是枚举值:

## Variables [/Variables{?names}]

### Retrieve the variables [GET]

+ Parameter
    + dataTypes: `Boolean,DateTime` (array[enum], required) - The variable data types. To request more than one data type, repeat the parameter
    e.g. dataTypes=Boolean&dataTypes=DateTime
        + Members
            + `Boolean` - The variable contains a boolean response (true / false).
            + `DateTime` - The variable contains a date / time response.
            + `MultipleCode` - The variable contains multiple selections from a collection of defined coded values.
            + `Numeric` - The variable contains a numeric response.
            + `SingleCode` - The The variable contains a single selection from a collection of defined coded values.
            + `Text` - The variable contains a text response.

类型是 (array, required) 还是 (array[enum], required) 似乎无关紧要,我仍然会遇到语义错误。

【问题讨论】:

    标签: arrays parameters apiblueprint


    【解决方案1】:
    + names: `first,second` (array) - The variables names.
    

    这应该可以正常工作。

    【讨论】:

    • 这在我的大多数示例中都很有效。但是,如果值是枚举,则它不起作用
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-15
    • 1970-01-01
    相关资源
    最近更新 更多