review comments

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2022-02-15 14:52:49 +01:00
parent 6fe01cec04
commit 5e585bbc7f
6 changed files with 26 additions and 36 deletions
@@ -17,7 +17,6 @@
import {
Entity,
entityKindSchemaValidator,
JSONSchema,
KindValidator,
} from '@backstage/catalog-model';
import { JsonObject } from '@backstage/types';
@@ -51,18 +50,6 @@ export interface TemplateEntityV1beta2 extends Entity {
const validator = entityKindSchemaValidator(schema);
/**
* JSON schema of the Template kind, apiVersion backstage.io/v1beta2.
*
* @public
* @deprecated Please convert your templates to apiVersion
* scaffolder.backstage.io/v1beta3
*/
export const templateEntityV1beta2Schema: JSONSchema = schema as Omit<
JSONSchema,
'examples'
>;
/**
* Entity data validator for {@link TemplateEntityV1beta2}.
*
@@ -14,9 +14,13 @@
* limitations under the License.
*/
import { Entity, JSONSchema } from '@backstage/catalog-model';
import {
Entity,
entityKindSchemaValidator,
KindValidator,
} from '@backstage/catalog-model';
import { JsonObject } from '@backstage/types';
import v1beta3Schema from './Template.v1beta3.schema.json';
import schema from './Template.v1beta3.schema.json';
/**
* Backstage catalog Template kind Entity. Templates are used by the Scaffolder
@@ -42,12 +46,16 @@ export interface TemplateEntityV1beta3 extends Entity {
};
}
const validator = entityKindSchemaValidator(schema);
/**
* JSON schema of the Template kind, apiVersion scaffolder.backstage.io/v1beta3.
* Entity data validator for {@link TemplateEntityV1beta3}.
*
* @public
*/
export const templateEntityV1beta3Schema: JSONSchema = v1beta3Schema as Omit<
JSONSchema,
'examples'
>;
export const templateEntityV1beta3Validator: KindValidator = {
// TODO(freben): Emulate the old KindValidator until we fix that type
async check(data: Entity) {
return validator(data) === data;
},
};
+2 -5
View File
@@ -21,10 +21,7 @@
*/
export * from './TaskSpec';
export {
templateEntityV1beta2Schema,
templateEntityV1beta2Validator,
} from './TemplateEntityV1beta2';
export { templateEntityV1beta2Validator } from './TemplateEntityV1beta2';
export type { TemplateEntityV1beta2 } from './TemplateEntityV1beta2';
export { templateEntityV1beta3Schema } from './TemplateEntityV1beta3';
export { templateEntityV1beta3Validator } from './TemplateEntityV1beta3';
export type { TemplateEntityV1beta3 } from './TemplateEntityV1beta3';