Skip to content

proposal: use +json postfix to mark json annotation values #50

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

Merged
merged 1 commit into from
May 7, 2025

Conversation

tarilabs
Copy link
Contributor

Hi,
I'm following up to what was presented yesterday call, with #44, #49

I'd like to propose a more explicit way to distinguish annotations that are holding a string-based-representation of a known format which is not a pure string scalar, in this case string-based-representation of a JSON object.

This stems from the fact that in OCI spec, Annotations are indeed key-value pair of str-str scalars only.
ref https://github.com/opencontainers/image-spec/blob/64294bd7a2bf2537e1a6a34d687caae70300b0c4/annotations.md?plain=1#L9

I think using a string representation of a structured JSON object in the value is more than fine,
but imho we can make it even more explicit beyond writing in the document:

value is the JSON string

ref https://github.com/CloudNativeAI/model-spec/blob/main/docs/annotations.md?plain=1#L11C84-L11C108

by using a conventional +suffix making it even prominent without referring to the doc itself.

wdyt?

Signed-off-by: tarilabs <matteo.mortari@gmail.com>
@caozhuozi
Copy link
Contributor

I also don’t like putting a struct into a plain string.

BTW, contributors from China are currently on holiday, so please expect some delays. ;-)

@tarilabs
Copy link
Contributor Author

tarilabs commented May 2, 2025

I also don’t like putting a struct into a plain string.

fair take.
However, this is not the goal of this PR :) this PR goal is to establish a good practice to enforce client/annotation "format" without having to rely solely on the document of the spec; thought I'd clarify that

BTW, contributors from China are currently on holiday, so please expect some delays. ;-)

no worries, thanks for the headsup! Happy also to discuss at the next community call

@caozhuozi
Copy link
Contributor

However, this is not the goal of this PR :) this PR goal is to establish a good practice to enforce client/annotation "format" without having to rely solely on the document of the spec;

Oh, the +json suffix actually helps! In my opinion, it makes the plain string much more acceptable.😂

Copy link
Contributor

@chlins chlins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@chlins
Copy link
Contributor

chlins commented May 6, 2025

@tarilabs Thanks, this change makes sense to me.

Copy link
Contributor

@gaius-qi gaius-qi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gaius-qi gaius-qi merged commit 224dcbc into CloudNativeAI:main May 7, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants