Help us shape the future of Go! Take the 2026 Go Developer Survey

buckettypes

package
v2.950.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SplitModelTypeThreshold = 200
	SplitModelChunkSize     = 150
)

Variables

This section is empty.

Functions

func AddTypeToBucket

func AddTypeToBucket(types ast.BucketedTypes, model string, typeDef *ast.TypeDef) ast.BucketedTypes

func DeduplicateTypes

func DeduplicateTypes(types ast.BucketedTypes) ast.BucketedTypes

func GetOperationModelName

func GetOperationModelName(subsystem *subsystem.Subsystem, operation *ast.Operation) string

Types

type Bucketer

type Bucketer struct {
	// contains filtered or unexported fields
}

func New

func New(subsystem *subsystem.Subsystem) *Bucketer

func (*Bucketer) BucketTypes

func (b *Bucketer) BucketTypes(ctx context.Context, sdk *ast.AST) (ast.BucketedTypes, *sequencedmap.Map[string, *ast.Servers])

BucketTypes buckets types using the improved ordered maps.

func (*Bucketer) GetDeduplicatedOperationModelName

func (b *Bucketer) GetDeduplicatedOperationModelName(operation *ast.Operation) string

func (*Bucketer) GetOperationModels

func (b *Bucketer) GetOperationModels(operation *ast.Operation, ignoreResponseSubTypes bool, ignoreResponseTypes bool, considerFlattening bool) ast.BucketedTypes

func (*Bucketer) SetReservedModelFileNames

func (b *Bucketer) SetReservedModelFileNames(names []string)

SetReservedModelFileNames sets the list of sanitized filenames that must not be used as chunk names when splitting large models.

func (*Bucketer) SetSplitThresholds

func (b *Bucketer) SetSplitThresholds(threshold, chunkSize int)

SetSplitThresholds overrides the default split-model thresholds.

func (*Bucketer) SplitLargeModels

func (b *Bucketer) SplitLargeModels(
	types ast.BucketedTypes,
	operationServers *sequencedmap.Map[string, *ast.Servers],
) ast.BucketedTypes

SplitLargeModels splits models that exceed SplitModelTypeThreshold into smaller chunks of SplitModelChunkSize. Each chunk becomes a new model named after its last (most root-like) type after topological sorting. This prevents compiler complexity limits in languages like Python (pyright) and TypeScript (tsc).

type Sanitizer

type Sanitizer interface {
	SanitizeFileName(name string) string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL