Treat OpenAPI path parameters as required in v4 import This tracks unresolved feedback…
- User
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.Interface
No new interfaces are introduced.
- Assistant
Now I'll make the fix in the importer:
- Assistant
Now let me look at the existing tests to add coverage:
- Assistant
Now I'll add the tests. First, the importer test in
openapi_tests.rs: - Assistant
Now the projection test in
projection_tests.rs: - Assistant
All 221 tests pass. Let me verify the new tests ran specifically and run clippy/fmt:
- Assistant
Done. Summary of the fix:
Change (
crates/coral-spec/src/v4/surfaces/openapi/operations.rs:155-165): In the v4 OpenAPI importer,IrOperationInput.requirednow evaluates totruewhenever the parameter location ispath, falling back to the explicitrequiredfield (defaulting tofalse) for all other locations. This matches the OpenAPI spec, which mandates that path parameters are always required. TheRestParameterBindingused for execution inherits the same value, so both the semantic IR and the REST attachment are consistent.Tests added:
importer_treats_path_parameters_as_required_when_required_is_omitted(openapi_tests.rs) — imports an operation with a path parameter omittingrequired, a query parameter omitting it, and a query parameter with explicitrequired: true; asserts the path param comes back required while non-path parameters preserve their explicit/omitted behavior, on bothIrOperationInputandRestParameterBinding.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.