Sections
- What is Catalog Next
- Adding a Resource to Catalog Next
- Accessing the Catalog
- Technical Info & Links
- Future Work
What is Catalog Next?
Catalog Next is the “next” innovation of how unfoldingWord does its resource catalog.
For the “current” version and implementation of the Door43 catalog (what most apps are “currently” using), v3, publishing one’s resource/repository (repo) to the catalog required staging the repo in the STR org on DCS, then have it approved via a pull request, and then merged into a fork of the repo in the Door43-Catalog org. It required cataloged resources to all be “owned” by one organization, Door43-Catalog, rather than an actual owner’s account or organization, and had to be reviewed, merge and published by someone on the unfoldingWord staff. We also had no way to search DCS repos by language, subject, and other useful fields of our resource manifests, nor a way to easily see in both the UI and repo API endpoints what valid releases versions & stages were available.
Catalog Next, which is has been implemented and put into production, has simply been built in DCS so:
- anyone can have a quick and easy way to release their resources and version them, including pre-releases and drafts
- we can leverage the 3 different types of releases Gitea can make: a Release ["prod’], a Pre-Release (“pre-prod”, a check box when making a release), a “Draft” (“draft”, a Save Draft button when making a release), and simply master (“latest”). Those allow us to test different version in an app
- fields from the manifest are are now searchable and displayed in repo API endpoint results
Adding a Resource (RC v0.2 Repository) to Catalog Next
Adding the master
Branch to Catalog Next
stage: latest
-
User makes a commit to the master branch of a user or organization repository, either via the DCS website or locally via
git push
on the command line
DCS website:
git push:
NOTE: There must be a manifest.yaml file in the root of the master branch that has a valid badge (i.e. is a RC v0.2 manifest file). Example:
-
This triggers a procedure in DCS to process the manifest.yaml file of the master branch, verifying if it is valid. If it is, the master branch is added to the DCS Database in the catalog table as the “latest” stage entry for this resource. If it is not, the “latest” stage entry for this repo is removed (thus not, or no longer, in Catalog Next)
Adding a Release to Catalog Next
stage: prod, pre-prod, draft
-
User makes a release, or updates a pre-prod or draft release of a user or organization repository
NOTE: These are all standard release types that both Gitea & Github provide. See buttons & checkboxes at the bottom of the form when making a release)
- This triggers an action a procedure in DCS to process the manifest.yaml file of the given release, validating the manifest file. If it validates, the release is added to the DCS database in the catalog table with the manifest and release info, setting it to the corresponding stage (“prod”, “pre-prod”, or “draft”)
Understanding Release Stages
Production Release (“prod”)
When making a release, say it is good to go and make it a Production Release (prod) by clicking the “Publish Release”. This will point the release the the latest commit of the branch you select in setting up the release via the tag you give the release. Once saved, the Release can’t be can’t be converted to a Pre-Release or Draft. It could be deleted, but that is not advised to do, as an app may have already grabbed this release.
Pre-Release (“preprod”)
Draft (“draft”)
Example of setting up a draft release:
Valid master branch (“latest”)
Validity badges
All of the above stages/releases must have a valid manifest.yaml file, making it a proper resource container (RC v0.2). Its validity, stage and tag name can all be seen in a badge on both the release page by the release and in the repo’s title on the repo page.
Accessing/Using Catalog Next (Users & Apps)
User Access
- A user can get information on resource entries in the catalog from the DCS website by clicking on the Catalog tab at the top of any page.
NOTE: Hover over the?
in the search bar for how powerful it is in getting results (defaults to just showing resources with a prod release). You can actually get even the repos with a master branch that has a valid manifest.yaml file by puttingstage:latest
in the search bar. This is the way users can see what is in the catalog.
App Access
- An app can use the Gitea v1 API to get release/catalog info from any repo object return, using the “catalog” property of the repo object.
For example: the API endpoint https://git.door43.org/api/v1/repos/unfoldingword/en_tn will show these properties in the returned repo object:
{
...
"language": "en",
"subject": "TSV Translation Notes",
"books": [...],
"title": "unfoldingWord® Translation Notes",
"checking_level": "3",
"catalog": {
"prod": {
"branch_or_tag_name": "v45",
"release_url": "https://git.door43.org/api/v1/repos/unfoldingWord/en_tn/releases/10729",
"released": "2021-04-07T06:55:20Z",
"zipball_url": "https://git.door43.org/unfoldingWord/en_tn/archive/v45.zip",
"tarball_url": "https://git.door43.org/unfoldingWord/en_tn/archive/v45.tar.gz"
},
"preprod": null,
"draft": null,
"latest": {
"branch_or_tag_name": "master",
"release_url": null,
"released": "2021-04-21T13:27:50Z",
"zipball_url": "https://git.door43.org/unfoldingWord/en_tn/archive/master.zip",
"tarball_url": "https://git.door43.org/unfoldingWord/en_tn/archive/master.tar.gz"
}
}
}
- An app can use the Catalog Next API to
search
catalog entries by subject, owner, stage, etc. or get a releaseentry
by owner/repo/tag.
A Note on Stage Querying
Stages, whether you’re querying them in the API or the UI, do not mean you are going to ONLY get the stage you give it, but any resources of the given stage or higher that qualify.
By “higher”, we mean stages go in this order, highest to lowest:
prod, pre-prod, draft, latest
So, for example, if I search for stage:pre-prod
this does not mean I want ONLY resources with a pre-prod release, but ALL resources that have a prod or pre-prod release. So in sense you’re saying resources with a prod or pre-prod release are ok.
A resource will only show up in the results as a pre-prod release if the pre-prod release is NEWER than the prod release. If the resource has a pre-prod and a prod release, and the prod release is newer than the pre-prod release, the result will show a prod release.
Use case:
Querying resources this way, by giving the lowest level of stage your app is willing to work with, allows your app to always have the latest release desired. For example, if you want your app to allow drafts and higher, you set the stage argument of your API query to “draft” and then you can be assured to get drafts, pre-prod releases and prod releases.
A Note about Subjects
The subject
parameter of a query is used to find resources by their type. This is a string of words separated by spaces. Valid subjects can be found here in the validation schema
Wild Wild West - Precautions & Issues
One things to keep in mind, as you probably already realized, is that ANYONE can publish ANY repo/resource as long as it has a valid manifest.yaml file. This can make things a little crazy and thus you need to take some precautions in your app when using the catalog.
First, as listed below in the Future Work section, we hope to do more validating than just the manifest.yaml file. Once our content validation app is run as a service and has an API endpoint that takes a repo tag or commit URL and validates all the content of that resource, that will be ran when determining if a resource can be added to the catalog on any of the stages.
Until then, it is necessary that you take precaution to what resources you app uses as a source. You can filter by owner, such as only unfoldingWord, ru_gl, hi_gl, etc. Or you let the user pick the source with them knowing they have free reign in picking the sources they use.
Technical Info & Links
- Catalog Next Proposal - 2019
- Catalog Next Implementation Proposal - 2020
- Catalog Next Migrations (video by Jesse, uW Google Drive)
- DCS Production Website
- DCS Codebase
- RC Schema for validating manifest.yaml files and lists valid subjects
Future Work
Still to add to Catalog Next are the following processes and properties:
- Use the Content Validation App to validate all resources, rather than just validating the manifest.yaml file
- Make the manifest.json file (or scripture burrito metadata when implemented) editable in the repo’s settings under its own page/form, editing in a JSON Schema Form via https://github.com/rjsf-team/react-jsonschema-form/
- Sign the release tarballs and zipballs
- Have PDF URLs for the release (also signed)
- Use Scripture Burrito instead of RC v0.2
- Be able to filter Bibles by literal, simplified or other (requires Scripture Burrito)