我尝试用两部分为请求定义raml规范。以下是卷曲示例:
results = h1.map do |base|
sum = 0
h2[base[:item]].take_while do |item|
sum += item[:value] if sum < base[:value]
end.map do |item|
[base[:id], item[:id]]
end
end
# => [[[1, 1], [1, 2]], [[1, 4], [1, 5]]]
我想要类似的东西:
puts results.flatten(1).inspect
# => [[1, 1], [1, 2], [1, 4], [1, 5]]
但它不是有效的RAML。我如何在RAML中定义请求部分?
答案 0 :(得分:0)
您只需将所有属性放在multipart / form-data下。试试这个:
post:
body:
multipart/form-data:
properties:
file:
description: The file to be uploaded
required: true
type: file
file_size:
type: integer
example: 879394
required: true
另一个选项可能更接近您提供的代码:
body:
multipart/form-data:
properties:
metadata:
properties:
file_size:
type: integer
example: 879394
required: true
photo:
properties:
file:
description: Upload file
type: file
required: true