如何在 CKAN "datastore_create" API 请求中指定标签和描述字段

How to specify label and description fields in CKAN "datastore_create" API request

我正在使用 CKAN API 创建数据存储,但 CKAN 忽略了 labeldescription 属性:

const fields = [
  {
    id: "id_unique",
    type: "text",
    label: "label of id_unique", // CKAN ignoring this property
    description: "description of id_unique", // CKAN ignoring this property
  },
  {
    id: "latitude",
    type: "text",
    label: "label of latitude", // CKAN ignoring this property
    description: "description of latitude", // CKAN ignoring this property
  },
  {
    id: "longitude",
    type: "text",
    label: "label of longitude", // CKAN ignoring this property
    description: "description of longitude", // CKAN ignoring this property
  },
]

await clientAction('datastore_create', {
  package_id,
  resource_id,
  force,
  fields,
  records,
  primary_key,
})

结果:

如何发送“标签”和“描述”属性?

找到解决方案。它在 info 字段中指定:

const fields = [
  {
    id: "id_unique",
    type: "text",
    info: {
      notes: "description of id_unique",
      label: "label of id_unique",
    }
  },
  {
    id: "latitude",
    type: "text",
    info: {
      notes: "description of latitude",
      label: "label of latitude",
    }
  },
  {
    id: "longitude",
    type: "text",
    info: {
      notes: "description of longitude",
      label: "label of longitude",
    }
  },
]