Skip to content
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: add optional lastModified timestamp to Annotated #140

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions schema/draft/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
},
"type": "array"
},
"lastModified": {
"description": "The timestamp when the resource was last modified.\nExamples: last activity timestamp in an open file, timestamp when resource is attached, etc.\n\nShould be an ISO 8601 formatted string (e.g., \"2025-01-12T15:00:58Z\").",
"format": "date-time",
"type": "string"
},
"priority": {
"description": "Describes how important this data is for operating the server.\n\nA value of 1 means \"most important,\" and indicates that the data is\neffectively required, while 0 means \"least important,\" and indicates that\nthe data is entirely optional.",
"maximum": 1,
Expand All @@ -37,6 +42,11 @@
},
"type": "array"
},
"lastModified": {
"description": "The timestamp when the resource was last modified.\nExamples: last activity timestamp in an open file, timestamp when resource is attached, etc.\n\nShould be an ISO 8601 formatted string (e.g., \"2025-01-12T15:00:58Z\").",
"format": "date-time",
"type": "string"
},
"priority": {
"description": "Describes how important this data is for operating the server.\n\nA value of 1 means \"most important,\" and indicates that the data is\neffectively required, while 0 means \"least important,\" and indicates that\nthe data is entirely optional.",
"maximum": 1,
Expand Down Expand Up @@ -495,6 +505,11 @@
},
"type": "array"
},
"lastModified": {
"description": "The timestamp when the resource was last modified.\nExamples: last activity timestamp in an open file, timestamp when resource is attached, etc.\n\nShould be an ISO 8601 formatted string (e.g., \"2025-01-12T15:00:58Z\").",
"format": "date-time",
"type": "string"
},
"priority": {
"description": "Describes how important this data is for operating the server.\n\nA value of 1 means \"most important,\" and indicates that the data is\neffectively required, while 0 means \"least important,\" and indicates that\nthe data is entirely optional.",
"maximum": 1,
Expand Down Expand Up @@ -597,6 +612,11 @@
},
"type": "array"
},
"lastModified": {
"description": "The timestamp when the resource was last modified.\nExamples: last activity timestamp in an open file, timestamp when resource is attached, etc.\n\nShould be an ISO 8601 formatted string (e.g., \"2025-01-12T15:00:58Z\").",
"format": "date-time",
"type": "string"
},
"priority": {
"description": "Describes how important this data is for operating the server.\n\nA value of 1 means \"most important,\" and indicates that the data is\neffectively required, while 0 means \"least important,\" and indicates that\nthe data is entirely optional.",
"maximum": 1,
Expand Down Expand Up @@ -1532,6 +1552,11 @@
},
"type": "array"
},
"lastModified": {
"description": "The timestamp when the resource was last modified.\nExamples: last activity timestamp in an open file, timestamp when resource is attached, etc.\n\nShould be an ISO 8601 formatted string (e.g., \"2025-01-12T15:00:58Z\").",
"format": "date-time",
"type": "string"
},
"priority": {
"description": "Describes how important this data is for operating the server.\n\nA value of 1 means \"most important,\" and indicates that the data is\neffectively required, while 0 means \"least important,\" and indicates that\nthe data is entirely optional.",
"maximum": 1,
Expand Down Expand Up @@ -1638,6 +1663,11 @@
},
"type": "array"
},
"lastModified": {
"description": "The timestamp when the resource was last modified.\nExamples: last activity timestamp in an open file, timestamp when resource is attached, etc.\n\nShould be an ISO 8601 formatted string (e.g., \"2025-01-12T15:00:58Z\").",
"format": "date-time",
"type": "string"
},
"priority": {
"description": "Describes how important this data is for operating the server.\n\nA value of 1 means \"most important,\" and indicates that the data is\neffectively required, while 0 means \"least important,\" and indicates that\nthe data is entirely optional.",
"maximum": 1,
Expand Down Expand Up @@ -1974,6 +2004,11 @@
},
"type": "array"
},
"lastModified": {
"description": "The timestamp when the resource was last modified.\nExamples: last activity timestamp in an open file, timestamp when resource is attached, etc.\n\nShould be an ISO 8601 formatted string (e.g., \"2025-01-12T15:00:58Z\").",
"format": "date-time",
"type": "string"
},
"priority": {
"description": "Describes how important this data is for operating the server.\n\nA value of 1 means \"most important,\" and indicates that the data is\neffectively required, while 0 means \"least important,\" and indicates that\nthe data is entirely optional.",
"maximum": 1,
Expand Down
8 changes: 8 additions & 0 deletions schema/draft/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,14 @@ export interface Annotated {
* @maximum 1
*/
priority?: number;

/**
* The timestamp when the resource was last modified.
* Examples: last activity timestamp in an open file, timestamp when resource is attached, etc.
*
* Should be an ISO 8601 formatted string (e.g., "2025-01-12T15:00:58Z").
*/
lastModified?: Date;
Copy link
Member

Choose a reason for hiding this comment

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

I like the idea. While this is usually the most intuitive way to express a point in time. However, I assume a client application will want to use this for comparison of the resource has changed. Notable ISO 8601 are not guarantee to be monotonically increasing. The following issues can appear:

  • Leap Seconds
  • Clock Adjustment
  • Daylight Savings
  • Clock Drift or Time Sync issues between client and server (particularly in a remote scenario)

There are a few ways to go about this:

  • We can include more metadata (e,g, rsync uses size + mtime, git uses mtime + hashes) and use unix timestamps, to make educated guesses.
  • We can enforce a monotonically increasing time, e.g. the watchman uses a random "point in time" stamp, that will always increase. It doesn't have to represent time, but for example things like "since the system started'.
  • We can define lastModified to be purely informational and must not be used for comparision

Open to any suggestions. THrowing it back to you. If it's intended to be purely informational, I am happy to accept as is.

Copy link
Member

Choose a reason for hiding this comment

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

FWIW, unix timestamps + some additional information might be proibably the easiest.

}
}

Expand Down