我正在使用API Blueprint记录API,并且我有几个端点使用具有相同值的相同枚举类型。而不是在使用此枚举的每个点重复所有值,我想将它放在数据结构部分中,只是引用它,从而使它变干。但是,我无法从文档中弄清楚如何将枚举放入数据结构部分。我可以很好地做对象,但是当我在Data Structures部分声明一个枚举时,似乎忽略了指定的成员。
这是一个(非常人为的)我现在拥有的例子(不是DRY):
### Some Request [GET]
+ Parameters
+ name: `sample` (string) - the name
+ type: `A` (enum[string]) - the type
+ Members
+ A
+ B
+ C
### Another Request [GET]
+ Parameters
+ address: `123 St.` (string) - the address
+ type: `B` (enum[string]) - the same type as above
+ Members
+ A
+ B
+ C
以下是我希望能够做到的事情:
### Some Request [GET]
+ Parameters
+ name: `sample` (string) - the name
+ type: `A` (The Type) - the type
### Another Request [GET]
+ Parameters
+ address: `123 St.` (string) - the address
+ type: `A` (The Type) - the type
# Data Structures
## The Type (enum[string])
+ Members
+ A
+ B
+ C
我在这种语法上尝试了一些变体,都没有运气。当然,完全有可能我只是在咆哮错误的树,并且有一种完全不同的方式让重复的枚举成为DRY。