Introduced config schema for techdocs plugins

This commit is contained in:
keshan
2020-12-21 12:44:02 +05:30
parent 7afe9c85c5
commit 359f9d2d8c
5 changed files with 150 additions and 82 deletions
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/plugin-techdocs': patch
'@backstage/plugin-techdocs-backend': patch
---
Added configuration schema for the commonly used properties of techdocs and techdocs-backend plugins
+46
View File
@@ -0,0 +1,46 @@
/*
* Copyright 2020 Spotify AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface Config {
/** Configuration options for the techdocs-backend plugin */
techdocs: {
/**
* attr: 'storageUrl' - accepts a string value
* e.g. storageUrl: http://localhost:7000/api/techdocs/static/docs
*/
storageUrl: string;
/**
* documentation building process depends on the builder attr
* attr: 'builder' - accepts a string value
* e.g. builder: 'local'
* alternative: 'external' etc.
* @see http://backstage.io/docs/features/techdocs/configuration
*/
builder: string;
/**
* techdocs publisher information
*/
publisher: {
/**
* attr: 'type' - accepts a string value
* e.g. type: 'local'
* aleternatives: 'googleGcs' etc.
* @see http://backstage.io/docs/features/techdocs/configuration
*/
type: string;
};
};
}
+4 -2
View File
@@ -48,6 +48,8 @@
"supertest": "^4.0.2"
},
"files": [
"dist"
]
"dist",
"config.d.ts"
],
"configSchema": "config.d.ts"
}
+91
View File
@@ -0,0 +1,91 @@
/*
* Copyright 2020 Spotify AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface Config {
/** Configuration options for the techdocs plugin */
techdocs: {
/**
* attr: 'requestUrl' - accepts a string value
* e.g. requestUrl: http://localhost:7000/api/techdocs
* @visibility frontend
*/
requestUrl: string;
/**
* attr: 'storageUrl' - accepts a string value
* e.g. storageUrl: http://localhost:7000/api/techdocs/static/docs
*/
storageUrl: string;
/**
* documentation building process depends on the builder attr
* attr: 'builder' - accepts a string value
* e.g. builder: 'local'
* alternative: 'external' etc.
* @see http://backstage.io/docs/features/techdocs/configuration
* @visibility frontend
*/
builder: string;
/**
* techdocs publisher information
*/
generators?: {
/**
* attr: 'techdocs' - accepts a string value
* e.g. type: 'docker'
* aleternatives: 'local' etc.
* @see http://backstage.io/docs/features/techdocs/configuration
*/
techdocs: string;
};
/**
* techdocs publisher information
*/
publisher?: {
/**
* attr: 'type' - accepts a string value
* e.g. type: 'local'
* aleternatives: 'googleGcs' etc.
* @see http://backstage.io/docs/features/techdocs/configuration
*/
type: string;
/**
* googleGcs required when 'type' is set to googleGcs, skip otherwise
*/
googleGcs?: {
/**
* API key used to write to a storage bucket.
* attr: 'credentials' - accepts a string value
* @visibility secret
*/
credentials: string;
/**
* GCP Project ID where the Cloud Storage Bucket is hosted.
* attr: 'projectId' - accepts a string value
* @visibility secret
*/
projectId: string;
/**
* Cloud Storage Bucket Name
* attr: 'bucketName' - accepts a string value
* @visibility secret
*/
bucketName: string;
};
};
};
}
+3 -80
View File
@@ -63,85 +63,8 @@
"msw": "^0.21.2"
},
"files": [
"dist"
"dist",
"config.d.ts"
],
"configSchema": {
"$schema": "https://backstage.io/schema/config-v1",
"title": "@backstage/techdocs",
"type": "object",
"properties": {
"techdocs": {
"type": "object",
"properties": {
"requestUrl": {
"type": "string",
"visibility": "frontend"
},
"storageUrl": {
"type": "string",
"visibility": "backend"
},
"generators": {
"type": "object",
"properties": {
"techdocs": {
"type": "string",
"visibility": "backend"
}
}
},
"builder": {
"type": "string",
"visibility": "frontend"
},
"publisher": {
"oneOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "local",
"visibility": "backend"
}
}
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "googleGcs",
"visibility": "backend"
},
"googleGcs": {
"type": "object",
"properties": {
"credentials": {
"type": "string",
"visibility": "secret"
},
"projectId": {
"type": "string",
"visibility": "secret"
},
"bucketName": {
"type": "string",
"visibility": "secret"
}
}
}
}
}
]
}
},
"required": [
"requestUrl",
"storageUrl",
"builder"
]
}
}
}
"configSchema": "config.d.ts"
}