Skip to content

Declaration-based generated types file splitting #974

Open

Description

@nac5504

Description

Track the public proposal and review discussion for opt-in declaration-based file splitting of generated Swift types.

The generator currently splits types by namespace, but APIs with a large proportion of schemas can still place most generated source in one file. A declaration limit would allow those large namespaces to be divided further.

Related PRs and issues:

The intended proposal scope is:

  • Add an optional output.maxDeclarationsPerFile setting for generated types.
  • Keep the normal eight output files when the setting is omitted.
  • Split each supported namespace's immediate declarations into chunks, retaining the unsuffixed filename for the first chunk and adding numbered extension files for overflow.
  • Preserve generated adopter-facing API names, signatures, and access levels.
  • Support direct generation and the command plugin; defer dynamic-output support in the SwiftPM and Xcode build-tool plugin.
  • Consider a fixed number of files as an alternative, including its build-tool plugin advantages and the empty-file overhead of applying one count to every namespace.

The proposal includes benchmark charts comparing namespace splitting with declaration limits of 100 and 1,000. Dependency-aware layering remains a future direction.

Activity

  1. czechboy0 commented on Oct 15, 2026

    @czechboy0
    Contributor
  2. changed the title [-]Track proposal for declaration-based generated types file splitting[/-] [+]Declaration-based generated types file splitting[/+] on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/generatorAffects: plugin, CLI, config file.kind/featureNew feature.status/needs-designNeeds further discussion and a concrete proposal.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions