Apicurio / apicurio-registry

An API/Schema registry - stores APIs and Schemas.
https://www.apicur.io/registry/
Apache License 2.0
588 stars 261 forks source link

"test" validate global rules API without actually creating a new artifact #4381

Closed wolfchimneyrock closed 2 months ago

wolfchimneyrock commented 7 months ago

Right now there is an API call which allows you to "test" an updated version of an artifact without actually uploading it. Such a call does not exist though for testing validity or integrity of a brand new artifact without actually creating it.

This is great for our three step workflow (validate, get manager's approval, create) for adding versions to artifacts, but we would want the same workflow for the initial artifact creation. To achieve that with the current api, we'd either have to

  1. create the new artifact and immediately delete it
  2. all new artifacts get created with a generic empty fully evolvable boilerplate schema version 0, then all user content would be artifact updates

Neither of these options are very appealing. It would be nice to have an API call to test the contents of a proposed artifact against the global validity and integrity rules.

EricWittmann commented 3 months ago

This is implemented in the next major version (3.0). We have changed the REST API by removing the existing test endpoint(s) in favor of a new dryRun query parameter on appropriate other operations. So now the Create Artifact and Create Version operations both have a dryRun option, which will effectively do the same thing that the old test endpoint did.

This should allow you to test whether creating a new artifact would work.

I think we have some additional work to do on this, because it currently just runs the configured Rules (if any) but doesn't even try to insert the artifact into the DB. So you won't get a 409 Conflict response as you might expect.

EricWittmann commented 3 months ago

I'll leave this open for the above reasons, even though I think it's technically done.

EricWittmann commented 2 months ago

Note to @jsenko - I think that if we change our transactionality approach, we could do a really nice job of this by just rolling back the Tx if dryRun is set to true.

jsenko commented 2 months ago

Link https://github.com/Apicurio/apicurio-registry/issues/4922

EricWittmann commented 2 months ago

Fully implemented/fixed in: