rea-reverse

List OpenAPI Endpoints Offline and Keep a Verifiable Snapshot

Written for REA 6.9.0Published by rea-reverseUpdated 6 min read
On this page

An openapi.json arrives with a release, and you need a list of the operations it declares. Opening Swagger UI is useful for browsing, but a review also needs a record of which document produced the list. Otherwise, a changed file can quietly change the answer between meetings.

REA 6.9.0 can read that JSON locally, record its SHA-256, and retain a method/path inventory that you can query later without reopening the specification. We tested this with the published Swagger Petstore document: 13 paths, 19 operations, and eight GET operations. No Petstore endpoints were called.

The result answers a narrow question: what does this document declare? It does not prove that an endpoint exists on a running server, accepts a request, or enforces authentication. That distinction becomes especially important when the file contains references.

Inventory OpenAPI operations offline and retain the evidenceSilent walkthrough with English captions.

Start with a document you can identify

Our run used REA 6.9.0, Node.js 26.12.1, Python 3.14, and macOS on Apple Silicon. REA requires Node ^22.23.4 || ^24.22.1 || >=26.12.1; an older Node 22 installation is insufficient. See the REA setup guide if the rea command is not available.

The input below is the original Petstore JSON retained in REA’s versioned fixture. It was retrieved from the running Swagger application on November 6, 2026. Using this fixed copy makes the walkthrough reproducible even if the application’s current definition changes. Its producer is swagger-api/swagger-petstore, licensed under Apache-2.0.

Create a fresh directory; later commands deliberately refuse to replace an existing evidence file.

mkdir openapi-review
cd openapi-review
curl -fL --output petstore.json \
  https://raw.githubusercontent.com/morluto/rea/rea-agents-6.9.0/tests/fixtures/openapi/petstore.json.txt
python3 - <<'PY'
import hashlib
from pathlib import Path
data = Path('petstore.json').read_bytes()
print(len(data))
print(hashlib.sha256(data).hexdigest())
PY

The downloaded file was 17,106 bytes. Its SHA-256 was:

00441c05add60f28da55eb4563d3fb6bbda364ba8eb7b381e2e2c98613005c82

That digest identifies the bytes being reviewed, rather than merely a URL or an API version label. Keep the original file alongside the results. An evidence bundle retains interpreted facts; it does not contain a recoverable copy of the full source JSON.

Count operations, not just paths

rea inspect-api-contract petstore.json --format json > complete.json
python3 - <<'PY'
import json
result = json.load(open('complete.json'))['normalized_result']
print(result['openapi'], result['info']['version'])
print(result['summary'])
for row in result['operations']:
    print(row['method'], row['path'], row['declared_id'])
PY

The document declares OpenAPI 3.0.4 and application version 1.0.27. REA reported 19 operation slots, all 19 declared, with zero unknown operations, unresolved Path Items, or diagnostics. That is more than the 13 paths because a path can have several methods. /pet/{petId}, for example, declares GET, POST, and DELETE.

Each operation records its method, path, original operationId as declared_id, and a source_pointer. The GET operation for /pet/findByStatus points to /paths/~1pet~1findByStatus/get. JSON Pointer escapes a slash inside a key as ~1, so this locates the original declaration rather than constructing a request URL.

There are also two generated identities. operation_id identifies a declaration within its artifact; operation_key represents the exact method/path spelling. Neither replaces a source comparison when a route is renamed, nor proves that two differently named operations behave the same. REA preserves operationId values without assuming they are unique.

Check source_coverage before interpreting an apparently clean count. Here it was complete-within-scope, with scope inline-path-operations. The same object explicitly said reference_resolution: not-attempted and schema_validation: not-performed. Zero diagnostics is therefore not an OpenAPI conformance certificate. Request schemas, responses, security declarations, callbacks, and webhooks are outside this inventory.

Save the full inventory while asking for a small page

For a review focused on read operations, request GET declarations and keep the complete result in a separate bundle:

rea inspect-api-contract petstore.json --detail summary \
  --view '{"kind":"api-contract","collection":"operations","methods":["GET"],"limit":3}' \
  --evidence_output petstore.evidence.json --format json > get-page-1.json
python3 - <<'PY'
import json
result = json.load(open('get-page-1.json'))['summary']['normalized_result']
print(result['coverage'])
for row in result['items']:
    print(row['method'], row['path'])
PY

The first page contained /pet/findByStatus, /pet/findByTags, and /pet/{petId}. Its coverage reported examined: 3, total: 8, next_offset: 3, and exhausted: false. The total is eight GET declarations, not the document’s 19 operations. Filtering a reply does not discard the other methods from the saved bundle.

The CLI needs both --detail summary and --evidence_output when using --view. This pairing gives you a small answer now and the complete evidence for later. It also avoids treating a model’s response-size limit as a reason to omit the rest of the inventory.

Continue the review after the source has moved

The next request selects the parent inventory’s evidence ID dynamically. Do not copy an ID from this article: use the one returned by your own run. The first-page summary has its own evidence ID, while the full inventory’s ID lives under summary.normalized_result.parent_evidence_id.

python3 - <<'PY'
import json
result = json.load(open('get-page-1.json'))['summary']['normalized_result']
request = {
    'source': {
        'kind': 'retained-evidence',
        'evidence_id': result['parent_evidence_id']
    },
    'view': {
        'kind': 'api-contract', 'collection': 'operations',
        'methods': ['GET'], 'offset': 3, 'limit': 3
    }
}
with open('get-page-2.request.json', 'w') as output:
    json.dump(request, output, indent=2)
PY
mv petstore.json petstore.source-held.json
rea inspect-analysis-view get-page-2.request.json \
  --evidence-bundle petstore.evidence.json --format json > get-page-2.json
python3 - <<'PY'
import json
result = json.load(open('get-page-2.json'))['normalized_result']
print(result['coverage'])
for row in result['items']:
    print(row['method'], row['path'])
PY

Although petstore.json no longer existed at its original path, the query succeeded. Page two contained /store/inventory, /store/order/{orderId}, and /user/login, with next_offset: 6. We then queried offset six and received /user/logout and /user/{username}: two rows, exhausted: true, and no next offset.

To reproduce that final page, keep the source selection and change only the offset:

python3 - <<'PY'
import json
request = json.load(open('get-page-2.request.json'))
request['view']['offset'] = 6
with open('get-page-3.request.json', 'w') as output:
    json.dump(request, output, indent=2)
PY
rea inspect-analysis-view get-page-3.request.json \
  --evidence-bundle petstore.evidence.json --format json > get-page-3.json

The artifact path recorded in those pages still names the original snapshot. That is provenance, not evidence that REA reopened the file. The bundle is what makes the retained query possible. Preserve it together with the original JSON, REA version, and review notes when handing the work to another person.

Make an unresolved reference visible

A large specification may spread Path Items across files. Counting only the inline methods and ignoring references would make an incomplete list look complete. REA instead reports uncertainty.

We made one controlled copy of Petstore and added a Path Item $ref beside the existing GET declaration:

python3 - <<'PY'
import json
document = json.load(open('petstore.source-held.json'))
document['paths']['/pet/findByStatus']['$ref'] = (
    'http://127.0.0.1:48763/paths.json#/findByStatus'
)
with open('petstore-reference.json', 'w') as output:
    json.dump(document, output, indent=2)
    output.write('\n')
PY
rea inspect-api-contract petstore-reference.json --format json > reference.json
python3 - <<'PY'
import json
result = json.load(open('reference.json'))['normalized_result']
print(result['summary'])
print(result['source_coverage']['status'])
for row in result['operations']:
    if row['path'] == '/pet/findByStatus':
        print(row['state'], row['reason'])
PY

The result changed to 18 declared operations, one unknown operation, and one unresolved Path Item. Coverage became partial. The adjacent GET row remained present but its state was unknown, with reason unresolved-path-item-reference. REA did not assume that the inline definition overrode whatever the reference might supply.

This was an intentionally modified document, not a claim that Petstore ships a broken reference. In a separate repeat, we listened on that loopback port during inspection and received zero HTTP requests. The documented importer does not resolve references, including local fragments. Fixing the server or putting the referenced document next to the JSON will not make this version resolve it. Use a suitable OpenAPI resolver/validator in a separate step if the review needs an expanded, validated contract, and keep its output distinct from REA’s original-document inventory.

What to keep, and what to check elsewhere

One failure was useful: repeating the summary command with the same bundle path exited with Evidence file already exists. Choose another output path. Choose a fresh filename for a new run. Reusing an old bundle while reading a new specification is exactly the mix-up this workflow should prevent.

REA 6.9.0 accepts local OpenAPI 3.0, 3.1, and 3.2 JSON. A YAML specification needs conversion before this command; retain the original YAML and identify the converted JSON separately. The file allowance is 32 MiB by default, with a separate allowance for expanded facts. A smaller reply page reduces transport size, not the work or memory needed for the initial parse.

For a handoff, retain the original document, its digest, the full evidence bundle, and any selected requests/results that explain a decision. For an authorization review, return to the actual security declarations and implementation: this command does not analyze them. For observed requests and responses, the HAR inspection guide covers a different source of evidence. A declared route, a captured request, and a successful authorized request are three different observations.

The version-specific behavior described here is documented in REA 6.9.0’s API contract guide, alongside the 6.9.0 release. When you repeat the workflow with another release, check that guide and the command’s help again. In particular, adding reference resolution or schema validation would change what a complete inventory means. A stored result remains evidence of the older run; installing a newer REA does not retroactively fill its unknown rows.