Unreleased documentation. These pages follow the main branch and can change before the next release. For supported guidance, use v0.15.2.
Connect an institution source from OpenAPI
For the assertion provider
If this is your first Evidence Gateway project, complete Get your first Evidence Gateway assertion before adapting an institution source. You will build one editable project from an institution’s OpenAPI document and use the same retained contract for source drafting and local execution. You do not assemble a deployment bundle or copy a reference deployment. If the authority publishes a snapshot instead of a live API, use Connect a published SQLite extract instead.
Before you start
Section titled “Before you start”You need an OpenAPI 3.0 or 3.1 document for an operation that performs one bounded lookup. The operation must let Evidence Gateway distinguish no match, one match, and several matches without paging through a registry.
Keep credentials, real responses, and personal data outside the tracked project. Use a sanitized response sample only when the OpenAPI document omits a bound that a reviewer can establish.
Create the authoring project
Section titled “Create the authoring project”Retain the OpenAPI document and create disposable local Evidence Gateway keys:
evidencectl new institution-evidence \ --openapi <institution.openapi.yaml> \ --profile localcd institution-evidenceThe project now contains the retained source.openapi.yaml and empty editable directories for
selectors, sources, adapters, schemas, questions, and derivations. The command does not
invent a source, question, fixture, or deployment policy.
Review the available source fields
Section titled “Review the available source fields”Inspect one operation without writing files:
evidencectl source suggest \ --openapi source.openapi.yaml \ --operation 'GET /people/{person_id}' \ --source-id people \ --select /date_of_birthUse one --select for each leaf needed to resolve source cardinality or derive the answer. A
selection through an array uses *, such as /results/*/date_of_birth. The assistant reports
which string, integer, and collection bounds came from OpenAPI and which still require review.
Write the source draft
Section titled “Write the source draft”Write the reviewed selection into the project. Omit --openapi: --project always reads the
retained source.openapi.yaml, so a later command cannot draft against a different contract.
evidencectl source suggest \ --project . \ --operation 'GET /people/{person_id}' \ --source-id people \ --select /date_of_birthThe command writes new files only:
sources/people.yamladapters/people-prepare.rhaiadapters/people-extract.rhaischemas/people-parameters.schema.yamlschemas/people-response.schema.yamlschemas/people-facts.schema.yamlsources/people.yaml is an ordinary Version 1 source object, not an intermediate template. The
schemas and scripts are the same artifacts the generated local bundle will contain. A repeated
command refuses to overwrite any edited file.
Define the authorized selector
Section titled “Define the authorized selector”Create selectors/person-reference-v1.yaml:
maximumAggregateBytes: 64fields: person_id: type: string minimumBytes: 1 maximumBytes: 64Then edit sources/people.yaml. Replace every review-required marker and bind the path parameter
to that selector profile:
transport: http-jsonbaseUrl: https://registry.example.composture: field-projectedauthentication: kind: basic usernameRef: secret:file/registry-username passwordRef: secret:file/registry-passwordrequest: method: GET pathTemplate: /people/{person_id} pathBindings: person_id: from: selector role: person profile: person-reference-v1 field: person_id fixedHeaders: - name: Accept value: application/json selectorInputs: - role: person alternatives: - profile: person-reference-v1 fields: [person_id] prepareScript: adapters/people-prepare.rhai adapterParameters: {} adapterParametersSchema: schemas/people-parameters.schema.yaml preparationLimits: query: allowed jsonBody: forbidden maximumNormalizedBytes: 4096 projection: [/date_of_birth] redirects: deny timeoutMilliseconds: 3000 maximumResponseBytes: 65536 concurrencyLimit: 8responseSchema: schemas/people-response.schema.yamlextractScript: adapters/people-extract.rhaifactSchema: schemas/people-facts.schema.yamlThe source owns its stable identity, authentication references, selector inputs, HTTP request,
projection, and source artifacts. Several questions can reference people; they do not duplicate
the source or its selector profile.
For fixed query inputs, put reviewed values in adapterParameters, close them in
people-parameters.schema.yaml, and render them in people-prepare.rhai. For selector-bound query
inputs, read only a field declared by selectorInputs. The script cannot access credentials,
caller identity, purpose, or signing keys.
Store the source credential
Section titled “Store the source credential”Create owner-only files without placing either credential in a command:
install -m 600 /dev/null secrets/registry-usernameinstall -m 600 /dev/null secrets/registry-passwordOpen each file in your editor and enter one credential value. secret:file/... values are logical
references resolved beneath the project’s owner-only secrets directory. Evidence Gateway does not read
credentials from the source YAML, a command argument, a request, or a log.
Finish extraction and facts
Section titled “Finish extraction and facts”Review schemas/people-response.schema.yaml against the institution contract. Keep the object
closed and retain only the selected fields. Then edit adapters/people-extract.rhai so zero,
one, conflicting, incomplete, and oversized results fail according to the reviewed source
semantics. Do not select the first array member as a shortcut.
Close schemas/people-facts.schema.yaml around only the facts the derivation receives. OpenAPI
describes transport shape. The institution still owns the combination rule that turns repeated
source values into one bounded fact or a bounded collection.
Add a question that uses the source
Section titled “Add a question that uses the source”Create questions/adult-status.yaml:
id: adult-statusquestion: Is the person at least 18 years old?purpose: age-checksubject: role: person selector: person_idsource: ref: peopleanswers: - concept: is_adult type: booleanderivation: derivations/adult-status.rhaidisclosure: allow: [is_adult]Create the named derivation. The function returns a map keyed by the declared concept alias:
fn answer(facts, selectors, context) { let born = parse_date(required(facts.date_of_birth, "date_of_birth_missing")); let adult_on = add_calendar_years(born, 18); #{is_adult: compare_dates(context.legal_local_date, adult_on) >= 0}}The question governs purpose, subject, concepts, derivation, and disclosure. The source governs
how Evidence Gateway obtains the fixed facts. This separation lets another question reuse people
without copying its transport or credential policy.
Run the authored project
Section titled “Run the authored project”Start the local Evidence Gateway and Registry Mint pair:
evidencectl dev --detachdev combines the referenced Version 1 source and selector objects with every authored question,
creates one private local generation, and runs the real evidence check gate before serving. A
missing artifact, unresolved draft marker, invalid secret reference, unbounded schema, or
inconsistent selector binding stops the generation.
Continue with Build and deploy an Evidence Gateway project after the project’s source, derivation, and synthetic acceptance cases have been independently reviewed.