-
Notifications
You must be signed in to change notification settings - Fork 343
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
CIP-0068 | Improve image types and URI descriptions #562
Conversation
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 don't work on these implementations but this looks to me like it clarifies the use of URIs & images and I think it would be an improvement. As soon as we can agree on whether or not a version bump for 222
and 444
is needed I'm happy to sign off on this.
PS: Not sure how to avoid the duplication of information in each label.
The only portable way I know of would be to put it in a separate file... but people would expect that for a schema and not for written text.
- Maybe someday it will work better as a schema?
- Could there be any schema format that's even somewhat as human readable as what's there now?
It would also be nice to link to related information in CIP25 about URIs and data URLs but not sure how.
As it stands now, not even section anchored links (e.g. #Abstract
) between CIPs are portable. Since line numbers will also change, I think the only approach now is to refer to statements in other CIPs literally (e.g. see CIP-XXXX > Heading > Subheading > quote).
This deficiency has been around since #109 and first we are trying to fix the raw text of all CIPs via #389 before someone can really work on better scripts for the web sites derived from GitHub source.
@SmaugPool you have my ✔️ on this if we can find developers commenting here who say unanimously that we don't need a version bump because the dropped parameter. Otherwise I think we could sign off on it right away if you add the version bumps.
The editors have agreed to be cautious here to avoid having to do something like #523 again in a hurry (amazingly this PR is still not merged; so any bumps here would have to be done relative to those bumps 😜). cc @KtorZ @Ryun1 @mmahut
metadata = | ||
{ | ||
name : bounded_bytes, ; UTF-8 | ||
image : bounded_bytes, ; UTF-8 | ||
? mediaType : bounded_bytes, ; UTF-8 |
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.
(potentially requiring version bump to 2 or 3)
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.
Agreed!
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.
image
is not removed, and mediaType
was optional, so I'm not sure of the benefit of bumping the version?
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.
Because officially now including a mediaType
would be erroneous, while it wouldn't have been an error before whether it was missing or present. How such an error would be handled I believe would depend upon the implementor: so we would be giving them that option by bumping the version. See problem reported in #520.
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.
It would not be erroneous because additional properties are allowed:
; ... Additional properties are allowed
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.
thanks @SmaugPool - I missed that! 🤓 @Ryun1 we can talk about any other reasons why we might need the version bump @ the CIP meeting today, but it seems like we are OK without one (cc @KtorZ).
I'm not sure I understand the rationale to remove an optional top-level mediaType. If anything, I believe it would be more helpful to refine and iterate the version of the standard passing in a well-formed object for all files such as:
We cannot write standards with the expectation that we will have to make exceptions because people will incorrectly implement the standards. We should write standards in such a way that if it is followed correctly, all the relevant and pertinent information a user might need will be where they expect it to be for ease of integration.
I think it makes sense that the standard should define which URI schemes should be supported. There are other schemes (ftp:, network:, etc) that would pass validation as a "valid URI" but would most likely break all integrations due to lack of support. |
The rationale is that I'm aware of 0 use case where it has been useful, and that's because it's already constrained to Therefore I think we should either remove it or make it mandatory. Browsers and most image viewers are able to detect most image types, so I'm not sure it's really useful to make it mandatory as long as only images are supported. If we worry about exotic image formats and think it could be useful in this case, an alternative could be to list explicitly supported image formats. Admittedly I may be biased by my own experience, so if anyone is aware of a single real-world use case where it has proved useful, please share 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.
I believe the question of versioning (i.e. not strictly required) has been answered in #562 (comment) ... the guideline ... Additional properties are allowed
effectively makes any property OK to use, so I now fully see @SmaugPool's point that having a property in this short list strongly encourages its use and, according to the OP's argument, its misuse.
So the remaining question as per #562 (comment) is whether that misuse should be addressed here in this PR:
- This could be out of scope for this PR, but it would really be confusing to delete this property and then have to reintroduce it later to add a more rigorous definition as @Crypto2099 suggests above. That would be item # 2 to discuss at the CIP editors' meeting today.
- Item # 1 will still be to call for any other motivation for bumping the version number (in my opinion we are OK without it but we need to be sure).
The definition question is beyond my technical scope as a reviewer so in the meantime I'm approving it here and will leave further reviews to reflect practical experience about current & potential use cases of mediaType
.
Note that my initial motivation to clarify the image Without this important restriction and with the field being optional, any file type could theoretically be linked from (Note: I have updated the patch to clarify the image media type restrictions for 222, 333 and 444). |
@SmaugPool at the CIP editors' meeting today we resolved for @Crypto2099 to re-review based on your last changes & if this does clarify the issue (as we expect) then we can merge this. |
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.
Aside from the couple of points, particularly surrounding cross-compatibility with the Token Registry standard, I believe that this PR is acceptable to be merged as-is. Given that we are dropping an optional field that is also covered by the fact that any and all additional properties are accepted as part of the existing object, I do not believe that a version iteration is needed to implement these changes and these edits provide greater clarity to the existing standard rather than fundamentally modifying it.
? url: bounded_bytes, ; UTF-8 | ||
? logo: uri, | ||
? decimals: int | ||
|
||
; 'logo' does not follow the explanation of the token-registry, it needs to be a valid URI and not a plain bytestring. | ||
; The logo URI must point to a resource with media type (mime type) `image/png`, `image/jpeg` or `image/svg+xml`. | ||
? logo: uri, |
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.
In this section I believe we should keep the naming convention consistent with the Cardano Token Registry to ensure minimal disruption when moving between one standard or the other. Perhaps it is better to move this comment out of the CDDL and use a separate "logo-uri" object that explicitly declares that there is NOT support for data: scheme URIs.
; A valid Uniform Resource Identifier (URI) as a UTF-8 encoded bytestring. | ||
; The URI scheme must be one of `https` (HTTP), `ipfs` (IPFS), `ar` (Arweave) or `data` (on-chain). | ||
; Data URLs (on-chain data) must comply to RFC2397. | ||
uri = bounded_bytes ; UTF-8 |
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.
Drop mention of support for the data: scheme when working with fungible token logo-uri field to be compatible and match the CIP-26 formatting of the Token Registry.
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.
Point of clarification cause I may have misunderstood here, the token registry stores the image in ONLY data: format by default and that is actually an acceptable URI in this case but we just want it to be a "plain text" URI rather than a raw bytestring?
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 this part was written by @alessandrokonrad & @AndrewWestberg, maybe they can clarify as I believe I just moved things around.
In the token registry, images are base64 encoded PNGs, they are not data URLs, but I think data urls are valid here.
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.
@alessandrokonrad can comment on this. My addition was only to add 444 which is a copy paste of parts of 222 and 333.
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.
Seems like a case of "reality that has caught up with the specs", and the clarification seems fair 👍
mediaType
in 222 & 444 for the following reasons:video/...
ormodel/...
media (mime) type forimage
URI, ignoring theimage/*
constraint (I will propose to remove it too in CIP25 if this is accepted here)ar://
) in the list of supported URI schemes. I wonder though if the CIP should have such a hard list of supported schemes or just suggestions?PS: Not sure how to avoid the duplication of information in each label. It would also be nice to link to related information in CIP25 about URIs and data URLs but not sure how.