在Apiary.io上的API Blueprint中使用通用命名类型

时间:2016-12-08 10:45:03

标签: apiblueprint apiary.io

如何在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)'未在文档中定义

1 个答案:

答案 0 :(得分:0)

这是两个问题。地址修饰器不是基础类型,例如对象,在属性中,您必须使用MixinNesting

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