Skip to content

Commit

Permalink
Add metadata and documentation fields in service and handler definiti…
Browse files Browse the repository at this point in the history
…ons (#98)

Bump discovery protocol to V2
Reformat
  • Loading branch information
slinkydeveloper authored Nov 11, 2024
1 parent 9edfcd6 commit d07f035
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 7 deletions.
2 changes: 2 additions & 0 deletions dev/restate/service/discovery.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ enum ServiceDiscoveryProtocolVersion {
SERVICE_DISCOVERY_PROTOCOL_VERSION_UNSPECIFIED = 0;
// initial service discovery protocol version using endpoint_manifest_schema.json
V1 = 1;
// add custom metadata and documentation for services/handlers
V2 = 2;
}
57 changes: 50 additions & 7 deletions endpoint_manifest_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "Endpoint",
"description": "Restate endpoint manifest v1",
"description": "Restate endpoint manifest v2",
"properties": {
"protocolMode": {
"title": "ProtocolMode",
"enum": ["BIDI_STREAM", "REQUEST_RESPONSE"]
"enum": [
"BIDI_STREAM",
"REQUEST_RESPONSE"
]
},
"minProtocolVersion": {
"type": "integer",
Expand All @@ -31,9 +34,17 @@
"type": "string",
"pattern": "^([a-zA-Z]|_[a-zA-Z0-9])[a-zA-Z0-9._-]*$"
},
"documentation": {
"type": "string",
"description": "Documentation for this service definition. No format is enforced, but generally Markdown is assumed."
},
"ty": {
"title": "ServiceType",
"enum": ["VIRTUAL_OBJECT", "SERVICE", "WORKFLOW"]
"enum": [
"VIRTUAL_OBJECT",
"SERVICE",
"WORKFLOW"
]
},
"handlers": {
"type": "array",
Expand All @@ -45,9 +56,17 @@
"type": "string",
"pattern": "^([a-zA-Z]|_[a-zA-Z0-9])[a-zA-Z0-9_]*$"
},
"documentation": {
"type": "string",
"description": "Documentation for this handler definition. No format is enforced, but generally Markdown is assumed."
},
"ty": {
"title": "HandlerType",
"enum": ["WORKFLOW", "EXCLUSIVE", "SHARED"],
"enum": [
"WORKFLOW",
"EXCLUSIVE",
"SHARED"
],
"description": "If unspecified, defaults to EXCLUSIVE for Virtual Object or WORKFLOW for Workflows. This should be unset for Services."
},
"input": {
Expand Down Expand Up @@ -122,18 +141,42 @@
"setContentTypeIfEmpty": true
}
}
},
"metadata": {
"type": "object",
"description": "Custom metadata of this handler definition. This metadata is shown on the Admin API when querying the service/handler definition.",
"additionalProperties": {
"type": "string"
}
}
},
"required": ["name"],
"required": [
"name"
],
"additionalProperties": false
}
},
"metadata": {
"type": "object",
"description": "Custom metadata of this service definition. This metadata is shown on the Admin API when querying the service definition.",
"additionalProperties": {
"type": "string"
}
}
},
"required": ["name", "ty", "handlers"],
"required": [
"name",
"ty",
"handlers"
],
"additionalProperties": false
}
}
},
"required": ["minProtocolVersion", "maxProtocolVersion", "services"],
"required": [
"minProtocolVersion",
"maxProtocolVersion",
"services"
],
"additionalProperties": false
}

0 comments on commit d07f035

Please sign in to comment.