Apiary Blueprint中Headers与Body下Attributes未被识别问题及修正方案
解决Apiary Blueprint中Headers与Body Attributes无法识别的问题
嘿,我之前也踩过这个坑!Apiary Blueprint的语法对格式细节要求很严,Headers和Body下的Attributes没法被识别,大概率是你的写法不符合它的规范。
给你看看修正后完全符合语义、能被正确识别的写法:
+ Request + Headers Accept: application/json Content-Type: application/json X-Auth-Client: Your Client Id X-Auth-Token: Your Token + Body + Attributes (ProductPost) + Response 200 + Headers Content-Encoding: Entity header is used to compress the media-type. Content-Type: application/json Date: The date the response was sent. Transfer-Encoding: Header specifies the form of encoding used to safely transfer the entity to the user. Vary: HTTP response ...
这里要注意几个关键的格式点:
- 子元素(比如Headers、Body)要缩进一级,和父元素(Request/Response)保持明确的层级关系
- Headers下面的每个头部字段要再缩进一级,保证结构的可读性和规范性
- Body下的Attributes要紧跟在Body之后,并且通过括号关联对应的模型(比如示例里的
ProductPost)
这样调整格式后,Apiary就能正确解析Headers和Body里的Attributes了!
内容的提问来源于stack exchange,提问作者T.J.
相关产品推荐
相关产品推荐

