-
Notifications
You must be signed in to change notification settings - Fork 0
Working with JSON Data Feeds
Autodocs uses a distributed design where data may be autoloaded from JSON cache files that we call Data Feeds. The JsonDataFeed
is an implementation of the DataFeedInterface
, which may be extended in the future to accommodate additional data sources other than JSON files.
This distributed approach facilitates integrating Autodocs with existing workflows and pipelines, especially when using GitHub Actions. You can load data using any method (shell scripts, API calls, CLI commands, etc...) that allows you to save data into JSON format. In the context of CI and GitHub Actions, this might run as a separate job before you run Autodocs.
Any (valid) JSON file located in the path defined by cache_dir
within Autodocs configuration will be auto registered within the Autodocs service and can be located with the getDataFeed
method. They are lazily loaded, which means the actual contents of the file will only be retrieved when you query the Datafeed with the getDataFeed
method.
Datafeeds are typically queried in Reference Pages when building your content. Example of querying for a Datafeed:
try {
$imagesList = $this->autodocs->getDataFeed('images-tags.json');
} catch (Exception $e) {
return "";
}