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 fix omittedrequiredhandling and add tests. - Assistant
Implementing the fix: path parameters default to required per OpenAPI; query/header/cookie keep explicit
requiredbehavior. - Assistant
OpenAPI path parameters are now always imported as required, matching the spec when
requiredis omitted.Change
In
operations.rs, parameter import no longer defaults all parameters to optional. Path parameters are always required; query, header, cookie, and body parameters still use the explicitrequiredfield (defaulting tofalsewhen omitted):fn 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), } }This prevents required path inputs from being misclassified as optional SQL filters in projection generation.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.