Skip to content

Proposal: Add support for JSONPath where JSON Pointer is supported #366

@char0n

Description

@char0n

Specifically in situations documented at https://spec.openapis.org/arazzo/v1.0.1.html#examples table.

Image

By JSONPath, I specifically refer to RFC 9535. There is no semantic overlap between JSONPath and JSON Pointer so adding a support for JSONPath WILL NOT create ambiguity as we can clearly distinguish the grammars for both of them.

Here is a concrete example where having JSONPath support would allow describing workflows that we cannot currently describe.

Let's say we have a step called search-businesses. This step exposes the matched business on $steps.search-businesses.outputs.businesses.

Now I want to have another step called get-businesses-details which accepts list of business ids. If we would supported JSONPaths, we could do the following:

{
  "name": "business_ids",
  "in": "query",
  "value": "$steps.search-businesses.outputs.businesses#$[*].id"
}

With current capabilities it's not possible to chain steps like these, unless we introduce a surrogate transformation step into the workflow.


I can challenge this proposal and issue a PR to the spec. We have two options how to proceed forward.

Backward compatible

We can introduce new separator for JSONPath:

$steps.search-businesses.outputs.businesses@$[*].id - this clearly says that @ is followed by JSONPath and existing implementations will ignore it as they will not recognize @ after the runtime expression.

Backward incompatible

$steps.search-businesses.outputs.businesses#$[*].id - JSONPath uses the same separator (#) as JSON Pointer and because of no semantic overlap between JSONPath and JSON Pointer exists, implementation could clearly distinguish the intention. It will break the implementations that only expects JSON Pointer after # delimiter. Major release of the spec might be warranted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions