Respect additionalProperties false during v4 OpenAPI schema import This tracks…
- User
Respect additionalProperties false during v4 OpenAPI schema import This tracks unresolved feedback identified by cubic on PR #1149: https://github.com/withcoral/coral/pull/1149#discussion_r3347190658
Context: This appears to be pre-existing DSL v4 behavior surfaced by the refactor review, not a regression from the module split.
Problem: The schema importer treats the presence of
additionalPropertiesas map-like, soadditionalProperties: falsecan be imported as a free-form map instead of a closed object.Acceptance criteria: Handle boolean
additionalProperties: falseas a closed object, preserve schema-valued additionalProperties behavior, and add focused schema import coverage.Interface
No new interfaces are introduced.
- Assistant
Now add focused test coverage in
openapi_tests.rs: - Assistant
All 13 tests pass, including the new one. Now run the full crate's tests plus clippy/fmt to make sure nothing else regressed:
- Assistant
Done. Summary of the fix:
Problem — In the v4 OpenAPI schema importer (
crates/coral-spec/src/v4/surfaces/openapi/schemas.rs:102), any presentadditionalPropertiesvalue was fed straight into the map branch, soadditionalProperties: false— which closes the object — was imported as a free-formMaptype.Fix — The
additionalPropertiesbranch now matches on the value:false→IrTypeShape::Object { fields: [] }(closed object, no free-form values)true→IrTypeShape::Map { value_type_ref: "json" }(explicit free-form map, using the existing"json"sentinel instead of synthesizing a spurious{type_id}_valueJson type)- schema value → unchanged: recursively imports the value schema and builds
IrTypeShape::Mapfrom it
Coverage — Added
importer_respects_boolean_additional_propertiesincrates/coral-spec/src/v4/openapi_tests.rs, asserting all three cases:false→ empty closed object,true→ map ofjson, and{type: string}→ map whose value type resolves to a string scalar.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.