ISSUE DESCRIPTION Treat OpenAPI path parameters as required in v4 import This tracks…
- User
ISSUE DESCRIPTION
Treat OpenAPI path parameters as required in v4 import This tracks unresolved feedback identified by cubic on PR #1149: https://github.com/withcoral/coral/pull/1149#discussion_r3347190640
Context: This appears to be pre-existing DSL v4 behavior surfaced by the refactor review, not a regression from the module split.
Problem: OpenAPI path parameters are imported as optional when
requiredis omitted, even though path parameters are required by OpenAPI. This can misclassify required path inputs as optional SQL filters.Acceptance criteria: Import path parameters as required regardless of an omitted
requiredfield, preserve explicit behavior for non-path parameters, and add focused importer/projection coverage.ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
- Assistant
I’ll first map the repository and locate the DSL v4 OpenAPI importer/projection logic and its existing tests, then reproduce the omitted-
requiredbehavior before making the smallest source-only fix. - Assistant
The project is a Rust workspace with no pre-existing working-tree changes. I’ll now read the repository guidance and search for v4 importer code, parameter requiredness, and projection tests.
- Assistant
rgis unavailable, so I’ll usegrep. The root guidance assigns this behavior tocoral-spec; I’ll inspect that crate’s local rules and source layout, then narrow down references to OpenAPI parameters and projections. - Assistant
The likely defect is at
operations.rs:158, where requiredness appears copied directly from the optional OpenAPI field. I’ll inspect the full import path, IR/projection exposure rules, and nearby test style so the fix preserves non-path semantics and can be verified at both importer and projection levels without changing repository tests. - Assistant
The defect is confirmed in source: all parameter locations use
required.unwrap_or(false), contrary to OpenAPI 3.0’s invariant thatin: pathis always required. Since projection exposure depends on that normalized IR flag, correcting import should propagate naturally. I’ll inspect exact exposure logic and fixture required fields, then create a temporary integration-style reproducer (not a repository test) to prove current importer/projection behavior. - Assistant
Projection classification reveals the reported impact precisely for singleton GETs: if an omitted path
requiredbecomes false, no required input is detected, so a table with optional filters is generated instead of a table function with required arguments. For list GETs, established behavior remains table/filter-based, but the normalized required flag is still preserved. I’ll build an ephemeral example against the publiccoral-specAPI that includes path, query, header, and cookie parameters, demonstrating both the importer defect and the singleton projection misclassification. - Assistant
The reproducer confirms the path input imports as
false, while omitted non-path inputs also default false and explicit non-path values are honored. The example’s explicit required query already forces a function, so after the code fix I’ll rerun a cleaner singleton case to directly verify projection classification.Before editing, I’ll check importer-version history and artifact fingerprint semantics. Because imported IR changes, a version bump may be required to avoid treating stale materialized artifacts as current.
- Assistant
Materialized v4 packages fingerprint the importer version and are intentionally rejected when importer behavior changes. Therefore this semantic import fix should increment
openapi-v2toopenapi-v3; otherwise already-materialized packages would silently retain the defect. I’ll make two source changes only: forcePathrequiredness while retaining the existing explicit/default logic for every other location, and bump the importer fingerprint version. - Assistant
The implementation is minimal and formatted. I’ll now rerun the temporary reproducer with no required non-path parameter, plus omitted/explicit-false path and omitted/explicit-true/explicit-false non-path cases. This verifies the path rule, non-path preservation, REST binding propagation, and projection classification in one executable check.
- Assistant
The post-fix reproducer passes: omitted and even invalid explicit-false path declarations normalize to required; omitted, true, and false non-path declarations retain their prior semantics; REST bindings carry the value; and the singleton projection becomes a table function with required arguments rather than optional filters.
Next I’ll run the complete
coral-spectest suite, including all existing importer/projection coverage. - Assistant
All 219
coral-specunit tests and its doctest pass. The root policy requests the workspace-wide Rust gate for Rust changes, so I’ll runmake rust-checksnow; afterward I’ll inspect the final diff/status and ensure no temporary artifacts entered the repository. - Assistant
The workspace gate completed formatting and full-workspace Clippy successfully, then stopped solely because
cargo-nextestis not installed in the environment. Relevant crate tests already passed via standard Cargo. I’ll perform final hygiene checks, confirm that the version string has no checked-in consumers requiring regeneration, and review the exact diff before submission.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.