community-plugins
community-plugins copied to clipboard
🚀 entity-validation/catalog: Add possibility to validate multiple Entities that depend on each other
Plugin Name
🚀 entity-validation/catalog
🔖 Feature description
Add possibility to send more then one entity to /api/catalog/validate-entity
and add temporary registry of validated entities to allow validation of multiple entities that are depending on each other.
This feature would allow validation of multiple entities at once which would be helpful when user is trying to introduce multiple entities that depend on each other at once.
We are using validate-entity
endpoint to validate entities in Pull Requests. If user tries to introduce more than one entity and these entities are depending on each other validator fails.
🎤 Context
While using entity-validation we have realized that it is impossible to validate two (or more) separate entities that depend on each other. For example, if we want to validate new Group entity and a Component that should be owned by that Group entity validator will return error for the Component because it doesn't know about the group entity. Sample validator input:
apiVersion: backstage.io/v1beta1
kind: Group
metadata:
namespace: default
annotations:
name: fake-team
title: FAKE-Team
description: This is a fake team for test purposes
spec:
type: Team
---
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: backstage
title: Backstage
namespace: delivery
description: Backstage
spec:
type: website
lifecycle: production
owner: fake-team
system: fake-system
validator response: Validates Group entity correctly. for the Component entity returns following error:
Processor CustomEntityValidationProcessor threw an error while validating the entity component:fake-namespace/backstage; caused by ValidationError: spec.owner: "fake-team" failed endpoint validation as it is not a valid group in backstage; entityOwner: fake-team;
In the networking tab of developer web browser tools I see that validator sends two separate POST requests to the https://<backstage-url>/api/catalog/validate-entity
endpoints. Each of the requests is for each of the components passed to Entity Validator.
The first one is for the Group entity and it returns 200, the second one is for the Component and it returns 400 due to missing Group entity.
✌️ Possible Implementation
Modify validator and validate-entity
endpoint form catalog
so the endpoint would accept more than one entity with a single API call.
We would send all the entities which should be validated within single API call and then store them in some temporary array and validate other entities from the same request against Software Catalog and that array as well.
Or maybe some temporary Software Catalog only for validation purposes?
Would it make sense?
👀 Have you spent some time to check if this feature request has been raised before?
- [X] I checked and didn't find similar issue
🏢 Have you read the Code of Conduct?
- [X] I have read the Code of Conduct
Are you willing to submit PR?
Yes I am willing to submit a PR!