如何在API蓝图定义中使用generic named type?
我试着这样:
FORMAT: 1A HOST: http://test.com/
# API Blueprint testing.
## Resource [/resources]
### Action [GET]
+ Response 200 (application/json)
+ Attributes
+ decorated_person (Address Decorator(Person))
# Data Structures
## Person (object)
+ first_name
+ last_name
## Address Decorator (*T*)
+ address
但是Apiary Editor给了我错误:
基本类型'Address Decorator(Person)'未在文档中定义
答案 0 :(得分:0)
这是两个问题。地址修饰器不是基础类型,例如对象,在属性中,您必须使用Mixin或Nesting。
FORMAT: 1A
HOST: http://test.com/
# API Blueprint testing.
## Resource [/resources]
### Action [GET]
+ Response 200 (application/json)
+ Attributes
+ Include AddressDecorator
# Data Structures
## Person (object)
+ first_name
+ last_name
## AddressDecorator (object)
+ address