A discovery document says where each route is
The specification names routes, never paths. A client finds the path of every route a rule defines in one document the implementation publishes, so a client that drives several implementations copies none of their URL spaces.
The rule
- An implementation MUST publish a discovery document.
- The document MUST be a JSON object, served with the media type
application/jsonas the whole body of the answer to aGETrequest. - It departs from the
{success, data}envelope other answers carry because it is not the result of an operation: a client reads it before it knows any route, as it reads other well-known metadata documents, and it has no refusal of its own to tell apart from a result. - The document MUST be served to a request that carries no credentials.
- An implementation MUST serve it at the path
/.well-known/flowdropon its origin, unless it cannot serve that path, as when it is mounted under a sub-path or is one of several on one origin. - Such an implementation MUST instead give its clients the document's URL directly.
- A client MUST accept a configured discovery URL.
- A client with no configured URL MUST request the default path.
- The document MUST carry
endpoints, an object mapping route names to URI templates. - Each template MUST be a path-absolute URI template of level 1, and MUST NOT carry a query component.
- A client MUST resolve an expanded template against the discovery document's URL, which is the URL the client requested.
- A client MUST NOT follow a redirect of the discovery request to another origin.
- An identifier an implementation issues for a route variable MUST NOT be
.or... - A client MUST refuse to expand a template with either value, because level-1 expansion leaves both unencoded and resolution removes them as dot-segments, so the request would reach another path.
- A route the implementation does not serve MUST have no key in
endpoints. - A route name fixes the route's HTTP method and its template variables.
- A template MUST use every variable its route name lists, and no other.
- The route names, each with its method, its variables and the rules that define the route, are these.
- Workflows:
workflows(GET, no variables; STORE-15, API-5, API-6),workflow_create(POST, no variables; STORE-2, STORE-3, STORE-4, STORE-5),workflow(GET,workflow_id; STORE-14),workflow_update(PUT,workflow_id; STORE-2, STORE-4, STORE-5),workflow_import(POST, no variables; STORE-9),workflow_schema(GET,workflow_id; MAN-5, META-4, META-5, META-7) andcategories(GET, no variables; META-1). - Sessions:
workflow_sessions(GET,workflow_id; PLAY-1, PLAY-5),session_create(POST,workflow_id; PLAY-2),session(GET,session_id; PLAY-2),session_turn(POST,session_id; API-2, API-3),session_messages(GET,session_id; PLAY-3, PLAY-4), andsession_messageandsession_message_status(GET,session_idandmessage_id; PLAY-4). - Runs:
workflow_run(POST,workflow_id; MAN-13, MAN-15, VAL-LAUNCH, API-10),workflow_pipelines(GET,workflow_id; API-12),pipelineandpipeline_status(GET,pipeline_id; PIPE-1),pipeline_jobsandpipeline_job_status(GET,pipeline_id; PIPE-5),pipeline_logs(GET,pipeline_id; no rule yet defines its answer),job(GET,job_id; PIPE-5, PIPE-7), andpipeline_cancel,pipeline_pauseandpipeline_resume(POST,pipeline_id; INT-16). - Interrupts:
interrupt_resolve(POST,interrupt_id; INT-3),interrupt_callback(POST,interrupt_id; INT-19) andinterrupt_cancel(POST,interrupt_id; INT-24). - Snapshots:
snapshots(GET, no variables; SNAP-1, SNAP-2),snapshot(GET,execution_id; SNAP-1, SNAP-2),snapshot_save(POST, no variables; SNAP-1) andsnapshot_delete(DELETE,execution_id; SNAP-1, SNAP-2). - A query parameter a rule defines is added by the client as that rule says.
- Other rules define further members of the document.
- The document MUST be the same for every caller.
- It MUST NOT carry tenant data, credentials or the implementation's software version.
- Listing a route in the document MUST NOT change how that route is authorised.
- A client MUST NOT send a request to a template that is not path-absolute, or whose resolved URL lies outside the discovery document's origin.
What it means
The rules talk about routes by what they do: the launch, a run's status document,
the signal API, the callback route. None of them says where a route lives, and none
should, because an implementation's URL space is its own. What a client that drives
several implementations needs is a way to ask each one. That is this document: one
GET, and every route the client may call comes back as a name and a template.
A route name carries more than a path. It fixes the method, and it fixes the names
of the template's variables, so a client that knows pipeline_cancel knows it is a
POST and that it fills in {pipeline_id}. What the route answers is still the
business of the rules that define it; the document only says where to send the
request. A route that is missing from endpoints is a route the implementation does
not serve, which a client learns without trying it.
Templates are level 1 and path-absolute, which keeps them safe to expand, with one
exception the rule closes. Level 1 percent-encodes every character outside the
unreserved set, so an identifier holding a / cannot add a path segment. But .
and .. are made only of unreserved characters, so they pass unencoded, and
resolving the expanded URL removes them as dot-segments: snapshot_delete expanded
with .. would send a DELETE one level up from the snapshot. So no identifier is
ever . or .., and a client refuses to expand a template with either. Path-absolute means the template starts with a single
/ and is resolved against the discovery URL, so it stays on that origin. A client
still refuses a template that would leave it: a document that pointed a route at
another host would make the client send its credentials there.
The URL templates resolve against is the one the client asked for. A redirect of the discovery request to another origin is not followed: the document it led to could point every route at that origin, which is exactly what the origin check is there to stop.
/.well-known/flowdrop is the default, not the only place. An implementation
mounted under a sub-path, or one of several sharing an origin, cannot own that path,
so it hands its clients the discovery URL instead, and every client accepts one.
Templates resolve against whichever URL the document was read from, so the same
document works in both cases.
The document is the same for every caller and carries nothing about any of them: no
tenant data, no credentials, no software version. Since it holds nothing secret, it
is served without asking who is calling; a client can read it before it has signed
in to anything. It is a plain application/json object rather than an answer in the
{success, data} envelope: it is not the result of an operation that could be
refused, and a well-known metadata document is read as the document itself. It is a map, not a gate; whether
a caller may use a route is decided by that route, exactly as if the map did not
exist. Other rules add members of their own where a client needs to know a
capability before it calls a route.
Example
GET /.well-known/flowdrop
{"endpoints": {
"workflow_run": "/api/flowdrop/workflow/{workflow_id}/run",
"workflow_pipelines": "/api/flowdrop/workflow/{workflow_id}/pipelines",
"pipeline": "/api/flowdrop/pipeline/{pipeline_id}",
"pipeline_status": "/api/flowdrop/pipeline/{pipeline_id}/status",
"pipeline_cancel": "/api/flowdrop/pipeline/{pipeline_id}/cancel",
"interrupt_callback": "/api/flowdrop/interrupts/{interrupt_id}/callback"
}}This implementation serves no snapshot routes and no log route, so those keys are
absent. A client that wants to cancel run 4711 expands pipeline_cancel to
/api/flowdrop/pipeline/4711/cancel, resolves it against the discovery URL, and
sends a POST.
{"endpoints": {"pipeline": "//elsewhere.example/pipeline/{pipeline_id}"}}That template is not path-absolute: resolved, it names another host.
Every path shown on the other pages of this specification is an example of the
route it names, never a requirement. Every route a rule defines has a name, grouped
by what it serves: workflows, sessions, runs, interrupts and snapshots.
pipeline_logs is the one name whose answer no rule defines yet. It is kept because
a name only says where a route is, and a client that shows a run's log can find it
on any implementation; a rule that defines the log's answer can follow without
renaming anything.
Why
Recorded under OPEN-51.
References
Normative: incorporated into this rule
- RFC 8615Well-Known Uniform Resource Identifiers (URIs)The
/.well-known/path prefix and its meaning, which the document's default location uses. - RFC 6570URI TemplateThe template syntax and level 1 (simple string expansion), which percent-encodes every character outside the unreserved set, so a value holding
/cannot add a path segment..and..are made of unreserved characters and pass unencoded, which is why the rule forbids them as values. - RFC 3986Uniform Resource Identifier (URI): Generic SyntaxWhat path-absolute means (section 3.3), how a reference is resolved against a base URL (section 5), and how resolution removes the dot-segments
.and..(section 5.2.4).