Skip to content

Conversation

@jdschleicher
Copy link
Owner

@jdschleicher jdschleicher commented Jan 9, 2025

Motivation and Context

### v.1.0.0

Before this update, Salesforce Data Treecipe extension can dynamically generate a yaml recipe file capturing Salesforce fields within a Salesforce project directory.

This recipe file serves as a "key-value" structure tying a field api name to snowfakery faker function.

This PR introduces a new VS Code extension command that prompts the User to select a previously created recipe file and execute the snowfakery cli command to generate fake data based on the faker values provided for the field api names. ( https://snowfakery.readthedocs.io/en/latest/#command-line-interface )

The results of this snowfakery cli command will format the results to json and provide necessary mapping to be leveraged for easy rest api calls with the Salesforce Collections API .

What does this PR do?

  • New Extension command -> Run Snowfakery by Recipe File
    • Executing command will prompt to choose a recipe file to generate fake data from. These files are found in the path "treecipe/GeneratedRecipes"
    • Upon recipe file selection, snowfakery cli is executed against the recipe yaml file and results are outputted to json.
    • json is then formatted for for collections api a new timestamped "dataset" directory is created under the folder path "treecipe/FakeDataSets" and within this two files will be created under this directory:
      • The collectionsApi formatted file that has the recipe that generated it
      • the originating recipe file that lead to the generated fake data
    • If snowfakery cli is not installed on your machine, an exception will be thrown

Screenshot below shows an example json file that gets generated with faker data based on the yaml file recipe:

image

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Other (please describe):

How Has This Been Tested?

  • Tested on Windows
  • Tested on macOS
  • Tested on Linux
  • Added new unit tests
  • Updated existing tests

Test Details

  • expected steps to have already completed
    • initiate treecipe configuration
    • generate recipe file
  • run new command "Run Snowfakery by Recipe"
    • will be prompted for recipe files found in treecipe/GeneratedRecipes
    • upon selecting recipe, folder with dataset artifcats will be created with:
      • originating recipe file
      • formatted collections api of generated fake data from snowfakery cli

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Additional Notes

Reviewers

@mention-team-members-or-specific-reviewers

@jdschleicher jdschleicher marked this pull request as ready for review January 13, 2025 03:20
@jdschleicher jdschleicher merged commit ecbade0 into main Jan 20, 2025
2 checks passed
@jdschleicher jdschleicher deleted the feature/snowfakery-integration branch January 20, 2025 22:21
@jdschleicher jdschleicher mentioned this pull request Feb 16, 2025
16 tasks
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.

1 participant