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
I'll locate the v4 OpenAPI import logic and how path parameters get their
requiredflag, then add the fix and focused tests. - Assistant
The bug is in
import_parameters: omittedrequireddefaults tofalsefor all parameters. OpenAPI requires path parameters, so I'll default those totrueand add focused tests. - Assistant
Adding a list-endpoint projection test to cover the optional-filter misclassification case.
- Assistant
Path parameters with an omitted
requiredfield are now imported as required in the v4 OpenAPI importer.Change in
operations.rs: addedparameter_is_required, which defaults path parameters torequired: truewhen the field is omitted. Query, header, and cookie parameters still default to optional.261:269:/coral/crates/coral-spec/src/v4/surfaces/openapi/operations.rsfn parameter_is_required( parameter_obj: &Map<String, Value>, location: OpenApiParameterLocation, ) -> bool { parameter_obj .get("required") .and_then(Value::as_bool) .unwrap_or(matches!(location, OpenApiParameterLocation::Path)) }This matches the OpenAPI rule that path parameters are always required, and stops them from being misclassified as optional SQL filters.
Tests in
openapi_tests.rs:- Singleton GET — omitted
requiredon a path param →required: trueat import, exposed as a required
- Singleton GET — omitted
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.