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 I'll make the fix in
schemas.rs:102: - Assistant
Now add the focused test coverage in
openapi_tests.rs, following the existing test style: - Assistant
All 14 tests pass, including the new one. Now verify formatting and lints:
- Assistant
Formatting was applied by
cargo fmtand clippy is clean. Running the full crate test suite to confirm nothing else regressed: - Assistant
All 220 coral-spec tests pass, clippy is clean, and formatting is applied.
Summary
Fix (
crates/coral-spec/src/v4/surfaces/openapi/schemas.rs:102): The importer previously treated any presence ofadditionalPropertieson an object withoutpropertiesas map-like, soadditionalProperties: falsewas fed intoimport_schemaand fell back to a free-form JSON map. The branch now dispatches on the value:additionalProperties: false→IrTypeShape::Object { fields: vec![] }— a closed object that accepts no fieldsadditionalProperties: true→IrTypeShape::Map { value_type_ref: "json" }— free-form map, same effective behavior as before but without synthesizing a spurious_valuetype from the boolean- Schema-valued
additionalProperties→ unchanged: the value schema is imported and used as the map's value type
Test (
crates/coral-spec/src/v4/openapi_tests.rs): Addedimporter_respects_additional_properties_variants, covering all three variants in one document — asserting the closed object imports as an empty-fieldObject, the schema-valued case imports as a with a string scalar value type, and imports as a of .
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.