concerto icon indicating copy to clipboard operation
concerto copied to clipboard

Factory doesn't generate empty entities

Open ekarademir opened this issue 1 year ago • 1 comments

Factory class advertises an option to generate empty entity instead of a "sample", however the option has no effect

Bug Report 🐛

As it's being used by the CLI generate command here, and being passed onto the factory class here, there should be an option to generate empty objects as advertised here.

But that option is simply being ignored.

Expected Behavior

That the factory returns an entity with empty values

Current Behavior

Returns sampled data as values

Possible Solution

Steps to Reproduce

  1. Use the setup outlined in the CLI command.
  2. Inspect the JSON document

Context (Environment)

Desktop

  • OS: macOS
  • Browser: Chrome & Node

Detailed Description

Possible Implementation

ekarademir avatar Apr 26 '24 13:04 ekarademir

@ekarademir do the String properties in your model have min/max length validators?

We made the decision when adding those that the output of the value generators should always be a valid instance. This forces us to generate some sample data even when using the empty mode.

I think that there's scope to improve the logic here, for example:

  • Generate only using spaces, when in empty mode
  • Always use the min length when specified in empty mode

mttrbrts avatar May 01 '24 12:05 mttrbrts