Skip to content

JSONSchemaVisitor: add option to emit additionalProperties: false on object schemas #255

Description

@devanshi00

Summary

JSONSchemaVisitor does not emit additionalProperties: false on generated object schemas. Consumers that need strict/closed schemas, notably LLM structured-output APIs (OpenAI, Anthropic), which require additionalProperties: false on every object , must post-process the visitor output to add it.

Proposal

Add an opt-in parameter, consistent with the existing flags (includeTypeTag, defaultsAreOptional, inlineTypes, refRoot), e.g. parameters.additionalPropertiesFalse (or closeObjectSchemas), defaulting to false to preserve historical behavior. When true, every emitted object schema (concept/asset/transaction/event + inline nested objects) includes additionalProperties: false.

Acceptance

  1. New flag documented in the JSONSchemaVisitor class JSDoc alongside the other options.
  2. Defaults to false; existing output unchanged.
  3. Applies recursively to nested inline object schemas.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions