Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for user-defined schemas #6

Open
nathannorman-toast opened this issue Apr 2, 2024 · 0 comments
Open

Add support for user-defined schemas #6

nathannorman-toast opened this issue Apr 2, 2024 · 0 comments

Comments

@nathannorman-toast
Copy link

Description generated by Claude 3

Currently, drivel infers the schema from the provided JSON input and generates data based on that inferred schema. While this is useful, there are cases where users may want to define their own schema and have drivel generate data based on that schema.

We should add a new feature that allows users to provide a schema file (in a format to be determined, possibly JSON Schema or a custom format) that describes the desired data structure. drivel should then generate data that conforms to this user-defined schema.

This feature would be beneficial in scenarios where:

  • The user wants to generate data with a specific structure that may not be easily inferred from a single JSON example.
  • The user wants to generate data with certain constraints or patterns that are not present in the example JSON.
  • The user wants to generate data for a schema that they have designed beforehand, without needing to provide a JSON example.

To implement this feature, we would need to:

  • Design a schema format (or adopt an existing one) that allows users to define the desired data structure, including field names, types, constraints, and relationships between fields.
  • Add a new command-line flag (e.g., --schema-file) that allows users to specify the path to their schema file.
  • Modify the produce mode to check for the presence of a user-defined schema file. If present, use that schema for data generation instead of inferring the schema from the input JSON.
  • Update the documentation to describe how to use this new feature, including examples of the schema format and how to generate data from a user-defined schema.

This feature would greatly enhance the flexibility and usefulness of drivel, allowing users to generate data for a wider variety of use cases and scenarios.

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

No branches or pull requests

1 participant