feat: Rename types key to generators

This commit is contained in:
oSumAtrIX 2023-10-29 23:18:05 +01:00
parent 046fb6991a
commit 75eccddc5b
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
3 changed files with 10 additions and 10 deletions

View File

@ -7,7 +7,7 @@ Repository to host a static API using GitHub workflows.
When CI is ran, static files are generated and commited to the `gh-pages` branch.
The file `generator.py` provides a list of static file generator classes. Each class has a name.
The configuration file `config.json` is read which contains the configuration for the API.
By specifying the name of the generator in the `types` array of the configuration, the corresponding generator will be used. The current object of the configuration is passed to the generator.
By specifying the name of the generator in the `generators` array of the configuration, the corresponding generator will be used. The current object of the configuration is passed to the generator.
The following API configuration generates the `contributor` and `release` API for selected repositories:
@ -15,7 +15,7 @@ The following API configuration generates the `contributor` and `release` API fo
{
"api": [
{
"types": ["release", "contributor"],
"generators": ["release", "contributor"],
"repositories": ["user/repo"]
}
]

View File

@ -1,7 +1,7 @@
{
"api": [
{
"types": [
"generators": [
"release+contributor"
],
"repositories": [
@ -9,7 +9,7 @@
]
},
{
"types": [
"generators": [
"social"
],
"socials": {
@ -17,13 +17,13 @@
}
},
{
"types": [
"generators": [
"team"
],
"organization": "yourorg"
},
{
"types": [
"generators": [
"donation"
],
"links": {

View File

@ -9,8 +9,8 @@ apis = config["api"]
api_provider = DefaultApiProvider()
for api in apis:
for type in api["types"]:
api_type = api_provider.get(type)
if api_type is None:
for generator_name in api["generators"]:
generator = api_provider.get(generator_name)
if generator is None:
continue
api_type.generate(api, output)
generator.generate(api, output)