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
I'll locate where v4 OpenAPI schema import handles
additionalPropertiesand fix booleanfalseso closed objects aren't imported as maps. - Assistant
Checking current behavior and whether map-like schemas are tested elsewhere:
- Assistant
Implementing the fix: boolean
additionalProperties: falseshould import as a closed object, not a map. - Assistant
Fixed OpenAPI schema import so boolean
additionalProperties: falseis treated as a closed object instead of a free-form map.Problem
In
schemas.rs, any presence ofadditionalPropertiestriggered map import. ForadditionalProperties: false, the importer calledimport_schemaon the booleanfalse, which produced aMapwith a JSON value type instead of a closedObject.Fix
} else if let Some(additional) = resolved.get("additionalProperties") { if additional.as_bool() == Some(false) { IrTypeShape::Object { fields: vec![] } } else if additional.is_object() || additional.get("$ref").is_some() { let value_type_ref = self .import_schema( additional, &format!("{type_id}_value"), operation_id, diagnostics, ) .unwrap_or_else(|| "json".to_string()); IrTypeShape::Map { value_type_ref } } else { IrTypeShape::Json }additionalProperties: false→ closedObject(empty when noproperties)- Schema-valued
additionalProperties(inline object or$ref) →Map(unchanged) additionalProperties: true→Json(open object; no longer misclassified as a map)
Objects with both
propertiesandadditionalProperties: falsewere already handled via the properties branch.Tests
Added
importer_treats_additional_properties_false_as_closed_objectcovering:- Closed empty object (
additionalProperties: falseonly) - Closed object with declared fields
- Map import for schema-valued
additionalProperties: { type: string }
All 13 OpenAPI importer tests pass.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- fable-5Compare side by side →
- fable-5Compare side by side →