buckettypes

package
v2.946.5 Latest Latest
Warning

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

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

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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