Skip to content

Prototype extract schema#140

Merged
jnu merged 4 commits into
mainfrom
full-extract
Apr 14, 2026
Merged

Prototype extract schema#140
jnu merged 4 commits into
mainfrom
full-extract

Conversation

@jnu

@jnu jnu commented Feb 18, 2026

Copy link
Copy Markdown
Contributor

First draft extraction schema

Comment thread app/schema/openapi.yaml Outdated
Comment on lines +1186 to +1193
oneOf:
- $ref: "#/components/schemas/DocumentLink"
- $ref: "#/components/schemas/DocumentContent"
discriminator:
propertyName: attachmentType
mapping:
LINK: "#/components/schemas/DocumentLink"
BASE64: "#/components/schemas/DocumentContent"

This comment was marked as outdated.

Comment thread app/schema/openapi.yaml Outdated
Comment on lines +410 to +411
"201":
description: "Accepted"

This comment was marked as outdated.

Comment thread app/schema/openapi.yaml
$ref: "#/components/schemas/ExtractionAccepted"
callbacks:
extractionComplete:
'{$request.body#/documents/0/callbackUrl}':

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The OpenAPI callback definition only documents the callback for the first document in a multi-document request, contradicting the description that implies callbacks for all documents.
Severity: MEDIUM

Suggested Fix

Since OpenAPI 3.0 cannot express callbacks for each item in an array, either redesign the callback mechanism to use a single, top-level callbackUrl or update the description to clarify that only the first document's callback URL is officially documented and used.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: app/schema/openapi.yaml#L418

Potential issue: The OpenAPI callback definition for the `POST /extract` endpoint uses
the runtime expression `{$request.body#/documents/0/callbackUrl}`. This expression only
points to the callback URL of the first document in the request array. However, the API
accepts multiple documents and the description states, "This callback is made for each
input document". This creates a misleading specification, as OpenAPI 3.0 does not
support runtime expressions that iterate over an array, so callbacks for documents other
than the first are not documented.

Did we get this right? 👍 / 👎 to inform future reviews.

Comment thread app/schema/openapi.yaml
Comment on lines +1449 to +1452
referringOfficers:
type: array
items:
$ref: "#/components/schemas/ExtractedOfficer"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The OpenAPI schema incorrectly specifies a 201 Created response for callbacks. The implementation is permissive, but the specification should be corrected to 200 OK for semantic accuracy.
Severity: LOW

Suggested Fix

Update the OpenAPI schema in app/schema/openapi.yaml to expect a 200 OK response for the extractionComplete and redactionComplete callbacks instead of 201 Created. This aligns the documentation with industry best practices for webhook acknowledgments.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: app/schema/openapi.yaml#L1449-L1452

Potential issue: The OpenAPI schema for the `extractionComplete` callback specifies that
the expected response is HTTP `201 Created`. This is semantically incorrect for a
webhook acknowledgment; `200 OK` is the standard. The implementation in
`app/server/tasks/callback.py` uses `response.raise_for_status()`, which accepts any 2xx
status code, so this discrepancy has no functional impact. However, it represents a
documentation/specification issue that could mislead API clients.

@jnu jnu merged commit ffa72f1 into main Apr 14, 2026
5 checks passed
@jnu jnu deleted the full-extract branch April 14, 2026 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant