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
operations.rs: - Assistant
Now let's look at the test files to add coverage:
- Assistant
Now add the importer test in
openapi_tests.rs: - Assistant
Now add the projection test:
- Assistant
Two failures in coral-app grpc tests. Let me check if they're related to my change or pre-existing:
- Assistant
Done. Summary of the fix:
Change
crates/coral-spec/src/v4/surfaces/openapi/operations.rs— inimport_parameters, path parameters are now imported as required regardless of an omittedrequiredfield, per the OpenAPI spec (which mandatesrequired: trueforin: path):required: location == OpenApiParameterLocation::Path || parameter_obj .get("required") .and_then(Value::as_bool) .unwrap_or(false),Non-path parameters keep the existing behavior: explicit
requiredis honored, omitted defaults to optional. The fix flows through toRestParameterBindingand projections automatically since both derive fromIrOperationInput.required.Tests added
openapi_tests.rs::importer_treats_path_parameters_as_required_when_field_is_omitted— importer-level: a path param with omittedrequiredimports as required; query params with omitted /false/truekeep their explicit or default behavior, on bothIrOperationInputand the REST parameter bindings.projection_tests.rs::projection_generation_treats_path_inputs_as_required_when_field_is_omitted— projection-level: a singleton operation whose only required input is a path param lackingrequirednow projects as aTableFunction(kindTable) with the path input marked required, instead of a plain table with an optional SQL filter (the misclassification from the issue).
Verification
cargo test -p coral-spec --lib: 221 passedcargo test --workspace --no-fail-fast: all pass exceptdelete_restores_artifacts_on_cleanup_failureandimport_rolls_back_on_config_write_failurein coral-app's grpc suite — verified pre-existing on clean HEAD (they rely on chmod-based permission denial, which is a no-op when running as root)cargo clippy -p coral-spec --all-targetsandcargo fmt --check: clean
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
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare 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 →
- gpt-5.6-solCompare side by side →
- fable-5Compare side by side →
- fable-5Compare side by side →