Skip to content

Invoke-DbaDbDataGenerator - Add workaround for DateTimeReference#9716

Merged
potatoqualitee merged 1 commit intodevelopmentfrom
fix_datagenerator
Jul 25, 2025
Merged

Invoke-DbaDbDataGenerator - Add workaround for DateTimeReference#9716
potatoqualitee merged 1 commit intodevelopmentfrom
fix_datagenerator

Conversation

@andreasjordan
Copy link
Copy Markdown
Collaborator

Type of Change

  • Bug fix (non-breaking change, fixes # )
  • New feature (non-breaking change, adds functionality, fixes # )
  • Breaking change (affects multiple commands or functionality, fixes # )
  • Ran manual Pester test and has passed (Invoke-ManualPester)
  • Adding code coverage to existing functionality
  • Pester test is included
  • If new file reference added for test, has is been added to github.com/dataplat/appveyor-lab ?
  • Unit test is included
  • Documentation
  • Build system

The value of the property DateTimeReference is currently $null, which causes the changed line to throw an exception.
We have to contact the developer of Bogus to solve the issue.

This is the original code to test if this throws on other installations as well:

$script:faker = New-Object Bogus.Faker('en')
$supportedFakerSubTypes = ($script:faker | Get-Member -MemberType Property) | ForEach-Object { ($script:faker.$($_.Name)) | Get-Member -MemberType Method | Where-Object { $_.Name -notlike 'To*' -and $_.Name -notlike 'Get*' -and $_.Name -notlike 'Trim*' -and $_.Name -notin 'Add', 'Equals', 'CompareTo', 'Clone', 'Contains', 'CopyTo', 'EndsWith', 'IndexOf', 'IndexOfAny', 'Insert', 'IsNormalized', 'LastIndexOf', 'LastIndexOfAny', 'Normalize', 'PadLeft', 'PadRight', 'Remove', 'Replace', 'Split', 'StartsWith', 'Substring', 'Letter', 'Lines', 'Paragraph', 'Paragraphs', 'Sentence', 'Sentences' } | Select-Object name -ExpandProperty Name }

So please test yourself and add a comment with the result.

@andreasjordan
Copy link
Copy Markdown
Collaborator Author

Old version:
image

New version:
image

So in the new version we updated the Bogus library which introduced the new property "DateTimeReference". This property is currently $null and thus must be excluded.

Should we open an issue on https://github.com/bchavez/Bogus ?

@potatoqualitee
Copy link
Copy Markdown
Member

Thank you so much, seems reasonable to open a bug on Bogus!

@potatoqualitee potatoqualitee merged commit f85add9 into development Jul 25, 2025
13 checks passed
@potatoqualitee potatoqualitee deleted the fix_datagenerator branch July 25, 2025 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants