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
Let me look at the existing tests for schema import to match their style.
- Assistant
Now I'll make the fix in
schemas.rs:102-114: - Assistant
Now add a focused test. I'll place it after
importer_handles_recursive_schema_refs: - Assistant
Done. The fix and coverage:
Fix —
crates/coral-spec/src/v4/surfaces/openapi/schemas.rs:102: the object branch now dispatches on theadditionalPropertiesvalue instead of unconditionally treating its presence as map-like:additionalProperties: false→IrTypeShape::Object { fields: [] }(closed object, no longer imported as a free-form map keyed on the literalfalse)additionalProperties: true→IrTypeShape::Mapwith thejsonsentinel value type (previously it synthesized a spurious*_valueJson type)- Schema-valued
additionalProperties→ unchanged: imports the value schema and producesIrTypeShape::Map { value_type_ref }
Note the
propertiesbranch still takes precedence, so objects with declared properties plusadditionalProperties: falsewere already imported as closed objects — this only affected property-less schemas.Test —
importer_respects_boolean_additional_propertiesincrates/coral-spec/src/v4/openapi_tests.rscovers all three cases (, , component schemas) and asserts the resulting IR shapes, including that the schema-valued map's 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.