Skip to content

registry upload csv

Tim Burks edited this page Jan 26, 2023 · 5 revisions

The registry tool includes an opinionated uploader that imports API descriptions into the registry using a CSV that includes paths to local API description files, typically in the OpenAPI format.

The uploader makes these assumptions:

  • All API specs are stored on the local filesystem and paths are relative to the directory in which registry upload csv is run.

  • The CSV file has four columns. These can be in any order, but should follow the structure described by the first line, which should contain the values shown in the example below.

api_id,version_id,spec_id,filepath
cloudtasks,v2beta2,openapi.yaml,testdata/csv/cloudtasks/v2beta2/openapi.yaml
cloudtasks,v2,openapi.yaml,testdata/csv/cloudtasks/v2/openapi.yaml
datastore,v1beta1,openapi.yaml,testdata/csv/datastore/v1beta1/openapi.yaml
datastore,v1,openapi.yaml,testdata/csv/datastore/v1/openapi.yaml
  • the uploader is currently hard-coded to specify a mimetype of application/x.openapi+gzip;version=3.0.0 for all API specs, and all specs are automatically gzipped before they are uploaded. This is noted in #973.

The upload command is as follows:

registry upload csv $FILE

An optional --delimiter flag can be used to change the field delimiter from , to another single character delimiter.