Skip to content
This repository was archived by the owner on Nov 27, 2025. It is now read-only.

Merge autogen config#81

Merged
AlexeyRaga merged 7 commits intomasterfrom
merge-autogen-config
Mar 29, 2025
Merged

Merge autogen config#81
AlexeyRaga merged 7 commits intomasterfrom
merge-autogen-config

Conversation

@AlexeyRaga
Copy link
Copy Markdown
Collaborator

Description

Adding an ability to merge AutoGenConfigs.
This can also be used to finally enable hedgehogqa/fsharp-hedgehog-xunit#11 (cc @dharmaturtle)

In order to do it in a useful way we need to update AutoGenConfig fields types for seqRange and recursionDepth to be optional.
This would allow us to preserve values that are set by user rather than override them with the default values on each merge.

type AutoGenConfig = internal {
  seqRange: Range<int> option
  recursionDepth: int option
  generators: GeneratorCollection
}

I also made the constructor internal so that in the future, if we want to extend the type or update it, we won't face breaking users. And in the record we can use types that have no reason to be exposable to external consumers, like GeneratorCollection.

Scenario:
I may want to configure my project-level "default" value of AutoGenConfig, registering generators and setting meaningful (to me) defaults for seqRange and recursionDepth.
With XUnit support is done via attributes.
Then on test level I can also specify attributes, which would be contributing to my "global default" AutoGenConfig.
And unless I explicitly configured different seqRange or recursionDepth I want my "global default" settings to be preserved.

NOTE: THIS IS A BREAKING CHANGE!
However, it is a very narrow use case that only breaks a very small amount of usages.
In fact, searching through GItHub I only found one case that will break: https://github.com/cmeeren/Fling/blob/4041b69995ad5176f7b550d20b1472a681425004/src/Fling.Tests/Tests.fs#L100

@cmeeren, I do not think that it'd be a huge deal to update that line?

Of course, there can be private repositories in which we cannot see.

But I think that this breaking change should be easy to recover from...

@cmeeren
Copy link
Copy Markdown
Collaborator

cmeeren commented Mar 26, 2025

@cmeeren, I do not think that it'd be a huge deal to update that line?

No problem for me. Breaking changes is a fact of life anyway.

(Unsubscribing, ping me if needed.)

@AlexeyRaga AlexeyRaga marked this pull request as draft March 26, 2025 10:04
@AlexeyRaga AlexeyRaga marked this pull request as ready for review March 26, 2025 10:13
@AlexeyRaga AlexeyRaga merged commit 07156d8 into master Mar 29, 2025
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants