Repository navigation
fix: accept a null type of inputs and outputs - #150
Conversation
TES 1.1 makes the type of inputs and outputs optional. A left-out type was FILE already; an explicit null was refused with 400 Bad Request. - The models read the type from JSON through a String setter: null is FILE, known values map to the enum, and unknown or empty values stay null and are refused by validation as before. (Jackson sends nulls returned by a deserializer through the same null handling as JSON null, so this can't be done in the enum's deserializer.) - The API description no longer marks the type as required and lists its two values in requests and responses. - docs/api.md: directories still need type DIRECTORY; TESK doesn't infer it. Closes #146 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
From the review: TesInput and TesOutput call TesFileType.fromJson instead of repeating the rule. Tests cover an empty input type and an unknown output type on the 400 path, and types left out next to null ones at controller level; the API-docs test uses API_DOCS_URL. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Reviewer's GuideAPIDefault omitted or explicit-null input and output types to FILE while preserving validation of unknown values, and expose the optional enum values in the API models.
DocumentationDocument the optional input and output type, its FILE default, and the need to specify DIRECTORY explicitly.
TestsVerify the API documentation marks type optional and lists its supported values for request and response models.
Cover omitted, null, valid, unknown, and empty types at model and controller levels, including rejection through validation.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #150 +/- ##
==========================================
- Coverage 73.07% 72.98% -0.10%
==========================================
Files 70 70
Lines 2941 2946 +5
Branches 330 330
==========================================
+ Hits 2149 2150 +1
- Misses 651 655 +4
Partials 141 141 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Linked issuesChecked at commit b87881c #146 fix: accept a null type of inputs and outputs · 3 of 3 met
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/test/java/uk/ac/ebi/tsc/tesk/tes/api/TasksApiControllerTest.java" line_range="489-495" />
<code_context>
+ .createTask(
+ argThat(
+ task ->
+ task.getInputs().stream()
+ .allMatch(
+ input ->
+ input.getType()
</code_context>
<issue_to_address>
**Empty collections satisfy type check**
When the application mapper supplies empty input and output lists for the request, the `allMatch` checks return true for empty input and output lists, so `verify` accepts the task without proving any types were mapped to `FILE`. The test passes even though the request’s inputs and outputs were discarded.
Assert that the lists contain the expected number of entries before checking that their types are `FILE`.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and a task that previously failed validation when an input or output type was explicitly null can now run with that path treated as a FILE. If the path was actually intended to be a directory, execution may transfer the wrong artifact to or from the configured URL; reverting would stop future cases but would not undo artifacts already written.
Blocking findings: src/test/java/uk/ac/ebi/tsc/tesk/tes/api/TasksApiControllerTest.java:495
From Sourcery: allMatch passes for empty lists. The controller test captures the task and compares the lists of types (two inputs and two outputs, FILE each), so dropped entries fail it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
# Conflicts: # src/test/java/uk/ac/ebi/tsc/tesk/tes/api/TasksApiControllerTest.java
Summary
TES 1.1 makes the
typeof inputs and outputs optional. A left-out type wasFILEalready (field default); an explicit"type": nullwas refused with400 Bad Request, becauseTesFileType.fromValuereturns null for it and@NotNullfails.TesInputandTesOutputreadtypefrom JSON through a private@JsonSetter("type")String setter that calls the newTesFileType.fromJson:nullisFILE, known values map to the enum, unknown or empty values stay null and are refused by validation with400, as before.@JsonSetter(nulls = Nulls.SKIP)or an enum deserializer withgetNullValue: Jackson 2.18 sends nulls returned by a deserializer (unknown values) through the same null handling as JSONnull, so both would turn unknown values intoFILE. Tests caught this.typeas required and listsDIRECTORYandFILEin the request and response models (the request model'stypewould otherwise be a plain string, as springfox takes the type from the setter).docs/api.md("TES 1.1 fields"): the type is optional; directories still needtype: DIRECTORY, as TESK doesn't infer it (that would need tesk-core).Closes #146
Verification
./mvnw -B spotless:apply clean verify checkstyle:check spotless:checkwith Temurin 8: all unit and integration tests pass,BUILD SUCCESS.TesFileTypeDefaultTest: missing,null,DIRECTORY, unknown and empty types of inputs and outputs.TasksApiControllerTest.createTask_valid_nullInputAndOutputTypes(valid_tasks/null_io_types.json: null and left-out types through the application's mapper);createTask_invalid_inputs/_outputsnow also cover an empty input type and an unknown output type.ApiDocsFileTypeTest:typeis optional with both values inTesInputReq/ResandTesOutputReq/Res.mkdocs build --strict: passes.Declined review findings
TesFileType.fromJson.DIRECTORYcase through the controller: covered byTesFileTypeDefaultTestand the existing valid tasks. (The controller test now uses anArgumentCaptor, from Sourcery.)Open questions
None.
🤖 Generated with Claude Code
https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Summary by Sourcery
Support optional TES 1.1 input and output types while retaining validation for invalid values.
New Features:
Bug Fixes:
Enhancements:
Documentation:
Tests: