synthra 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rspec +4 -0
- data/.rubocop.yml +40 -0
- data/.yardopts +18 -0
- data/ACCESS_DOCS.md +116 -0
- data/ADVANCED_FEATURES_SUMMARY.md +245 -0
- data/CHANGELOG.md +498 -0
- data/CODE_OF_CONDUCT.md +122 -0
- data/CONTRIBUTING.md +307 -0
- data/DOCUMENTATION.md +204 -0
- data/DOCUMENTATION_GUIDE.md +194 -0
- data/LICENSE +22 -0
- data/README.md +1458 -0
- data/Rakefile +128 -0
- data/benchmark/README.md +591 -0
- data/benchmark/batch_generation.rb +63 -0
- data/benchmark/engine_comparison.rb +295 -0
- data/benchmark/single_record.rb +108 -0
- data/benchmark/streaming.rb +74 -0
- data/docs/ACTIVERECORD_INFERENCE.md +524 -0
- data/docs/API_SERVER.md +278 -0
- data/docs/CONFIG_FILE.md +315 -0
- data/docs/DATA_CONTRACTS.md +312 -0
- data/docs/ENHANCED_REPL.md +304 -0
- data/docs/FACTORY_BOT.md +271 -0
- data/docs/GITHUB_ACTION.md +420 -0
- data/docs/GRAPHQL_EXPORT.md +303 -0
- data/docs/GRAPHQL_FEDERATION.md +651 -0
- data/docs/HOW_TO_GENERATE_DOCS.md +252 -0
- data/docs/LSP.md +189 -0
- data/docs/MIGRATION_GENERATOR.md +547 -0
- data/docs/MOCK_SERVER.md +280 -0
- data/docs/NATIVE_ENGINE.md +298 -0
- data/docs/OPENAPI_EXPORT.md +252 -0
- data/docs/PERFORMANCE_MODE.md +228 -0
- data/docs/PERSONAS.md +547 -0
- data/docs/PROPERTY_TESTING.md +284 -0
- data/docs/PROTOBUF_EXPORT.md +276 -0
- data/docs/QUALITY_METRICS.md +555 -0
- data/docs/QUICK_REFERENCE.md +88 -0
- data/docs/RAILS_ENGINE.md +404 -0
- data/docs/RAILS_INTEGRATION.md +454 -0
- data/docs/README.md +175 -0
- data/docs/REPL_QUICK_REFERENCE.md +149 -0
- data/docs/RUST_INTEGRATION_GUIDE.md +1376 -0
- data/docs/SCENARIOS.md +576 -0
- data/docs/SECURITY_TESTING.md +318 -0
- data/docs/SNAPSHOT_TESTING.md +308 -0
- data/docs/STRING_TEXT_TYPES_REFERENCE.md +512 -0
- data/docs/TERRAFORM_EXPORT.md +447 -0
- data/docs/TIME_TRAVEL.md +507 -0
- data/docs/USAGE_GUIDE.md +980 -0
- data/docs/WEBHOOK_SIMULATOR.md +579 -0
- data/docs/advanced_features.md +183 -0
- data/docs/api_reference.md +153 -0
- data/docs/behaviors.md +138 -0
- data/docs/best_practices.md +191 -0
- data/docs/dsl_reference.md +172 -0
- data/docs/examples.md +162 -0
- data/docs/generation_modes.md +125 -0
- data/docs/getting_started.md +92 -0
- data/docs/index.html +177 -0
- data/docs/strategic/CLOUD_REGISTRY_ARCHITECTURE.md +268 -0
- data/docs/strategic/SIMD_OPTIMIZATION_STRATEGY.md +153 -0
- data/docs/troubleshooting.md +215 -0
- data/docs/type_reference.md +224 -0
- data/examples/hostile_mode_demo.rb +64 -0
- data/exe/synthra +6 -0
- data/ext/synthra_native/Cargo.lock +972 -0
- data/ext/synthra_native/Cargo.toml +46 -0
- data/ext/synthra_native/extconf.rb +41 -0
- data/ext/synthra_native/src/generator.rs +397 -0
- data/ext/synthra_native/src/lib.rs +229 -0
- data/ext/synthra_native/src/types.rs +1485 -0
- data/lib/generators/synthra/install_generator.rb +86 -0
- data/lib/generators/synthra/templates/api_response.dsl +15 -0
- data/lib/generators/synthra/templates/fake_data.rake +116 -0
- data/lib/generators/synthra/templates/synthra.yml +31 -0
- data/lib/generators/synthra/templates/synthra_support.rb +19 -0
- data/lib/generators/synthra/templates/user.dsl +11 -0
- data/lib/synthra/activerecord_inference.rb +394 -0
- data/lib/synthra/api.rb +381 -0
- data/lib/synthra/api_server.rb +718 -0
- data/lib/synthra/behaviors/applicator.rb +165 -0
- data/lib/synthra/behaviors/base.rb +155 -0
- data/lib/synthra/behaviors/close_connection.rb +60 -0
- data/lib/synthra/behaviors/deprecated.rb +100 -0
- data/lib/synthra/behaviors/failure.rb +69 -0
- data/lib/synthra/behaviors/latency.rb +103 -0
- data/lib/synthra/behaviors/partial_data.rb +83 -0
- data/lib/synthra/behaviors/randomize_order.rb +74 -0
- data/lib/synthra/behaviors/registry.rb +238 -0
- data/lib/synthra/behaviors/simulate_error.rb +79 -0
- data/lib/synthra/cli/commands/base.rb +105 -0
- data/lib/synthra/cli/commands/diff.rb +227 -0
- data/lib/synthra/cli/commands/docs.rb +67 -0
- data/lib/synthra/cli/commands/export.rb +150 -0
- data/lib/synthra/cli/commands/generate.rb +72 -0
- data/lib/synthra/cli/commands/import.rb +80 -0
- data/lib/synthra/cli/commands/lint.rb +53 -0
- data/lib/synthra/cli/commands/live.rb +57 -0
- data/lib/synthra/cli/commands/seed.rb +99 -0
- data/lib/synthra/cli/commands/validate.rb +28 -0
- data/lib/synthra/cli.rb +2471 -0
- data/lib/synthra/config_file.rb +129 -0
- data/lib/synthra/configuration.rb +281 -0
- data/lib/synthra/contracts_registry.rb +408 -0
- data/lib/synthra/database_seeder.rb +268 -0
- data/lib/synthra/deterministic_ids.rb +218 -0
- data/lib/synthra/documentation_generator.rb +414 -0
- data/lib/synthra/engine.rb +251 -0
- data/lib/synthra/errors.rb +1169 -0
- data/lib/synthra/export/base.rb +85 -0
- data/lib/synthra/export/csv.rb +101 -0
- data/lib/synthra/export/graphql.rb +266 -0
- data/lib/synthra/export/graphql_federation.rb +377 -0
- data/lib/synthra/export/graphviz.rb +258 -0
- data/lib/synthra/export/javascript.rb +327 -0
- data/lib/synthra/export/json_data.rb +61 -0
- data/lib/synthra/export/json_schema.rb +290 -0
- data/lib/synthra/export/openapi.rb +514 -0
- data/lib/synthra/export/protobuf.rb +483 -0
- data/lib/synthra/export/python.rb +560 -0
- data/lib/synthra/export/sql.rb +381 -0
- data/lib/synthra/export/sql_insert.rb +152 -0
- data/lib/synthra/export/terraform.rb +501 -0
- data/lib/synthra/export/type_mapping.rb +389 -0
- data/lib/synthra/export/typescript.rb +300 -0
- data/lib/synthra/export/xml_data.rb +104 -0
- data/lib/synthra/export/yaml_data.rb +56 -0
- data/lib/synthra/export.rb +404 -0
- data/lib/synthra/factory_bot_integration.rb +157 -0
- data/lib/synthra/field.rb +440 -0
- data/lib/synthra/functions/registry.rb +104 -0
- data/lib/synthra/generator/context.rb +372 -0
- data/lib/synthra/generator/engine.rb +336 -0
- data/lib/synthra/generator/faker_adapter.rb +425 -0
- data/lib/synthra/generator/modes.rb +444 -0
- data/lib/synthra/generator/resolver.rb +256 -0
- data/lib/synthra/generator/rng.rb +273 -0
- data/lib/synthra/generator/streamer.rb +63 -0
- data/lib/synthra/generator/uniqueness.rb +118 -0
- data/lib/synthra/initializer.rb +97 -0
- data/lib/synthra/limits.rb +279 -0
- data/lib/synthra/live_preview.rb +518 -0
- data/lib/synthra/loader_config.rb +78 -0
- data/lib/synthra/lsp/server.rb +689 -0
- data/lib/synthra/migration_generator.rb +301 -0
- data/lib/synthra/mixin.rb +174 -0
- data/lib/synthra/mock_server.rb +458 -0
- data/lib/synthra/native_engine.rb +304 -0
- data/lib/synthra/openapi_importer.rb +228 -0
- data/lib/synthra/output/json_formatter.rb +40 -0
- data/lib/synthra/output/ndjson_formatter.rb +55 -0
- data/lib/synthra/parser/ast.rb +1287 -0
- data/lib/synthra/parser/lexer.rb +1152 -0
- data/lib/synthra/parser/parser.rb +1664 -0
- data/lib/synthra/parser/tokens.rb +461 -0
- data/lib/synthra/performance_mode.rb +364 -0
- data/lib/synthra/personas.rb +397 -0
- data/lib/synthra/property_testing.rb +172 -0
- data/lib/synthra/quality_metrics.rb +405 -0
- data/lib/synthra/rails_test_helper.rb +248 -0
- data/lib/synthra/registry.rb +533 -0
- data/lib/synthra/relationships.rb +193 -0
- data/lib/synthra/repl/enhanced_repl.rb +607 -0
- data/lib/synthra/repl/formatter.rb +191 -0
- data/lib/synthra/scenarios.rb +423 -0
- data/lib/synthra/schema.rb +605 -0
- data/lib/synthra/schema_inheritance.rb +104 -0
- data/lib/synthra/schema_versioning.rb +212 -0
- data/lib/synthra/snapshot_testing.rb +199 -0
- data/lib/synthra/time_travel.rb +338 -0
- data/lib/synthra/type_definitions.rb +274 -0
- data/lib/synthra/types/address_location/addresses.rb +125 -0
- data/lib/synthra/types/address_location/airports.rb +200 -0
- data/lib/synthra/types/address_location/banks_hospitals.rb +207 -0
- data/lib/synthra/types/address_location/locations.rb +406 -0
- data/lib/synthra/types/base.rb +48 -0
- data/lib/synthra/types/commerce_products/commerce.rb +119 -0
- data/lib/synthra/types/commerce_products/companies.rb +71 -0
- data/lib/synthra/types/commerce_products/construction.rb +126 -0
- data/lib/synthra/types/commerce_products/products.rb +205 -0
- data/lib/synthra/types/core/collections.rb +513 -0
- data/lib/synthra/types/core/defaults.rb +76 -0
- data/lib/synthra/types/core/enums.rb +102 -0
- data/lib/synthra/types/core/identifiers.rb +445 -0
- data/lib/synthra/types/core/primitives.rb +586 -0
- data/lib/synthra/types/core/references.rb +466 -0
- data/lib/synthra/types/core/sequences.rb +304 -0
- data/lib/synthra/types/crypto/crypto.rb +162 -0
- data/lib/synthra/types/date_time/dates.rb +387 -0
- data/lib/synthra/types/finance_banking/banking.rb +424 -0
- data/lib/synthra/types/finance_banking/credit_cards.rb +24 -0
- data/lib/synthra/types/finance_banking/identifiers.rb +93 -0
- data/lib/synthra/types/formula.rb +184 -0
- data/lib/synthra/types/health_medical/medical.rb +150 -0
- data/lib/synthra/types/hostile_payloads.rb +122 -0
- data/lib/synthra/types/json_array.rb +51 -0
- data/lib/synthra/types/media_entertainment/media.rb +62 -0
- data/lib/synthra/types/naughty_string.rb +30 -0
- data/lib/synthra/types/personal_names/chinese.rb +41 -0
- data/lib/synthra/types/personal_names/identifiers.rb +187 -0
- data/lib/synthra/types/personal_names/names.rb +246 -0
- data/lib/synthra/types/personal_names/national_id.rb +89 -0
- data/lib/synthra/types/personal_names/titles_suffixes.rb +41 -0
- data/lib/synthra/types/regex.rb +248 -0
- data/lib/synthra/types/registry.rb +182 -0
- data/lib/synthra/types/repeating_element.rb +50 -0
- data/lib/synthra/types/scenario.rb +29 -0
- data/lib/synthra/types/technology_internet/apps.rb +67 -0
- data/lib/synthra/types/technology_internet/communication.rb +162 -0
- data/lib/synthra/types/technology_internet/devices.rb +80 -0
- data/lib/synthra/types/technology_internet/formats.rb +139 -0
- data/lib/synthra/types/technology_internet/networking.rb +143 -0
- data/lib/synthra/types/template.rb +92 -0
- data/lib/synthra/types/text_content/business.rb +128 -0
- data/lib/synthra/types/text_content/colors.rb +70 -0
- data/lib/synthra/types/text_content/misc.rb +237 -0
- data/lib/synthra/types/text_content/security.rb +130 -0
- data/lib/synthra/types/text_content/text_generation.rb +532 -0
- data/lib/synthra/types/travel/travel.rb +150 -0
- data/lib/synthra/utils/string_distance.rb +133 -0
- data/lib/synthra/validator/dsl_validator.rb +339 -0
- data/lib/synthra/validator/path_validator.rb +615 -0
- data/lib/synthra/version.rb +35 -0
- data/lib/synthra/webhook_simulator.rb +341 -0
- data/lib/synthra.rb +259 -0
- data/schemas/address.dsl +16 -0
- data/schemas/api_response.dsl +8 -0
- data/schemas/error_payload.dsl +9 -0
- data/schemas/order.dsl +10 -0
- data/schemas/order_item.dsl +8 -0
- data/schemas/payment.dsl +11 -0
- data/schemas/social_post.dsl +13 -0
- data/schemas/user.dsl +10 -0
- data/scripts/batch_fix_all.rb +96 -0
- data/scripts/delete_old_files.rb +32 -0
- data/scripts/fix_all_grouped_files.rb +137 -0
- data/scripts/fix_all_indentation.rb +48 -0
- data/scripts/fix_all_syntax.rb +124 -0
- data/scripts/fix_grouped_files.rb +184 -0
- data/scripts/fix_syntax_errors.rb +108 -0
- data/scripts/group_domain_types.rb +112 -0
- data/scripts/group_domain_types_fixed.rb +150 -0
- data/scripts/merge_domains_to_one_file.rb +68 -0
- data/scripts/move_existing_types.rb +130 -0
- data/scripts/split_grouped_types.rb +142 -0
- data/tech_docs/README.md +134 -0
- data/tech_docs/advanced/streaming.md +405 -0
- data/tech_docs/advanced/thread_safety.md +253 -0
- data/tech_docs/api/overview.md +485 -0
- data/tech_docs/appendices/type_chart.md +193 -0
- data/tech_docs/basic_concepts.md +383 -0
- data/tech_docs/behaviors/overview.md +346 -0
- data/tech_docs/dsl/complex_types.md +790 -0
- data/tech_docs/dsl/core_types.md +464 -0
- data/tech_docs/dsl/datetime_types.md +325 -0
- data/tech_docs/dsl/field_modifiers.md +414 -0
- data/tech_docs/dsl/grammar.md +431 -0
- data/tech_docs/dsl/schema_definition.md +399 -0
- data/tech_docs/export/README.md +276 -0
- data/tech_docs/installation.md +273 -0
- data/tech_docs/integration/ci_cd.md +707 -0
- data/tech_docs/integration/ci_cd_guide.md +579 -0
- data/tech_docs/integration/factory_bot.md +485 -0
- data/tech_docs/integration/rails.md +630 -0
- data/tech_docs/integration/rspec.md +449 -0
- data/tech_docs/modes/overview.md +350 -0
- data/tech_docs/performance/NATIVE_RUST_EXTENSION.md +1270 -0
- data/tech_docs/performance/OPTIMIZATION_GUIDE.md +901 -0
- data/tech_docs/quick_start.md +256 -0
- data/tech_docs/templates/README.md +805 -0
- data/tech_docs/tutorials/advanced.md +371 -0
- data/tech_docs/tutorials/getting_started.md +189 -0
- data/tech_docs/tutorials/intermediate.md +231 -0
- data/tech_docs/tutorials/template_gallery.md +569 -0
- data/tech_example/01_basic_usage.rb +238 -0
- data/tech_example/02_types_demo.rb +336 -0
- data/tech_example/04_cli_usage.md +429 -0
- data/tech_example/05_database_seeding.rb +283 -0
- data/tech_example/07_rspec_integration.rb +359 -0
- data/tech_example/10_custom_types.rb +387 -0
- data/tech_example/12_behaviors.rb +372 -0
- data/tech_example/13_twitter_dm_example.rb +120 -0
- data/tech_example/14_exact_json_structure.rb +253 -0
- data/tech_example/16_lsp_server.rb +56 -0
- data/tech_example/17_property_testing.rb +92 -0
- data/tech_example/18_enhanced_repl.rb +120 -0
- data/tech_example/19_security_fuzzing.rb +145 -0
- data/tech_example/NEW_FEATURES.md +169 -0
- data/tech_example/README.md +118 -0
- data/tech_example/schemas/api_response.dsl +123 -0
- data/tech_example/schemas/ecommerce.dsl +121 -0
- data/tech_example/schemas/twitter_dm.dsl +109 -0
- data/tech_example/schemas/user.dsl +36 -0
- data/vscode-extension/README.md +246 -0
- data/vscode-extension/language-configuration.json +31 -0
- data/vscode-extension/package.json +55 -0
- data/vscode-extension/snippets/fakedatadsl.json +198 -0
- data/vscode-extension/syntaxes/fakedatadsl.tmLanguage.json +128 -0
- metadata +478 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# New Features Examples Summary
|
|
2
|
+
|
|
3
|
+
This document provides a quick reference for the new features added to FakeDataDSL.
|
|
4
|
+
|
|
5
|
+
## 🆕 New Features
|
|
6
|
+
|
|
7
|
+
### 1. LSP Server (Language Server Protocol)
|
|
8
|
+
**File**: `tech_example/16_lsp_server.rb`
|
|
9
|
+
|
|
10
|
+
Provides IDE integration with:
|
|
11
|
+
- Go to Definition
|
|
12
|
+
- Real-time Diagnostics
|
|
13
|
+
- Auto-completion
|
|
14
|
+
- Hover Documentation
|
|
15
|
+
|
|
16
|
+
**Usage**:
|
|
17
|
+
```bash
|
|
18
|
+
fake_data_dsl lsp
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Documentation**: [docs/LSP.md](../docs/LSP.md)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
### 2. Property-Based Testing
|
|
26
|
+
**File**: `tech_example/17_property_testing.rb`
|
|
27
|
+
|
|
28
|
+
RSpec integration for verifying properties hold for all generated data.
|
|
29
|
+
|
|
30
|
+
**Usage**:
|
|
31
|
+
```ruby
|
|
32
|
+
include FakeDataDSL::PropertyTesting
|
|
33
|
+
|
|
34
|
+
verify_property("User", count: 1000) do |user_data|
|
|
35
|
+
expect(user_data["email"]).to match(/@/)
|
|
36
|
+
end
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Documentation**: [docs/PROPERTY_TESTING.md](../docs/PROPERTY_TESTING.md)
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
### 3. Enhanced REPL
|
|
44
|
+
**File**: `tech_example/18_enhanced_repl.rb`
|
|
45
|
+
|
|
46
|
+
Interactive REPL with:
|
|
47
|
+
- Table formatting (`table User`)
|
|
48
|
+
- Step-through debugging (`debug User`)
|
|
49
|
+
- Detailed inspection (`inspect User`)
|
|
50
|
+
|
|
51
|
+
**Usage**:
|
|
52
|
+
```bash
|
|
53
|
+
fake_data_dsl repl
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Commands**:
|
|
57
|
+
- `table User` - Display record in table format
|
|
58
|
+
- `table User 5` - Display 5 records in table format
|
|
59
|
+
- `debug User` - Step-through debugging
|
|
60
|
+
- `inspect User` - Detailed inspection with statistics
|
|
61
|
+
|
|
62
|
+
**Documentation**: [docs/ENHANCED_REPL.md](../docs/ENHANCED_REPL.md)
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
### 4. Security Fuzzing (Hostile Mode)
|
|
67
|
+
**File**: `tech_example/19_security_fuzzing.rb`
|
|
68
|
+
|
|
69
|
+
Generate security attack payloads for testing:
|
|
70
|
+
- SQL Injection
|
|
71
|
+
- XSS (Cross-Site Scripting)
|
|
72
|
+
- Buffer Overflow
|
|
73
|
+
- Unicode Attacks
|
|
74
|
+
- Path Traversal
|
|
75
|
+
- Command Injection
|
|
76
|
+
|
|
77
|
+
**Usage**:
|
|
78
|
+
```ruby
|
|
79
|
+
schema.generate(mode: :hostile)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**CLI**:
|
|
83
|
+
```bash
|
|
84
|
+
fake_data_dsl generate User --mode hostile
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Documentation**: [docs/SECURITY_TESTING.md](../docs/SECURITY_TESTING.md)
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## 📚 Running Examples
|
|
92
|
+
|
|
93
|
+
All examples can be run with:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
cd tech_example
|
|
97
|
+
bundle exec ruby 16_lsp_server.rb
|
|
98
|
+
bundle exec ruby 17_property_testing.rb
|
|
99
|
+
bundle exec ruby 18_enhanced_repl.rb
|
|
100
|
+
bundle exec ruby 19_security_fuzzing.rb
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Or run all at once:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
for file in 16_*.rb 17_*.rb 18_*.rb 19_*.rb; do
|
|
107
|
+
echo "Running $file..."
|
|
108
|
+
bundle exec ruby $file
|
|
109
|
+
echo ""
|
|
110
|
+
done
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## 🔗 Related Documentation
|
|
116
|
+
|
|
117
|
+
- [LSP Integration Guide](../docs/LSP.md)
|
|
118
|
+
- [Property-Based Testing Guide](../docs/PROPERTY_TESTING.md)
|
|
119
|
+
- [Enhanced REPL Guide](../docs/ENHANCED_REPL.md)
|
|
120
|
+
- [Security Testing Guide](../docs/SECURITY_TESTING.md)
|
|
121
|
+
- [Main README](../README.md)
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## ⚠️ Important Notes
|
|
126
|
+
|
|
127
|
+
1. **LSP Server**: Requires an IDE that supports LSP (VS Code, Cursor, Neovim, etc.)
|
|
128
|
+
2. **Property Testing**: Requires RSpec to be available
|
|
129
|
+
3. **Hostile Mode**: ⚠️ Generates actual attack payloads - use only in test environments!
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## 🎯 Quick Start
|
|
134
|
+
|
|
135
|
+
### Try the Enhanced REPL
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
fake_data_dsl repl
|
|
139
|
+
> load schemas/
|
|
140
|
+
> table User
|
|
141
|
+
> debug User
|
|
142
|
+
> inspect User
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Try Property-Based Testing
|
|
146
|
+
|
|
147
|
+
```ruby
|
|
148
|
+
require 'fake_data_dsl'
|
|
149
|
+
include FakeDataDSL::PropertyTesting
|
|
150
|
+
|
|
151
|
+
verify_property("User", count: 100) do |user_data|
|
|
152
|
+
expect(user_data["email"]).to match(/@/)
|
|
153
|
+
end
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Try Security Fuzzing
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
fake_data_dsl generate User --mode hostile --count 10
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## 📝 Examples Index
|
|
165
|
+
|
|
166
|
+
- [16_lsp_server.rb](16_lsp_server.rb) - LSP server setup and usage
|
|
167
|
+
- [17_property_testing.rb](17_property_testing.rb) - Property-based testing examples
|
|
168
|
+
- [18_enhanced_repl.rb](18_enhanced_repl.rb) - Enhanced REPL features
|
|
169
|
+
- [19_security_fuzzing.rb](19_security_fuzzing.rb) - Security testing with hostile mode
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# FakeDataDSL Examples
|
|
2
|
+
|
|
3
|
+
A comprehensive collection of examples demonstrating FakeDataDSL usage.
|
|
4
|
+
|
|
5
|
+
## 📁 Example Categories
|
|
6
|
+
|
|
7
|
+
### Basic Examples
|
|
8
|
+
- [01_basic_usage.rb](01_basic_usage.rb) - Getting started with FakeDataDSL
|
|
9
|
+
- [02_types_demo.rb](02_types_demo.rb) - All built-in types demonstration
|
|
10
|
+
- [03_generation_modes.rb](03_generation_modes.rb) - Random, edge, invalid modes
|
|
11
|
+
- [04_cli_usage.md](04_cli_usage.md) - Command-line interface examples
|
|
12
|
+
|
|
13
|
+
### Schema Examples
|
|
14
|
+
- [schemas/](schemas/) - Example DSL schema files
|
|
15
|
+
- [user.dsl](schemas/user.dsl) - User schema
|
|
16
|
+
- [order.dsl](schemas/order.dsl) - E-commerce order
|
|
17
|
+
- [api_response.dsl](schemas/api_response.dsl) - API response simulation
|
|
18
|
+
- [social_media.dsl](schemas/social_media.dsl) - Social platform data
|
|
19
|
+
- [healthcare.dsl](schemas/healthcare.dsl) - Medical records
|
|
20
|
+
|
|
21
|
+
### Use Cases
|
|
22
|
+
- [05_database_seeding.rb](05_database_seeding.rb) - Seeding databases
|
|
23
|
+
- [06_api_testing.rb](06_api_testing.rb) - API response testing
|
|
24
|
+
- [07_rspec_integration.rb](07_rspec_integration.rb) - RSpec test fixtures
|
|
25
|
+
- [08_load_testing.rb](08_load_testing.rb) - High-volume generation
|
|
26
|
+
- [09_data_migration.rb](09_data_migration.rb) - Migration testing
|
|
27
|
+
|
|
28
|
+
### Advanced Examples
|
|
29
|
+
- [10_custom_types.rb](10_custom_types.rb) - Creating custom types
|
|
30
|
+
- [11_custom_functions.rb](11_custom_functions.rb) - Computed fields
|
|
31
|
+
- [12_behaviors.rb](12_behaviors.rb) - Simulating conditions
|
|
32
|
+
- [13_twitter_dm_example.rb](13_twitter_dm_example.rb) - Twitter/X Direct Message API
|
|
33
|
+
- [14_exact_json_structure.rb](14_exact_json_structure.rb) - Matching exact JSON structures
|
|
34
|
+
- [15_streaming.rb](15_streaming.rb) - Memory-efficient generation
|
|
35
|
+
- [16_lsp_server.rb](16_lsp_server.rb) - LSP server for IDE integration ⭐ NEW
|
|
36
|
+
- [17_property_testing.rb](17_property_testing.rb) - Property-based testing with RSpec ⭐ NEW
|
|
37
|
+
- [18_enhanced_repl.rb](18_enhanced_repl.rb) - Enhanced REPL with visual inspection ⭐ NEW
|
|
38
|
+
- [19_security_fuzzing.rb](19_security_fuzzing.rb) - Security testing with hostile mode ⭐ NEW
|
|
39
|
+
|
|
40
|
+
### Integration Examples
|
|
41
|
+
- [rails/](rails/) - Rails integration examples
|
|
42
|
+
- [rspec/](rspec/) - RSpec testing patterns
|
|
43
|
+
- [sidekiq/](sidekiq/) - Background job testing
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 🚀 Running Examples
|
|
48
|
+
|
|
49
|
+
### Prerequisites
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Install the gem
|
|
53
|
+
gem install fake_data_dsl
|
|
54
|
+
|
|
55
|
+
# Or add to Gemfile
|
|
56
|
+
bundle add fake_data_dsl
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Run Individual Examples
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
cd tech_example
|
|
63
|
+
ruby 01_basic_usage.rb
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Run All Examples
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
for file in *.rb; do
|
|
70
|
+
echo "Running $file..."
|
|
71
|
+
ruby $file
|
|
72
|
+
echo ""
|
|
73
|
+
done
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 📋 Quick Start
|
|
79
|
+
|
|
80
|
+
### 1. Basic Generation
|
|
81
|
+
|
|
82
|
+
```ruby
|
|
83
|
+
require 'fake_data_dsl'
|
|
84
|
+
|
|
85
|
+
# Define schema inline
|
|
86
|
+
schema = FakeDataDSL.parse(<<~DSL)
|
|
87
|
+
User:
|
|
88
|
+
id: uuid
|
|
89
|
+
name: name
|
|
90
|
+
email: email
|
|
91
|
+
DSL
|
|
92
|
+
|
|
93
|
+
# Generate data
|
|
94
|
+
user = schema.generate
|
|
95
|
+
puts user
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 2. From File
|
|
99
|
+
|
|
100
|
+
```ruby
|
|
101
|
+
# Load from file
|
|
102
|
+
schema = FakeDataDSL.load('schemas/user.dsl')
|
|
103
|
+
users = schema.generate_many(10)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 3. With Options
|
|
107
|
+
|
|
108
|
+
```ruby
|
|
109
|
+
# Reproducible output
|
|
110
|
+
user = schema.generate(seed: 12345)
|
|
111
|
+
|
|
112
|
+
# Edge cases
|
|
113
|
+
edge_user = schema.generate(mode: :edge)
|
|
114
|
+
|
|
115
|
+
# Invalid data
|
|
116
|
+
invalid_user = schema.generate(mode: :invalid)
|
|
117
|
+
```
|
|
118
|
+
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# ============================================================================
|
|
2
|
+
# API Response Schemas
|
|
3
|
+
# ============================================================================
|
|
4
|
+
# Schemas for testing API clients with realistic responses.
|
|
5
|
+
# Includes behaviors for simulating real-world conditions.
|
|
6
|
+
# ============================================================================
|
|
7
|
+
|
|
8
|
+
# Standard API response wrapper
|
|
9
|
+
APIResponse:
|
|
10
|
+
@latency 50..200ms
|
|
11
|
+
@failure 2%
|
|
12
|
+
@simulate_error 500 1%
|
|
13
|
+
|
|
14
|
+
success: boolean(true:95%)
|
|
15
|
+
request_id: uuid
|
|
16
|
+
timestamp: now
|
|
17
|
+
version: enum(v1:80%, v2:20%)
|
|
18
|
+
|
|
19
|
+
# Paginated list response
|
|
20
|
+
PaginatedResponse:
|
|
21
|
+
@latency 100..500ms
|
|
22
|
+
|
|
23
|
+
success: boolean(true:98%)
|
|
24
|
+
page: number(1..100)
|
|
25
|
+
per_page: enum(10, 25, 50, 100)
|
|
26
|
+
total_count: number(0..10000)
|
|
27
|
+
total_pages: number(1..100)
|
|
28
|
+
has_next: boolean(true:70%)
|
|
29
|
+
has_previous: boolean(true:50%)
|
|
30
|
+
|
|
31
|
+
# Error response
|
|
32
|
+
ErrorResponse:
|
|
33
|
+
success: boolean
|
|
34
|
+
error_code: enum(BAD_REQUEST, UNAUTHORIZED, FORBIDDEN, NOT_FOUND, RATE_LIMITED, INTERNAL_ERROR)
|
|
35
|
+
message: text(20..200)
|
|
36
|
+
details?: text(50..500)
|
|
37
|
+
request_id: uuid
|
|
38
|
+
timestamp: now
|
|
39
|
+
|
|
40
|
+
# Rate limited response
|
|
41
|
+
RateLimitedResponse:
|
|
42
|
+
@simulate_error 429 100%
|
|
43
|
+
|
|
44
|
+
success: boolean
|
|
45
|
+
retry_after_seconds: number(1..3600)
|
|
46
|
+
limit: number(100..10000)
|
|
47
|
+
remaining: number(0)
|
|
48
|
+
reset_at: future_date(1d)
|
|
49
|
+
|
|
50
|
+
# Slow endpoint (database heavy)
|
|
51
|
+
SlowDatabaseQuery:
|
|
52
|
+
@latency 500..3000ms
|
|
53
|
+
@failure 5%
|
|
54
|
+
|
|
55
|
+
success: boolean(true:90%)
|
|
56
|
+
query_time_ms: number(100..2500)
|
|
57
|
+
rows_affected: number(0..10000)
|
|
58
|
+
|
|
59
|
+
# External service call
|
|
60
|
+
ExternalServiceResponse:
|
|
61
|
+
@latency 200..1000ms
|
|
62
|
+
@failure 10%
|
|
63
|
+
@close_connection 2%
|
|
64
|
+
@simulate_error 503 3%
|
|
65
|
+
|
|
66
|
+
success: boolean(true:85%)
|
|
67
|
+
service_name: enum(payment_gateway, email_service, analytics, cdn)
|
|
68
|
+
response_time_ms: number(50..800)
|
|
69
|
+
|
|
70
|
+
# Webhook payload
|
|
71
|
+
WebhookPayload:
|
|
72
|
+
@latency 10..50ms
|
|
73
|
+
|
|
74
|
+
event_id: uuid
|
|
75
|
+
event_type: enum(user.created, user.updated, order.placed, order.shipped, payment.completed)
|
|
76
|
+
created_at: now
|
|
77
|
+
retry_count: number(0..5)
|
|
78
|
+
|
|
79
|
+
# Health check response
|
|
80
|
+
HealthCheck:
|
|
81
|
+
@latency 5..20ms
|
|
82
|
+
@failure 1%
|
|
83
|
+
|
|
84
|
+
status: enum(healthy:95%, degraded:4%, unhealthy:1%)
|
|
85
|
+
version: text(5..10)
|
|
86
|
+
uptime_seconds: number(0..31536000)
|
|
87
|
+
checks: enum(database:ok, cache:ok, queue:ok)
|
|
88
|
+
|
|
89
|
+
# Authentication response
|
|
90
|
+
AuthResponse:
|
|
91
|
+
@latency 100..300ms
|
|
92
|
+
@simulate_error 401 5%
|
|
93
|
+
|
|
94
|
+
success: boolean(true:90%)
|
|
95
|
+
access_token?: text(100..200)
|
|
96
|
+
refresh_token?: text(100..200)
|
|
97
|
+
expires_in?: number(300..86400)
|
|
98
|
+
token_type?: const("Bearer")
|
|
99
|
+
|
|
100
|
+
# File upload response
|
|
101
|
+
FileUploadResponse:
|
|
102
|
+
@latency 500..5000ms
|
|
103
|
+
@failure 3%
|
|
104
|
+
@simulate_error 413 2%
|
|
105
|
+
|
|
106
|
+
success: boolean(true:92%)
|
|
107
|
+
file_id?: uuid
|
|
108
|
+
filename?: text(10..100)
|
|
109
|
+
size_bytes?: number(1..104857600)
|
|
110
|
+
mime_type?: enum(image/jpeg, image/png, application/pdf, text/plain)
|
|
111
|
+
url?: url
|
|
112
|
+
|
|
113
|
+
# Search response
|
|
114
|
+
SearchResponse:
|
|
115
|
+
@latency 50..500ms
|
|
116
|
+
@partial_data 5%
|
|
117
|
+
|
|
118
|
+
success: boolean(true:98%)
|
|
119
|
+
query: text(1..100)
|
|
120
|
+
total_results: number(0..100000)
|
|
121
|
+
took_ms: number(10..400)
|
|
122
|
+
max_score: number(0.0..1.0)
|
|
123
|
+
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# ============================================================================
|
|
2
|
+
# E-commerce Schemas
|
|
3
|
+
# ============================================================================
|
|
4
|
+
# Complete e-commerce data model demonstrating complex relationships.
|
|
5
|
+
# ============================================================================
|
|
6
|
+
|
|
7
|
+
# Product catalog
|
|
8
|
+
Product:
|
|
9
|
+
id: uuid(unique: true)
|
|
10
|
+
sku: text(10)
|
|
11
|
+
name: text(10..80)
|
|
12
|
+
description: text(100..500)
|
|
13
|
+
price_cents: number(100..100000)
|
|
14
|
+
currency: enum(USD:70%, EUR:20%, GBP:10%)
|
|
15
|
+
category: enum(electronics:25%, clothing:25%, home:20%, sports:15%, books:15%)
|
|
16
|
+
brand: company_name
|
|
17
|
+
in_stock: boolean(true:85%)
|
|
18
|
+
stock_quantity: number(0..1000)
|
|
19
|
+
weight_grams: number(50..50000)
|
|
20
|
+
rating: number(1.0..5.0)
|
|
21
|
+
review_count: number(0..5000)
|
|
22
|
+
created_at: past_date(2y)
|
|
23
|
+
updated_at: past_date(30d)
|
|
24
|
+
|
|
25
|
+
# Customer account
|
|
26
|
+
Customer:
|
|
27
|
+
id: uuid(unique: true)
|
|
28
|
+
email: email(unique: true)
|
|
29
|
+
first_name: first_name
|
|
30
|
+
last_name: last_name
|
|
31
|
+
phone?: phone
|
|
32
|
+
loyalty_tier: enum(bronze:60%, silver:25%, gold:10%, platinum:5%)
|
|
33
|
+
total_orders: number(0..100)
|
|
34
|
+
total_spent_cents: number(0..10000000)
|
|
35
|
+
created_at: past_date(3y)
|
|
36
|
+
|
|
37
|
+
# Shipping address
|
|
38
|
+
Address:
|
|
39
|
+
id: uuid
|
|
40
|
+
street_line1: street_address
|
|
41
|
+
street_line2?: text(5..50)
|
|
42
|
+
city: city
|
|
43
|
+
state?: state
|
|
44
|
+
postal_code: postal_code
|
|
45
|
+
country: country_code
|
|
46
|
+
is_default: boolean(false:80%)
|
|
47
|
+
|
|
48
|
+
# Shopping cart
|
|
49
|
+
Cart:
|
|
50
|
+
id: uuid
|
|
51
|
+
session_id: uuid
|
|
52
|
+
item_count: number(0..20)
|
|
53
|
+
subtotal_cents: number(0..500000)
|
|
54
|
+
created_at: past_date(7d)
|
|
55
|
+
updated_at: past_date(1d)
|
|
56
|
+
expires_at: future_date(30d)
|
|
57
|
+
|
|
58
|
+
# Cart item
|
|
59
|
+
CartItem:
|
|
60
|
+
id: uuid
|
|
61
|
+
quantity: number(1..10)
|
|
62
|
+
unit_price_cents: number(100..100000)
|
|
63
|
+
added_at: past_date(7d)
|
|
64
|
+
|
|
65
|
+
# Order
|
|
66
|
+
Order:
|
|
67
|
+
id: uuid(unique: true)
|
|
68
|
+
order_number: text(12)
|
|
69
|
+
status: enum(pending:15%, processing:10%, shipped:35%, delivered:35%, cancelled:5%)
|
|
70
|
+
subtotal_cents: number(1000..500000)
|
|
71
|
+
shipping_cents: number(0..5000)
|
|
72
|
+
tax_cents: number(0..50000)
|
|
73
|
+
discount_cents: number(0..50000)
|
|
74
|
+
total_cents: number(1000..600000)
|
|
75
|
+
currency: enum(USD:70%, EUR:20%, GBP:10%)
|
|
76
|
+
notes?: text(10..200)
|
|
77
|
+
created_at: past_date(90d)
|
|
78
|
+
updated_at: past_date(7d)
|
|
79
|
+
shipped_at?: past_date(60d)
|
|
80
|
+
delivered_at?: past_date(30d)
|
|
81
|
+
|
|
82
|
+
# Order line item
|
|
83
|
+
OrderItem:
|
|
84
|
+
id: uuid
|
|
85
|
+
quantity: number(1..5)
|
|
86
|
+
unit_price_cents: number(100..100000)
|
|
87
|
+
discount_cents: number(0..10000)
|
|
88
|
+
subtotal_cents: number(100..500000)
|
|
89
|
+
|
|
90
|
+
# Payment
|
|
91
|
+
Payment:
|
|
92
|
+
id: uuid
|
|
93
|
+
method: enum(credit_card:60%, paypal:25%, bank_transfer:10%, crypto:5%)
|
|
94
|
+
status: enum(pending:10%, completed:80%, failed:5%, refunded:5%)
|
|
95
|
+
amount_cents: number(1000..600000)
|
|
96
|
+
currency: enum(USD:70%, EUR:20%, GBP:10%)
|
|
97
|
+
transaction_id: uuid
|
|
98
|
+
processed_at: past_date(90d)
|
|
99
|
+
|
|
100
|
+
# Review
|
|
101
|
+
Review:
|
|
102
|
+
id: uuid
|
|
103
|
+
rating: number(1..5)
|
|
104
|
+
title?: text(10..100)
|
|
105
|
+
body: text(50..1000)
|
|
106
|
+
verified_purchase: boolean(true:75%)
|
|
107
|
+
helpful_votes: number(0..500)
|
|
108
|
+
created_at: past_date(1y)
|
|
109
|
+
|
|
110
|
+
# Coupon
|
|
111
|
+
Coupon:
|
|
112
|
+
id: uuid
|
|
113
|
+
code: text(6..12)
|
|
114
|
+
discount_type: enum(percentage:60%, fixed:40%)
|
|
115
|
+
discount_value: number(5..50)
|
|
116
|
+
min_order_cents: number(0..10000)
|
|
117
|
+
max_uses: number(1..10000)
|
|
118
|
+
current_uses: number(0..5000)
|
|
119
|
+
expires_at: future_date(90d)
|
|
120
|
+
active: boolean(true:80%)
|
|
121
|
+
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# ============================================================================
|
|
2
|
+
# Twitter/X Direct Message Schema
|
|
3
|
+
# ============================================================================
|
|
4
|
+
# Generates realistic Twitter Direct Message API response data.
|
|
5
|
+
# Uses ONLY built-in FakeDataDSL types - no custom registration needed!
|
|
6
|
+
#
|
|
7
|
+
# Built-in types used:
|
|
8
|
+
# - snowflake_id : 19-digit Twitter/Discord style ID
|
|
9
|
+
# - unix_timestamp_ms : Unix timestamp in milliseconds
|
|
10
|
+
# - numeric_string_id : 9-19 digit numeric string
|
|
11
|
+
# - message_text : Chat message text using Faker
|
|
12
|
+
# - empty_array : Always returns []
|
|
13
|
+
# - social_handle : Social media username
|
|
14
|
+
# - hashtag_text : Hashtag without # prefix
|
|
15
|
+
# - indices_pair : [start, end] position pair
|
|
16
|
+
# ============================================================================
|
|
17
|
+
|
|
18
|
+
# Main Direct Message Event
|
|
19
|
+
DirectMessageEvent:
|
|
20
|
+
type: const("message_create")
|
|
21
|
+
id: snowflake_id
|
|
22
|
+
created_timestamp: unix_timestamp_ms
|
|
23
|
+
message_create: MessageCreate
|
|
24
|
+
|
|
25
|
+
# Message Create Object
|
|
26
|
+
MessageCreate:
|
|
27
|
+
target: MessageTarget
|
|
28
|
+
sender_id: numeric_string_id
|
|
29
|
+
message_data: MessageData
|
|
30
|
+
|
|
31
|
+
# Target Recipient
|
|
32
|
+
MessageTarget:
|
|
33
|
+
recipient_id: numeric_string_id
|
|
34
|
+
|
|
35
|
+
# Message Data with Text and Entities
|
|
36
|
+
MessageData:
|
|
37
|
+
text: message_text
|
|
38
|
+
entities: MessageEntities
|
|
39
|
+
|
|
40
|
+
# Entities Object (Twitter-style)
|
|
41
|
+
# Use empty_array for fields that should be []
|
|
42
|
+
MessageEntities:
|
|
43
|
+
hashtags: empty_array
|
|
44
|
+
symbols: empty_array
|
|
45
|
+
user_mentions: empty_array
|
|
46
|
+
urls: empty_array
|
|
47
|
+
|
|
48
|
+
# ============================================================================
|
|
49
|
+
# Extended Schemas (with populated entities)
|
|
50
|
+
# ============================================================================
|
|
51
|
+
|
|
52
|
+
# Full entities with actual content
|
|
53
|
+
FullMessageEntities:
|
|
54
|
+
hashtags: array(Hashtag, 0..3)
|
|
55
|
+
symbols: array(Symbol, 0..2)
|
|
56
|
+
user_mentions: array(UserMention, 0..3)
|
|
57
|
+
urls: array(UrlEntity, 0..2)
|
|
58
|
+
|
|
59
|
+
# Hashtag Entity
|
|
60
|
+
Hashtag:
|
|
61
|
+
text: hashtag_text
|
|
62
|
+
indices: indices_pair
|
|
63
|
+
|
|
64
|
+
# Symbol/Cashtag Entity
|
|
65
|
+
Symbol:
|
|
66
|
+
text: text(3..6)
|
|
67
|
+
indices: indices_pair
|
|
68
|
+
|
|
69
|
+
# User Mention Entity
|
|
70
|
+
UserMention:
|
|
71
|
+
screen_name: social_handle
|
|
72
|
+
name: name
|
|
73
|
+
id: numeric_string_id
|
|
74
|
+
id_str: numeric_string_id
|
|
75
|
+
indices: indices_pair
|
|
76
|
+
|
|
77
|
+
# URL Entity
|
|
78
|
+
UrlEntity:
|
|
79
|
+
url: url
|
|
80
|
+
expanded_url: url
|
|
81
|
+
display_url: text(15..40)
|
|
82
|
+
indices: indices_pair
|
|
83
|
+
|
|
84
|
+
# ============================================================================
|
|
85
|
+
# Webhook Event Wrapper
|
|
86
|
+
# ============================================================================
|
|
87
|
+
|
|
88
|
+
WebhookEvent:
|
|
89
|
+
for_user_id: numeric_string_id
|
|
90
|
+
direct_message_events: array(DirectMessageEvent, 1..5)
|
|
91
|
+
|
|
92
|
+
# ============================================================================
|
|
93
|
+
# Alternative: DM with full entities
|
|
94
|
+
# ============================================================================
|
|
95
|
+
|
|
96
|
+
DirectMessageEventFull:
|
|
97
|
+
type: const("message_create")
|
|
98
|
+
id: snowflake_id
|
|
99
|
+
created_timestamp: unix_timestamp_ms
|
|
100
|
+
message_create: MessageCreateFull
|
|
101
|
+
|
|
102
|
+
MessageCreateFull:
|
|
103
|
+
target: MessageTarget
|
|
104
|
+
sender_id: numeric_string_id
|
|
105
|
+
message_data: MessageDataFull
|
|
106
|
+
|
|
107
|
+
MessageDataFull:
|
|
108
|
+
text: message_text
|
|
109
|
+
entities: FullMessageEntities
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# ============================================================================
|
|
2
|
+
# User Schema
|
|
3
|
+
# ============================================================================
|
|
4
|
+
# Comprehensive user schema for testing and development.
|
|
5
|
+
# This schema demonstrates most common patterns in FakeDataDSL.
|
|
6
|
+
# ============================================================================
|
|
7
|
+
|
|
8
|
+
User:
|
|
9
|
+
# Primary identifier
|
|
10
|
+
id: uuid(unique: true, version: 7)
|
|
11
|
+
|
|
12
|
+
# Personal information
|
|
13
|
+
first_name: first_name
|
|
14
|
+
last_name: last_name
|
|
15
|
+
email: email(unique: true)
|
|
16
|
+
phone?: phone
|
|
17
|
+
|
|
18
|
+
# Profile
|
|
19
|
+
username: username
|
|
20
|
+
avatar?: url
|
|
21
|
+
bio?: text(50..500)
|
|
22
|
+
|
|
23
|
+
# Account settings
|
|
24
|
+
role: enum(user:80%, admin:15%, superadmin:5%)
|
|
25
|
+
status: enum(active:85%, inactive:10%, suspended:5%)
|
|
26
|
+
verified: boolean(true:60%)
|
|
27
|
+
|
|
28
|
+
# Preferences
|
|
29
|
+
locale: enum(en:60%, es:15%, fr:10%, de:10%, ja:5%)
|
|
30
|
+
timezone: time_zone
|
|
31
|
+
|
|
32
|
+
# Metadata
|
|
33
|
+
created_at: past_date(2y)
|
|
34
|
+
updated_at: past_date(30d)
|
|
35
|
+
last_login?: past_date(7d)
|
|
36
|
+
|