Resource vs Version model attributes
Closed this issue · 4 comments
I think this might be related to @deissnerk's discomfort with our model...
- Right now it's not really possible to know for sure when a Resource attribute appears on the Resource or the Version. Version's
isdefault
and Resource'sdefaultversionid
are examples. - Similarly, because of this, we can't set the appropriate
xxxRequired
fields totrue
since depending on whether the client asks for a Resource or a Version the required-ness aspect will change. - "exportrequired" is a horrible name :-)
I think we need to continue to have just Groups and Resources as part of the model definition itself. I think that 2-layer model is important to keep things simple and splitting Resources and Versions in the model will not only add to the perceived complexity but will require more work for people due to duplication of attribute definitions. However, I think we may need to be a bit more clear for client-side tooling.
Proposal:
- Add a Resource-level model attribute to indicate whether the property will appear on Resources, Versions or both. E.g.
location
, values =resource
,version
,both
(appears on both but might not be the same value). Default value isversion
so that user-defined extensions don't need to specify anything extra - User-defined extensions MUST have a
location
value ofversion
- drop
exportrequired
Need to think about how this relates to other model attributes, like "serverRequired" or "readonly"
Examples:
Attribute | location | readOnly | serverRequired | immutable |
---|---|---|---|---|
id | both | false | true | true |
name | inherited | false | false | false |
defaultversionid | resource | true | true | false |
isdefault | version | true | false | false |
user-extension | inherited | false | false | false |
xref | resource | false | false | false |
epoch | version | false | true | false |
self | both | true | true | false |
versionid | version | false | true | true |
Then when we talk about "export" we can say:
- All attributes with a
location
value ofboth
orresource
will appear on the Resource - All attributes with a
location
value ofboth
orversion
will appear on the Version
Basically, we skip version
attributes when exporting a Resource (i.e. don't show default Version attributes).
Are there other type of attributes I'm missing?
allow location=resource for administrative extensions (xref impls) to add, but not end-users since that would require code changes
Given the recent changes, I think we can reduce this down to:
location=resource|version
where the default value is version
to be clear, id
and self
will be version
because they appear on both.
Going with location=resource|version|both
Closing as we added "location" to the model