opengeospatial / ogcapi-connected-systems

Public Repository for the Connected Systems SWG
Other
8 stars 6 forks source link

Deleting systems with cascade=true deletes valid deployments #61

Open SpeckiJ opened 3 months ago

SpeckiJ commented 3 months ago

Question

The requirement /req/create-replace-delete/system-delete-cascade specifies that deletion of a system should cascade to related entities (given cascade=true):

If the System resource is associated with a Deployment resource, the Deployment resource SHALL be deleted first.

This does not say anything about the presence of other deployedSystems (seperate Systems deployed in the same deployment but otherwise not associated with the system-to-be-deleted), but just generically deletes the deployment.

Problem

To me it seems quite odd that deletion of a single System deletes the whole deployment, even if there are still other valid Systems linked with the Deployment?

Example: a Buoy containing a variety of different systems with respective subsystems was deployed. After the campaign is over it is noticed that one of the systems is not licensed/valid/calibrated/etc. and needs to be deleted, including all subsystems and their respective related entities. All other systems are okay and should remain stored in the API. If we now delete with cascade=true (to delete related entities), the whole Deployment is deleted. All the other systems that were not deleted now do not have the deployment on the buoy anymore because an unrelated Systems was deleted.

According to the OpenAPI spec the deployedSystems-Section is optional, and Deployments can also just not have any System linked. I therefore cannot really see why the whole deployment should be deleted when only a single one of the systems that were deployed is deleted.

Possible solutions:

To "solve" this is can see two options:

  1. Modify the requirement to say:

If the System resource is associated with a Deployment resource, the Deployment resource SHALL be updated, removing the System from its deployedSystems.

This keeps the Deployment around, possibly without any deployedSystem.

  1. Add a BIG disclaimer that this is the intended behaviour of cascade=true and if you do not want all your deployments to vanish (but all subsystems/nested resources) you need to patch the deployments first to remove the System.
alexrobin commented 2 months ago

Discussed during 09/05 telecon: Either keep the deployment, delete the system and delete the link between the system and the deployment. If the deployment has no more system, then deployment is deleted yet.