Skip to content

feat: add support for all valid faker paths dynamically in mock generator #35

@zhravan

Description

@zhravan

Description:

Add dynamic support for all valid Faker.js paths in the schema by resolving them safely using runtime path evaluation.

Acceptance Criteria

  • All valid Faker paths (e.g., name.lastName, location.city) should work
  • Invalid paths (e.g., invalid.path) should show meaningful errors
  • Future faker updates should not break the feature
  • Provide a dropdown/autocomplete or documentation for available faker paths
  • Add basic autocomplete inside schema editor
// create a utility maybe to resolve faker path
function resolveFakerPath(path) {
  const parts = path.split(".");
  let current = faker;
  for (const part of parts) {
    if (typeof current[part] === "undefined") {
      throw new Error("Invalid faker path: " + path);
    }
    current = current[part];
  }
  return typeof current === "function" ? current() : current;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions