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 let me check how the
"json"type ref is treated downstream, to confirm it's a valid built-in fallback ref: - Assistant
Now the fix:
- Assistant
Now add a focused test to
openapi_tests.rs: - Assistant
Done. The fix is in
crates/coral-spec/src/v4/surfaces/openapi/schemas.rs:102— the schema importer now dispatches on the value ofadditionalPropertiesinstead of treating its mere presence as map-like:additionalProperties: false→ imports as a closed object (IrTypeShape::Objectwith no fields) instead of a free-form map.additionalProperties: true→ imports asIrTypeShape::Mapwith thejsonfallback value ref directly, rather than recursing into the boolean (which previously produced a spurious{type_id}_valuesynthetic type with aJsonshape).- Schema-valued
additionalProperties(e.g.{type: string}) → unchanged; still imports the value schema and producesIrTypeShape::Map { value_type_ref }.
Note: objects that declare
propertiesstill take precedence overadditionalProperties, matching prior behavior.Coverage added in
crates/coral-spec/src/v4/openapi_tests.rs— imports one document with all three variants (, , ) 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.