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.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /coral, current file: none) bash-$
- Assistant
I’ll locate the v4 OpenAPI importer and its projection logic, identify how parameter requiredness is represented, then reproduce the omitted-
requiredpath case with the project’s existing test tooling or a temporary script. After implementing the narrow semantic fix, I’ll run focused and broader relevant tests and inspect the final diff. - Assistant
The repository is a Rust workspace with no pre-existing local changes. I’ll now read the repository and crate-specific guidance and search for v4 DSL/OpenAPI import code, parameter conversion, and projection tests so the fix follows local conventions.
- Assistant
rgis unavailable, so I’ll usegrep/find. The guidance confirms this behavior belongs incoral-spec; because importer normalization is the likely single source of truth, I’ll first map its modules and tests before changing anything. - Assistant
The problematic assignment is in
operations.rs: every parameter currently defaultsrequiredtofalse, irrespective of location. I’ll inspect parameter merging/reference resolution and projection derivation in full to ensure path-level and operation-level parameters, overrides, defaults, and explicit non-path flags all remain correct. - Assistant
The importer merges parameters by
(location, name)(so operation-level declarations correctly override path-level ones), then materializes both semantic IR and REST bindings from oneIrOperationInput.requiredvalue. The correct normalization point is therefore the assignment inimport_parameters:Pathmust forcetrue, while query/header/cookie continue honoring explicit booleans and defaulting omission tofalse.Before editing, I’ll create an external temporary Rust program (outside the repository, so no tests are added or modified) that imports an OpenAPI operation with an omitted path flag plus omitted/explicit query flags and prints both IR and projection classification. This will document the current failure and later verify the complete flow.
- Assistant
The reproduction confirms the bug at both layers: the omitted path parameter is
required=falsein semantic IR and remains optional in the projection. The non-path controls behave as expected (omitted/false => false,true => true). I’ll implement the OpenAPI invariant aslocation == Path || explicit_required, which also safely normalizes invalidrequired: falsepath declarations rather than allowing malformed input to corrupt SQL classification.Because materialized v4 artifacts record importer versions, I’ll inspect how version compatibility/fingerprints are used before deciding whether this semantic importer change requires a version bump.
- Assistant
Importer versions are enforced when loading materialized artifacts, not merely informational. Since this change alters generated semantic IR, leaving
openapi-v2would allow old, incorrectly optional artifacts to pass compatibility checks indefinitely. I’ll therefore make the normalization change and advance the importer version toopenapi-v3; this causes affected materialized v4 sources to fail loudly and be re-added, consistent with the repository’s stated v4 policy. Then I’ll rerun the external reproduction. - Assistant
The reproduction now shows
id Path required=truethrough both importer and projection while all non-path controls retain their exact explicit/default behavior. The code formats cleanly and the diff is minimal.Next I’ll run the full
coral-spectest suite. This will also reveal any materialization compatibility fixtures that need consideration from the version bump (without modifying tests, per instruction). - Assistant
All 219
coral-specunit tests and its doctest pass. To verify the precise SQL misclassification scenario (without another required query parameter influencing projection kind), I’ll simplify the external reproduction to one omitted path parameter plus optional query parameters. The expected fixed result is a table function with the path exposed as a required function argument; the pre-fix importer result already established the path was optional.After that, I’ll run tests in
coral-appbecause it enforces importer-version compatibility, then the repository’s required Rust gate if feasible. - Assistant
The combined command exceeded the environment timeout during a long-running OAuth test after compiling the full dependency graph; most app tests passed, including v4 source import/materialization cases, but the suite did not complete, so I will not count it as a passing run. The focused external projection program likely ran before the truncated output; I’ll rerun it alone for a clear record, inspect the Rust gate, and run only the materialization test module that is directly affected by the version change.
- Assistant
The focused flow now verifies the acceptance behavior end-to-end: omitted path input is a required
FunctionArg, while omitted and explicit-false query inputs remain optional. All five app materialization tests pass withopenapi-v3.I’ll now run formatting and Clippy for the affected crate, check whether
cargo-nextestis installed, and inspect status/diff. If available and time permits, I’ll run the mandated workspace gate; otherwise I’ll run the strongest practical compile checks and clearly report the limitation. - Assistant
Formatting, diff checks, and strict Clippy for
coral-specpass.cargo-nextestis not installed, somake rust-checkscannot complete as written. Since the workspace dependencies are now built, I’ll still run the gate’s workspace-wide Clippy command and Rustdoc command; the affected crate’s full tests and focused app tests already provide behavioral coverage. - Assistant
Workspace-wide strict Clippy and warning-denied Rustdoc both pass. The implementation is complete; no repository tests were added or modified because the environment explicitly prohibits test changes, so focused importer/projection coverage was performed with the external
/tmpreproduction instead.Checklist:
- If an error was reported, I successfully reproduced it. Before the fix, the external v4 OpenAPI import printed the omitted path parameter as
Path required=false, and its projection input was alsorequired=false. - If an error was reported, I confirmed the fix resolves it. After the fix, the focused program prints the omitted path parameter as
required=truein IR and as a requiredFunctionArgin projection output; omitted and explicit-false query parameters remainrequired=false. - I thought about edge cases. Path parameters are forced required even for malformed explicit
false, matching the OpenAPI invariant; all non-path parameters continue to preserve explicittrue/falseand omission defaults. Parameter references/merging feed through this same normalization point. The importer version was bumped so stale v2 artifacts cannot silently retain incorrect semantics. - I ran affected existing tests.
cargo test -p coral-spec --all-featurespassed all 219 unit tests plus doctests; focusedcoral-appmaterialization tests passed 5/5; formatting, workspace strict Clippy, and workspace warning-denied Rustdoc passed. A fullcoral-apprun timed out in a long OAuth test after most tests passed, andcargo-nextestis unavailable, so the exactmake rust-checkstarget could not be completed.
I’ll perform one final clean-status/diff check and submit the two-file change.
- If an error was reported, I successfully reproduced it. Before the fix, the external v4 OpenAPI import printed the omitted path parameter as
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →