-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: standarize refs across all docs #199
Conversation
(missing is iconId in preset)
I'll review this soon. Could you fix the merge conflicts before I do? |
Regarding asserting correct reference types:
Maybe this is smth we don't need to do and we can be lean about it... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some initial feedback/thoughts on a quick read-through:
- A
versionId
is not a hex encoded string. We already have a proto def for this calledLink
. We encode it and decode it by hex-encoding the discovery key and joining with/
and the index. - Also change
Link
to use the same definition. - I think we should have a
ref
definition that does not include atype
, with the type implicit. Otherwise we are allowing for invalid refs. E.g. a preset can have afieldRefs
field, which can only be refs to fields, and don't need atype
. Right now the only place I think where we need atype
for refs is for translations. Since it's not an array, maybe we can just keep it as a separaterefType
field? I'm not sure about this one and would welcome Evan's thoughts. - Where possible, we should avoid calling this field
ref
orrefs
, and include a more descriptive name likefieldRefs
, to make it easier to understand. - For tracks, I think it's maybe ok to just say the refs are
observationRefs
. I think if we want to link other things to a track, we can do it as a separate field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should have a
ref
definition that does not include atype
, with the type implicit. Otherwise we are allowing for invalid refs. E.g. a preset can have afieldRefs
field, which can only be refs to fields, and don't need atype
. Right now the only place I think where we need atype
for refs is for translations. Since it's not an array, maybe we can just keep it as a separaterefType
field? I'm not sure about this one and would welcome Evan's thoughts.
I agree with this. I think it makes more sense to have two fields: fieldRefs
and iconRefs
, or observationRefs
.
That probably means removing RefType
from proto/ref/v1.proto
.
* update ref fields and use a more specific name * use ref.type only on translation * remove unnecessary checks * fix types and encode/decode * add checks for repeated fields
Following the feedback I:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM other than a few questions on tests.
Thanks for catching this. It was left from when |
should close #195
So, I tried to standarize references in docs by creating a
ref
protobuf and importing it in every document that needs it.For protobufs is useful that we can import, which I'm not doing in JSONSchema (I'm basically copy-pasting
ref
on documents that use it, changing only the description). This can became kinda hard to track (but not a huge issue). I know JSONSchema allows to reference other schemas but I know that we're not using that feature for i.e.Common
so there's probably a shortcoming I'm forgetting about.Besides
docId
andversionId
I addedtype
so that we can track which type of documents are referenced. This was already used in tracks and translations (throughschemaRef
, now removed). Regarding this, I think it may make sense to have runtime checks (i.e. tracks should only reference observations) instead of having differentref
types which only differ on the type of doc they reference