Skip to content

Commit 328534e

Browse files
committed
chore: persistentEdits config option
1 parent 3b6e05c commit 328534e

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

configuration.go

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,19 @@ type Tests struct {
8989
SkipResponseBodyAssertions bool `yaml:"skipResponseBodyAssertions"`
9090
}
9191

92+
// PersistentEdits configures whether user edits to generated SDKs persist across regenerations
93+
// When enabled, user changes are preserved via 3-way merge with Git tracking
94+
type PersistentEdits struct {
95+
// Enabled allows user edits to generated SDK code to persist through regeneration
96+
// Requires Git repository and creates a pristine branch for tracking
97+
Enabled bool `yaml:"enabled,omitempty"`
98+
99+
// PristineBranch specifies the Git branch name for tracking pristine generated code
100+
// Defaults to "sdk-pristine" if not specified
101+
PristineBranch string `yaml:"pristineBranch,omitempty"`
102+
AdditionalProperties map[string]any `yaml:",inline"` // Captures any additional properties
103+
}
104+
92105
type AllOfMergeStrategy string
93106

94107
const (
@@ -119,7 +132,9 @@ type Generation struct {
119132
// Mock server generation configuration.
120133
MockServer *MockServer `yaml:"mockServer,omitempty"`
121134

122-
Tests Tests `yaml:"tests,omitempty"`
135+
// PersistentEdits configures whether user edits persist across regenerations
136+
PersistentEdits *PersistentEdits `yaml:"persistentEdits,omitempty"`
137+
Tests Tests `yaml:"tests,omitempty"`
123138

124139
AdditionalProperties map[string]any `yaml:",inline"` // Captures any additional properties that are not explicitly defined for backwards/forwards compatibility
125140
}
@@ -382,6 +397,18 @@ func GetGenerationDefaults(newSDK bool) []SDKGenConfigField {
382397
DefaultValue: ptr(newSDK),
383398
Description: pointer.From("Maintains the order of things like parameters and fields when generating the SDK"),
384399
},
400+
{
401+
Name: "persistentEdits.enabled",
402+
Required: false,
403+
DefaultValue: ptr(false),
404+
Description: pointer.From("Enables preservation of user edits across SDK regenerations. Requires Git repository."),
405+
},
406+
{
407+
Name: "persistentEdits.pristineBranch",
408+
Required: false,
409+
DefaultValue: ptr("sdk-pristine"),
410+
Description: pointer.From("The Git branch name for tracking pristine generated code."),
411+
},
385412
{
386413
Name: "deduplicateErrors",
387414
Required: false,

0 commit comments

Comments
 (0)