Documentation
¶
Index ¶
- func FormatFieldPath(fieldParts []string, lang string) string
- func FormatMethodName(methodParts []string, lang string) string
- func FormatMethodNameWithSDK(methodParts []string, lang, sdkName string) string
- func FormatPropertyName(propertyName string, lang string) string
- func IsOperationMCPEnabled(m MethodDiff) bool
- func ToHTML(d SDKDiff) []byte
- func ToMarkdown(d SDKDiff, detailLevel ...DetailLevel) string
- type ChangeType
- type DetailLevel
- type DiffChangeType
- type DiffOptions
- type DiffReason
- type DiffTypeDefsParams
- type GenerateOptions
- type MethodDiff
- type PathSegment
- type PathSegmentType
- type PathSegments
- type SDKDiff
- type SpecComparison
- type TypeDefDiffResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatFieldPath ¶
FormatFieldPath formats a field path according to language conventions
func FormatMethodName ¶
FormatMethodName formats a method name according to language conventions
func FormatMethodNameWithSDK ¶
FormatMethodNameWithSDK formats a method name according to language conventions with optional SDK name Returns in format: sdkName.method.name() or method.name() if sdkName is empty
func FormatPropertyName ¶
FormatPropertyName formats a property name according to language conventions
func IsOperationMCPEnabled ¶
func IsOperationMCPEnabled(m MethodDiff) bool
IsOperationMCPEnabled returns true if the operation is not disabled for MCP. Operations without MCP extensions or with Disabled == false are considered enabled.
func ToMarkdown ¶
func ToMarkdown(d SDKDiff, detailLevel ...DetailLevel) string
ToMarkdown converts the SDKDiff to Markdown format. Optional detailLevel parameter controls verbosity (defaults to DetailLevelCompact).
Types ¶
type ChangeType ¶
type ChangeType string
ChangeType represents the type of change detected
const ( MethodAdded ChangeType = "method_added" MethodDeleted ChangeType = "method_deleted" MethodDeprecated ChangeType = "method_deprecated" ArgumentsChanged ChangeType = "arguments_changed" ResponseChanged ChangeType = "response_changed" ArgumentsAndResponseChanged ChangeType = "arguments_and_response_changed" )
type DetailLevel ¶
type DetailLevel string
DetailLevel controls how much detail is shown in changelog output
const ( DetailLevelCompact DetailLevel = "compact" // Just parent: "request **Changed**" DetailLevelFull DetailLevel = "full" // Parent + all leaf children as sub-bullets )
type DiffChangeType ¶
type DiffChangeType string
DiffChangeType represents the type of change detected
const ( DiffChangeTypeAdded DiffChangeType = "added" DiffChangeTypeRemoved DiffChangeType = "removed" DiffChangeTypeChanged DiffChangeType = "changed" DiffChangeTypeTypeMismatch DiffChangeType = "type_mismatch" )
type DiffOptions ¶
type DiffOptions struct {
OldAST *ast.AST
NewAST *ast.AST
OldSubsystem *subsystem.Subsystem
NewSubsystem *subsystem.Subsystem
}
DiffOptions contains the configuration for AST comparison
type DiffReason ¶
type DiffReason string
DiffReason represents why two TypeDefs differ
const ( DiffReasonKind DiffReason = "kind" // Different type kinds (e.g., class vs array) DiffReasonFieldAdded DiffReason = "field_added" // Field was added DiffReasonFieldRemoved DiffReason = "field_removed" // Field was removed DiffReasonFieldChanged DiffReason = "field_changed" // Single field changed DiffReasonFieldsChanged DiffReason = "fields_changed" // Multiple fields changed DiffReasonUnionOptionAdded DiffReason = "union_option_added" // Union option was added DiffReasonUnionOptionRemoved DiffReason = "union_option_removed" // Union option was removed DiffReasonUnionOptionChanged DiffReason = "union_option_changed" // Single union option changed DiffReasonUnionChanged DiffReason = "union_changed" // Union changed DiffReasonUnionDiscriminatorAdded DiffReason = "union_discriminator_added" // Type became part of a discriminated union DiffReasonUnionDiscriminatorRemoved DiffReason = "union_discriminator_removed" // Union lost its discriminator DiffReasonEnumValueAdded DiffReason = "enum_value_added" // Enum value was added DiffReasonEnumValueRemoved DiffReason = "enum_value_removed" // Enum value was removed )
type DiffTypeDefsParams ¶
type DiffTypeDefsParams struct {
A *ast.TypeDef // First typedef to compare
B *ast.TypeDef // Second typedef to compare
Path PathSegments // Current path in the tree
IsRequest bool // Whether this is comparing request types (affects breaking change detection)
// contains filtered or unexported fields
}
DiffTypeDefsParams provides parameters for the diff operation
type GenerateOptions ¶
type GenerateOptions = generate.GenerateOptions
Exposing GenerateOptions
func CreateConfigsFromSpecBytes ¶
func CreateConfigsFromSpecBytes(oldSpec, newSpec []byte, options GenerateOptions) (oldConfig, newConfig GenerateOptions)
func CreateConfigsFromSpecPaths ¶
func CreateConfigsFromSpecPaths(config SpecComparison) (oldConfig, newConfig GenerateOptions)
type MethodDiff ¶
type MethodDiff struct {
MethodParts []string `json:"method_parts"` // e.g., ["stripe", "foo", "bar", "baz"]
Operation *ast.Operation `json:"-"` // Reference to the operation (not serialized)
MethodKey string `json:"method_key"` // Unique key for the method
Type ChangeType `json:"type"` // added, removed, deprecated, modified
ArgumentsDiff TypeDefDiffResult `json:"arguments_diff"` // Result of arguments comparison
SuccessResponseDiff TypeDefDiffResult `json:"success_response_diff"` // Result of success response comparison
ErrorResponseDiff TypeDefDiffResult `json:"error_response_diff"` // Result of error response comparison
}
MethodDiff represents a single change detected between ASTs
type PathSegment ¶
type PathSegment struct {
Type PathSegmentType `json:"type"` // The type of segment
Name string `json:"name"` // The name of the field, union option, status code, etc.
}
PathSegment represents a single segment in a path
type PathSegmentType ¶
type PathSegmentType string
PathSegmentType represents the type of a path segment
const ( PathSegmentTypeField PathSegmentType = "field" PathSegmentTypeUnionOption PathSegmentType = "union_option" PathSegmentTypeArrayItem PathSegmentType = "array_item" PathSegmentTypeMapItem PathSegmentType = "map_item" PathSegmentTypeEnumValue PathSegmentType = "enum_value" PathSegmentResponseStatus PathSegmentType = "response_status" PathSegmentResponseContentType PathSegmentType = "response_content_type" )
type PathSegments ¶
type PathSegments []PathSegment
Represents a collection of PathSegment
func (PathSegments) Append ¶
func (p PathSegments) Append(segment PathSegment) PathSegments
Returns a copy of PathSegments with the given segment appended.
type SDKDiff ¶
type SDKDiff struct {
Changes []MethodDiff `json:"changes"`
OldAST *ast.AST `json:"-"` // Don't serialize ASTs
NewAST *ast.AST `json:"-"` // Don't serialize ASTs
OldSubsystem *subsystem.Subsystem `json:"-"`
NewSubsystem *subsystem.Subsystem `json:"-"`
}
SDKDiff represents the differences between two SDK configurations
func Changes ¶
func Changes(context context.Context, oldConfig, newConfig GenerateOptions) (SDKDiff, error)
Changes compares two GenerateOptions and returns the differences
func DiffASTs ¶
func DiffASTs(options DiffOptions) SDKDiff
DiffASTs compares two ASTs and returns the raw differences
type SpecComparison ¶
type TypeDefDiffResult ¶
type TypeDefDiffResult struct {
Equal bool `json:"equal"` // true if completely identical
Path []PathSegment `json:"path"` // the highest‐ancestor path at which they differ
Reason DiffReason `json:"reason"` // why they differ (only set when Equal is false)
IsBreaking bool `json:"is_breaking"` // true if the change is breaking
Children []TypeDefDiffResult `json:"children"` // all child differences found during traversal
}
TypeDefDiffResult holds the outcome of diffing two AST TypeDef trees.
func DiffTypeDefs ¶
func DiffTypeDefs(params DiffTypeDefsParams) TypeDefDiffResult
DiffTypeDefs does a DFS over two ast.TypeDef roots, detects circular refs, and returns the highest‐ancestor path where they first diverge with proper reason categorization.