首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在ALPS描述符中将事物集合描述为词汇表属性?

如何在ALPS描述符中将事物集合描述为词汇表属性?
EN

Stack Overflow用户
提问于 2021-01-31 01:16:43
回答 1查看 24关注 0票数 0

为了在以应用程序为中心的情况下描述REST,我尝试使用ALPS描述符及其工具。

假设我有一个对象" artwork ",一个artwork具有以下属性: headline、artform、authors等。

我应该如何描述“作者”属性?在OpenAPI规范中,这很简单,只需说“类型:数组”,然后在“项”下指定引用。在阿尔卑斯山描述集合的等效方式是什么?

我使用YAML格式来描述API。

我当前的描述符如下所示:

代码语言:javascript
复制
descriptors:
# vocabulary properties
- id: "identifier"
  type: "semantic"
  text: "Unique identifier within Alpha Org. This is not the serial number of the item. This identifier is automatically generated when a new artwork item is created in the system."
  ref: "https://schema.org/identifier"

- id: "headline"
  type: "semantic"
  text: "Title of the artwork"
  ref: "https://schema.org/headline"

- id: "artform"
  type: "semantic"
  text: "Form of the artwork: painting? photograph? sculpture? others?"
  ref: "https://schema.org/artform"

- id: "authors"
  type: "semantic"
  text: "Authors of this artwork"
  ref: "https://schema.org/author"

- id: "serialNumber"
  type: "semantic"
  text: "Serial number of the artwork. If the artwork does not have a serial number, such as an original painting from an artist, then this number is simply the examplar number, usually 1."
  ref: "https://schema.org/serialNumber"

- id: "description"
  type: "semantic"
  text: "Description of the artwork"
  ref: "https://schema.org/description"

- id: "obtainDate"
  type: "semantic"
  text: "Date on which Alpha Org obtained the ownership of this artwork."
  ref: "https://schema.org/Date"

- id: "itemLocation"
  type: "semantic"
  text: "Location of the storage of the artwork item"
  ref: "https://schema.org/itemLocation"

- id: "images"
  type: "semantic"
  text: "Images of the artwork"
  ref: "https://schema.org/image"
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-01-31 03:21:19

ALPS的描述不会区分单个项目和集合。从模型POV来看,任何东西都可以是一个集合,从实现POV来看,实现该ALPS描述的每个服务都会做出自己的决定。

作为一种常见的实践,我通常在非常重要的情况下使用IANA link-rel值

代码语言:javascript
复制
rel: item and rel: collection

有一个小工具(ALPS UNIFIED)展示了如何将ALPS描述转换为OpenAPI定义:https://github.com/mamund/alps-unified

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65970901

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档