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 importer and how it sets
requiredon path parameters, then align it with the OpenAPI spec and add tests. - Assistant
Implementing the fix: path parameters default to required per OpenAPI; query and other parameters keep their current behavior.
- Assistant
Path parameters are now always imported as required in the v4 OpenAPI importer, matching the OpenAPI spec when
requiredis omitted.Change
In
operations.rs, parameter requiredness is resolved via a dedicated helper:261:272:crates/coral-spec/src/v4/surfaces/openapi/operations.rsfn parameter_is_required( location: OpenApiParameterLocation, parameter_obj: &Map<String, Value>, ) -> bool { match location { OpenApiParameterLocation::Path => true, OpenApiParameterLocation::Query | OpenApiParameterLocation::Header | OpenApiParameterLocation::Cookie | OpenApiParameterLocation::Body => parameter_obj .get("required") .and_then(Value::as_bool) .unwrap_or(false), } }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.