xregistry / spec

xRegistry related specifications
https://xRegistry.io
Apache License 2.0
30 stars 6 forks source link

Challenges w.r.t. uploading multiple Versions #90

Closed duglin closed 4 months ago

duglin commented 4 months ago

Challenges:

Proposal: Assume the input is the desired state of the system, at least within the scope of the data provided (no auto-deletes); the processing should result in it looking like they did things in this order:

  1. If ?inline is present, upsert any Versions in the "versions" collection

  2. If the Resource is part of a collection of Resources in the request message (e.g. / or /GROUPs/gID or /GROUPs/gID/RESOURCEs ) then:

    • Apply defaultversionid Resource property if present on that Resource
    • Apply stickydefaultversion Resource property if present on that Resource - Concern: sometimes readonly props aren't readonly
  3. If the Resource is not part of a collection (e.g. /GROUPs/gID/RESOURCEs/rID ) then:

    • Apply ?setdefaultversionid query parameter, if present
  4. Apply Resource properties to the current default Version IFF default version is not in the "versions" collection This means that any diff between Resource and Version, Version wins

If epoch doesn't match on any Resource or any Version, error

Add support for these on PUT & POST operations:

Is it bad that we're inconsistent in that we support setting the "default" properties via json when the resource is part of a collection, but not when it's stand-alone (we require the ?setdefaultversionid query param be used)?

These flags allow people to GET and the POST w/o having to touch the data to remove epoch and the defaultVersion properties, if they don't want to them to be applied

Note: this is related to #88 - once we figure out how to order the uploaded versions, that decision might influence how we deal with the concerns here.

duglin commented 4 months ago

As of today, the spec says this w.r.t. setdefaultversionid query parameter:

- Aside from the special values of `null` and `this`, its value MUST be
  the `id` of a Version for the specified Resource after all Version processing
  is completed (i.e. after any Versions are added or removed). Its value is 
  not limited to the Versions involved in the current operation.
- When the operation involves updating a Resource's "default" Version
  properties, the processing of the `setdefaultversionid` parameter MUST be
  done before the properties are updated. In other words, the Version updated 
  is new default Version, not the old one.