Skip to content

Fix DTS endpoints to pass schemathesis tests - #379

Open
cmil wants to merge 1 commit into
mainfrom
328-schemathesis-upgrade-dts-fixes
Open

Fix DTS endpoints to pass schemathesis tests#379
cmil wants to merge 1 commit into
mainfrom
328-schemathesis-upgrade-dts-fixes

Conversation

@cmil

@cmil cmil commented Jul 12, 2026

Copy link
Copy Markdown
Member

Stacked on top of #370. This branch restores the DTS-specific fixes that were removed from #370 while it was refocused on the schemathesis upgrade alone.

Summary

  • modules/dts.xqm — server-side leniency fixes for /dts/collection, /dts/document, and /dts/navigation so schema-compliant requests are no longer rejected with 400/500:
    • ddts:collections validates the nav parameter (400 for values other than parents).
    • local:corpus-or-play-collection-by-id returns 404 instead of 400 when the id does not identify a known collection.
    • local:child-readable-collection-with-parent-by-id returns 404 when the play id is unknown, replacing the previous 500 cardinality error.
    • ddts:document and ddts:navigation treat ref as taking precedence over start/end, silently ignore incomplete start/end ranges, and default navigation to down=1 when no navigation parameter is provided.
  • api.yamlminLength: 1 on the resource parameter of /dts/navigation and /dts/document; tightened description of the /dts/collection id parameter.

These fixes are conservative leniency patches meant to keep the current implementation passing the schemathesis suite until we update the implementation to comply with DTS version 1.0. They should be reviewed as an interim measure.

These DTS-specific fixes were removed from #370:

- api.yaml: minLength: 1 on the resource parameter of /dts/navigation
  and /dts/document; clarify the /dts/collection id parameter description
  (now collection-only, since no document is returned by this endpoint).
- modules/dts.xqm:
  - ddts:collections: validate the nav parameter, reject anything other
    than 'parents' with 400.
  - local:corpus-or-play-collection-by-id: return 404 instead of 400 for
    an unknown id (a valid-format id that does not identify a collection).
  - local:child-readable-collection-with-parent-by-id: return 404 when
    the play id does not exist in the database, instead of a 500
    cardinality error.
  - ddts:document and ddts:navigation: treat ref as taking precedence
    over start/end; ignore incomplete ranges (only one of start/end
    provided); default navigation to down=1 when no navigation parameter
    is specified. Removes the ref+start+end 400 branch, which is now
    handled by the precedence rule.
@github-actions

github-actions Bot commented Jul 12, 2026

Copy link
Copy Markdown

Merging this PR will leave 7 of 36 operations untested. Please review.

❌ 7 untested
🔴 6 partial
✅ 23 tested

Operations  ████████████████░░░░  29/36    81%
Parameters  █████████████░░░░░░░  47/70    67%
Keywords    ████████████░░░░░░░░  54/89    61%
Responses   ████████░░░░░░░░░░░░  31/77    40%
Examples    ████████████████████    4/4   100%

❌ Untested (7)

Method Path Parameters Keywords Responses Examples
DELETE /exist/restxq/v1/corpora/{corpusname} 0/1 0/1 0/2 0/0
DELETE /exist/restxq/v1/corpora/{corpusname}/plays/{playname} 0/2 0/2 0/2 0/0
POST /exist/restxq/v1/corpora 0/2 0/8 0/3 0/0
POST /exist/restxq/v1/corpora/{corpusname} 0/2 0/5 0/3 0/0
POST /exist/restxq/v1/webhook/github 0/5 0/7 0/1 0/0
GET /exist/restxq/v1/wikidata/author/{id} 0/1 0/1 0/2 0/0
PUT /exist/restxq/v1/corpora/{corpusname}/plays/{playname}/tei 0/3 0/4 0/3 0/0

🔴 Tested (29)

Method Path Parameters Keywords Responses Examples
🔴 GET /exist/restxq/v1/character/{id} 0/1 1/2 1/3 0/0
🔴 GET /exist/restxq/v1/corpora 0/1 1/2 1/1 0/0
🟡 GET /exist/restxq/v1/corpora/{corpusname}/plays/{playname}/spoken-text 6/7 7/8 1/3 0/0
🟡 GET /exist/restxq/v1/dts/collection 1/2 2/3 2/4 0/0
🟡 GET /exist/restxq/v1/dts/document 3/4 4/5 1/4 2/2
🟡 GET /exist/restxq/v1/dts/navigation 3/5 5/7 1/4 2/2
🟢 GET /exist/restxq/v1/corpora/{corpusname} 1/1 1/1 2/2 0/0
🟢 GET /exist/restxq/v1/corpora/{corpusname}/metadata 1/1 1/1 1/2 0/0
🟢 GET /exist/restxq/v1/corpora/{corpusname}/metadata/csv 1/1 1/1 1/2 0/0
🟢 GET /exist/restxq/v1/corpora/{corpusname}/plays/{playname} 2/2 2/2 1/2 0/0
19 more
Method Path Parameters Keywords Responses Examples
🟢 GET /exist/restxq/v1/corpora/{corpusname}/plays/{playname}/characters 2/2 2/2 1/2 0/0
🟢 GET /exist/restxq/v1/corpora/{corpusname}/plays/{playname}/characters/csv 2/2 2/2 1/2 0/0
🟢 GET /exist/restxq/v1/corpora/{corpusname}/plays/{playname}/metrics 2/2 2/2 1/2 0/0
🟢 GET /exist/restxq/v1/corpora/{corpusname}/plays/{playname}/networkdata/csv 2/2 2/2 1/2 0/0
🟢 GET /exist/restxq/v1/corpora/{corpusname}/plays/{playname}/networkdata/gexf 2/2 2/2 1/2 0/0
🟢 GET /exist/restxq/v1/corpora/{corpusname}/plays/{playname}/networkdata/graphml 2/2 2/2 1/2 0/0
🟢 GET /exist/restxq/v1/corpora/{corpusname}/plays/{playname}/relations/csv 2/2 2/2 1/2 0/0
🟢 GET /exist/restxq/v1/corpora/{corpusname}/plays/{playname}/relations/gexf 2/2 2/2 1/2 0/0
🟢 GET /exist/restxq/v1/corpora/{corpusname}/plays/{playname}/relations/graphml 2/2 2/2 1/2 0/0
🟢 GET /exist/restxq/v1/corpora/{corpusname}/plays/{playname}/spoken-text-by-character 2/2 2/2 1/2 0/0
🟢 GET /exist/restxq/v1/corpora/{corpusname}/plays/{playname}/stage-directions 2/2 2/2 1/2 0/0
🟢 GET /exist/restxq/v1/corpora/{corpusname}/plays/{playname}/stage-directions-with-speakers 2/2 2/2 1/2 0/0
🟢 GET /exist/restxq/v1/corpora/{corpusname}/plays/{playname}/tei 2/2 2/2 1/2 0/0
🟢 GET /exist/restxq/v1/corpora/{corpusname}/plays/{playname}/txt 2/2 2/2 1/2 0/0
🟢 GET /exist/restxq/v1/id/{id} 1/1 1/1 1/2 0/0
🟢 GET /exist/restxq/v1/characters 0/0 0/0 1/1 0/0
🟢 GET /exist/restxq/v1/dts 0/0 0/0 1/1 0/0
🟢 GET /exist/restxq/v1/info 0/0 0/0 1/1 0/0
🟢 GET /exist/restxq/v1/wikidata/mixnmatch 0/0 0/0 1/1 0/0

Powered by TraceCov v0.22.0

schemathesis 4.22.4 | http://localhost:8081/exist/restxq/v1/openapi.yaml

Download full HTML report

@cmil
cmil requested a review from ingoboerner July 12, 2026 20:40
Base automatically changed from 328-schemathesis-upgrade to main July 12, 2026 20:51
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