You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we hash the content (and references) to get an artifact hash (aka "contentHash"). If YAML content is uploaded, we convert it to JSON before storing it and validating it and everything else. Right now we hash the content after converting it from YAML to JSON. But that's not what we should be doing - we should hash it before the conversion. The point of the hash is to have an ID that can be calculated by the user before registration. For that we need to hash the original content.
Registry Version: 2.4.x Persistence type: All
The text was updated successfully, but these errors were encountered:
I do agree with this analysis, but the proposed resolution is probably going to make things more inconsistent.
Let me try to explain:
upload some yaml content
the hash is calculated on the original content but the stored file is something different
it becomes impossible to obtain the content back and verify the content hash against it
Possibly, the only way to achieve the expected semantic is to just handle yaml as a first-class citizen and avoid any manipulation of the user content (translations are almost always lossy on edge cases).
The is done in 3.0 - the content type of the content is now required when creating artifacts and versions. If the content is YAML we now keep it as YAML. Any code that parses the content must obey the content type (parse YAML or JSON accordingly). This only works for OpenAPI and AsyncAPI types, because those are the only two types that commonly support both YAML and JSON formats.
Description
Currently we hash the content (and references) to get an artifact hash (aka "contentHash"). If YAML content is uploaded, we convert it to JSON before storing it and validating it and everything else. Right now we hash the content after converting it from YAML to JSON. But that's not what we should be doing - we should hash it before the conversion. The point of the hash is to have an ID that can be calculated by the user before registration. For that we need to hash the original content.
Registry Version: 2.4.x
Persistence type: All
The text was updated successfully, but these errors were encountered: