bov*_*n.a 6 apiary.io apiblueprint
如何在API Blueprint定义中使用通用命名类型?
我试着这样:
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
Run Code Online (Sandbox Code Playgroud)
但是Apiary Editor给我的错误:
基本类型'Address Decorator(Person)'未在文档中定义
这里有两个问题。地址装饰器不是示例对象的基本类型,并且在属性中您必须使用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
Run Code Online (Sandbox Code Playgroud)