Skip to content

Representing FieldSets

Tim Burks edited this page Mar 28, 2023 · 11 revisions

FieldSet artifacts allow groups of values to be stored in a registry and displayed in user interfaces like API Hub and the Registry Viewer.

FieldSet artifacts are defined in fields.proto. FieldSet artifacts can be associated with any resource (project, api, version, spec, or deployment) and are generally for storing raw values only. Contents of FieldSets are described in FieldSetDefinition artifacts, also described in fields.proto. FieldSetDefinition artifacts are typically stored at the project level.

Here is a sample FieldSet, described with Registry YAML. It is associated with an API named apis/acme.com and can be added to the registry with registry apply -f support.yaml. Note that PROJECTID below needs to be the id of the project where the API is stored. We recommend that FieldSet YAML be stored in files matching their artifact name in a directory associated with their parent API. Here we use support.yaml for the support artifact).

apiVersion: apigeeregistry/v1
kind: FieldSet
metadata:
  parent: apis/acme.com
  name: support
data:
  definitionName: projects/PROJECTID/locations/global/artifacts/support
  values:
    email: "apiteam@acme.com"
    portal: "[Acme Developer Support](https://developer.acme.com/support)"

The definitionName in the above FieldSet refers to a FieldSetDefinition that describes the contents of the FieldSet and how it should be displayed. It can be added as a project-level artifact with `registry apply -f support.yaml:

apiVersion: apigeeregistry/v1
kind: FieldSetDefinition
metadata:
  name: support
data:
  displayName: Support
  description: Look here to find support for this API.
  fields:
    - id: portal
      displayName: Developer Portal
      description: API documentation and access to developer tokens
    - id: email
      displayName: Support Email
      description: Contact the API support team
Clone this wiki locally