generator

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: May 31, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate added in v0.1.8

func Generate(routes []types.APIRoute, typeDefs []types.TypeDefinition, config *config.APIClientConfig) error

Generate generates all API client artifacts based on configuration This is the main entry point for the type generation system

func GenerateAPIClient

func GenerateAPIClient(routes []types.APIRoute, typeDefs []types.TypeDefinition, config *config.APIClientConfig) error

GenerateAPIClient generates the API client based on configuration

func GenerateRouteManifest

func GenerateRouteManifest(routes []types.APIRoute) error

GenerateRouteManifest generates a JSON manifest of all routes

func GenerateTypeScriptTypes

func GenerateTypeScriptTypes(typeDefs []types.TypeDefinition) error

GenerateTypeScriptTypes generates TypeScript type definitions

func GetSupportedGenerators added in v0.1.8

func GetSupportedGenerators() []string

GetSupportedGenerators returns a list of supported generator types

func ShouldGenerateTypeScriptTypes added in v0.1.8

func ShouldGenerateTypeScriptTypes(generatorType string) bool

ShouldGenerateTypeScriptTypes returns true if TypeScript types should be generated for the given generator

func ValidateGeneratorType added in v0.1.8

func ValidateGeneratorType(generatorType string) error

ValidateGeneratorType validates if the generator type is supported

Types

type ClientTemplateData added in v0.1.8

type ClientTemplateData struct {
	UsedTypes         []string
	TypesImport       string
	APIObject         string
	ReactQueryEnabled bool
	QueryKeysEnabled  bool
	QueryKeys         string
}

ClientTemplateData contains data for client template generation

type MethodTemplateData added in v0.1.8

type MethodTemplateData struct {
	Description                    string
	Method                         string
	MethodLower                    string
	ParameterSignature             string
	ParameterSignatureJS           string // JavaScript parameter signature with destructuring
	QueryParameterSignature        string
	QueryOptionsParameterSignature string
	ResponseType                   string
	RequestPath                    string
	RequestPathForMutation         string // For React Query mutations with different variable substitution
	HasIDParam                     bool
	HasBodyData                    bool
	DataParameter                  string
	QueryKey                       string
	MutationVariableType           string
	ReactQueryEnabled              bool
}

MethodTemplateData contains data for individual method templates

Jump to

Keyboard shortcuts

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