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.
Files changed (302) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +4 -0
  3. data/.rubocop.yml +40 -0
  4. data/.yardopts +18 -0
  5. data/ACCESS_DOCS.md +116 -0
  6. data/ADVANCED_FEATURES_SUMMARY.md +245 -0
  7. data/CHANGELOG.md +498 -0
  8. data/CODE_OF_CONDUCT.md +122 -0
  9. data/CONTRIBUTING.md +307 -0
  10. data/DOCUMENTATION.md +204 -0
  11. data/DOCUMENTATION_GUIDE.md +194 -0
  12. data/LICENSE +22 -0
  13. data/README.md +1458 -0
  14. data/Rakefile +128 -0
  15. data/benchmark/README.md +591 -0
  16. data/benchmark/batch_generation.rb +63 -0
  17. data/benchmark/engine_comparison.rb +295 -0
  18. data/benchmark/single_record.rb +108 -0
  19. data/benchmark/streaming.rb +74 -0
  20. data/docs/ACTIVERECORD_INFERENCE.md +524 -0
  21. data/docs/API_SERVER.md +278 -0
  22. data/docs/CONFIG_FILE.md +315 -0
  23. data/docs/DATA_CONTRACTS.md +312 -0
  24. data/docs/ENHANCED_REPL.md +304 -0
  25. data/docs/FACTORY_BOT.md +271 -0
  26. data/docs/GITHUB_ACTION.md +420 -0
  27. data/docs/GRAPHQL_EXPORT.md +303 -0
  28. data/docs/GRAPHQL_FEDERATION.md +651 -0
  29. data/docs/HOW_TO_GENERATE_DOCS.md +252 -0
  30. data/docs/LSP.md +189 -0
  31. data/docs/MIGRATION_GENERATOR.md +547 -0
  32. data/docs/MOCK_SERVER.md +280 -0
  33. data/docs/NATIVE_ENGINE.md +298 -0
  34. data/docs/OPENAPI_EXPORT.md +252 -0
  35. data/docs/PERFORMANCE_MODE.md +228 -0
  36. data/docs/PERSONAS.md +547 -0
  37. data/docs/PROPERTY_TESTING.md +284 -0
  38. data/docs/PROTOBUF_EXPORT.md +276 -0
  39. data/docs/QUALITY_METRICS.md +555 -0
  40. data/docs/QUICK_REFERENCE.md +88 -0
  41. data/docs/RAILS_ENGINE.md +404 -0
  42. data/docs/RAILS_INTEGRATION.md +454 -0
  43. data/docs/README.md +175 -0
  44. data/docs/REPL_QUICK_REFERENCE.md +149 -0
  45. data/docs/RUST_INTEGRATION_GUIDE.md +1376 -0
  46. data/docs/SCENARIOS.md +576 -0
  47. data/docs/SECURITY_TESTING.md +318 -0
  48. data/docs/SNAPSHOT_TESTING.md +308 -0
  49. data/docs/STRING_TEXT_TYPES_REFERENCE.md +512 -0
  50. data/docs/TERRAFORM_EXPORT.md +447 -0
  51. data/docs/TIME_TRAVEL.md +507 -0
  52. data/docs/USAGE_GUIDE.md +980 -0
  53. data/docs/WEBHOOK_SIMULATOR.md +579 -0
  54. data/docs/advanced_features.md +183 -0
  55. data/docs/api_reference.md +153 -0
  56. data/docs/behaviors.md +138 -0
  57. data/docs/best_practices.md +191 -0
  58. data/docs/dsl_reference.md +172 -0
  59. data/docs/examples.md +162 -0
  60. data/docs/generation_modes.md +125 -0
  61. data/docs/getting_started.md +92 -0
  62. data/docs/index.html +177 -0
  63. data/docs/strategic/CLOUD_REGISTRY_ARCHITECTURE.md +268 -0
  64. data/docs/strategic/SIMD_OPTIMIZATION_STRATEGY.md +153 -0
  65. data/docs/troubleshooting.md +215 -0
  66. data/docs/type_reference.md +224 -0
  67. data/examples/hostile_mode_demo.rb +64 -0
  68. data/exe/synthra +6 -0
  69. data/ext/synthra_native/Cargo.lock +972 -0
  70. data/ext/synthra_native/Cargo.toml +46 -0
  71. data/ext/synthra_native/extconf.rb +41 -0
  72. data/ext/synthra_native/src/generator.rs +397 -0
  73. data/ext/synthra_native/src/lib.rs +229 -0
  74. data/ext/synthra_native/src/types.rs +1485 -0
  75. data/lib/generators/synthra/install_generator.rb +86 -0
  76. data/lib/generators/synthra/templates/api_response.dsl +15 -0
  77. data/lib/generators/synthra/templates/fake_data.rake +116 -0
  78. data/lib/generators/synthra/templates/synthra.yml +31 -0
  79. data/lib/generators/synthra/templates/synthra_support.rb +19 -0
  80. data/lib/generators/synthra/templates/user.dsl +11 -0
  81. data/lib/synthra/activerecord_inference.rb +394 -0
  82. data/lib/synthra/api.rb +381 -0
  83. data/lib/synthra/api_server.rb +718 -0
  84. data/lib/synthra/behaviors/applicator.rb +165 -0
  85. data/lib/synthra/behaviors/base.rb +155 -0
  86. data/lib/synthra/behaviors/close_connection.rb +60 -0
  87. data/lib/synthra/behaviors/deprecated.rb +100 -0
  88. data/lib/synthra/behaviors/failure.rb +69 -0
  89. data/lib/synthra/behaviors/latency.rb +103 -0
  90. data/lib/synthra/behaviors/partial_data.rb +83 -0
  91. data/lib/synthra/behaviors/randomize_order.rb +74 -0
  92. data/lib/synthra/behaviors/registry.rb +238 -0
  93. data/lib/synthra/behaviors/simulate_error.rb +79 -0
  94. data/lib/synthra/cli/commands/base.rb +105 -0
  95. data/lib/synthra/cli/commands/diff.rb +227 -0
  96. data/lib/synthra/cli/commands/docs.rb +67 -0
  97. data/lib/synthra/cli/commands/export.rb +150 -0
  98. data/lib/synthra/cli/commands/generate.rb +72 -0
  99. data/lib/synthra/cli/commands/import.rb +80 -0
  100. data/lib/synthra/cli/commands/lint.rb +53 -0
  101. data/lib/synthra/cli/commands/live.rb +57 -0
  102. data/lib/synthra/cli/commands/seed.rb +99 -0
  103. data/lib/synthra/cli/commands/validate.rb +28 -0
  104. data/lib/synthra/cli.rb +2471 -0
  105. data/lib/synthra/config_file.rb +129 -0
  106. data/lib/synthra/configuration.rb +281 -0
  107. data/lib/synthra/contracts_registry.rb +408 -0
  108. data/lib/synthra/database_seeder.rb +268 -0
  109. data/lib/synthra/deterministic_ids.rb +218 -0
  110. data/lib/synthra/documentation_generator.rb +414 -0
  111. data/lib/synthra/engine.rb +251 -0
  112. data/lib/synthra/errors.rb +1169 -0
  113. data/lib/synthra/export/base.rb +85 -0
  114. data/lib/synthra/export/csv.rb +101 -0
  115. data/lib/synthra/export/graphql.rb +266 -0
  116. data/lib/synthra/export/graphql_federation.rb +377 -0
  117. data/lib/synthra/export/graphviz.rb +258 -0
  118. data/lib/synthra/export/javascript.rb +327 -0
  119. data/lib/synthra/export/json_data.rb +61 -0
  120. data/lib/synthra/export/json_schema.rb +290 -0
  121. data/lib/synthra/export/openapi.rb +514 -0
  122. data/lib/synthra/export/protobuf.rb +483 -0
  123. data/lib/synthra/export/python.rb +560 -0
  124. data/lib/synthra/export/sql.rb +381 -0
  125. data/lib/synthra/export/sql_insert.rb +152 -0
  126. data/lib/synthra/export/terraform.rb +501 -0
  127. data/lib/synthra/export/type_mapping.rb +389 -0
  128. data/lib/synthra/export/typescript.rb +300 -0
  129. data/lib/synthra/export/xml_data.rb +104 -0
  130. data/lib/synthra/export/yaml_data.rb +56 -0
  131. data/lib/synthra/export.rb +404 -0
  132. data/lib/synthra/factory_bot_integration.rb +157 -0
  133. data/lib/synthra/field.rb +440 -0
  134. data/lib/synthra/functions/registry.rb +104 -0
  135. data/lib/synthra/generator/context.rb +372 -0
  136. data/lib/synthra/generator/engine.rb +336 -0
  137. data/lib/synthra/generator/faker_adapter.rb +425 -0
  138. data/lib/synthra/generator/modes.rb +444 -0
  139. data/lib/synthra/generator/resolver.rb +256 -0
  140. data/lib/synthra/generator/rng.rb +273 -0
  141. data/lib/synthra/generator/streamer.rb +63 -0
  142. data/lib/synthra/generator/uniqueness.rb +118 -0
  143. data/lib/synthra/initializer.rb +97 -0
  144. data/lib/synthra/limits.rb +279 -0
  145. data/lib/synthra/live_preview.rb +518 -0
  146. data/lib/synthra/loader_config.rb +78 -0
  147. data/lib/synthra/lsp/server.rb +689 -0
  148. data/lib/synthra/migration_generator.rb +301 -0
  149. data/lib/synthra/mixin.rb +174 -0
  150. data/lib/synthra/mock_server.rb +458 -0
  151. data/lib/synthra/native_engine.rb +304 -0
  152. data/lib/synthra/openapi_importer.rb +228 -0
  153. data/lib/synthra/output/json_formatter.rb +40 -0
  154. data/lib/synthra/output/ndjson_formatter.rb +55 -0
  155. data/lib/synthra/parser/ast.rb +1287 -0
  156. data/lib/synthra/parser/lexer.rb +1152 -0
  157. data/lib/synthra/parser/parser.rb +1664 -0
  158. data/lib/synthra/parser/tokens.rb +461 -0
  159. data/lib/synthra/performance_mode.rb +364 -0
  160. data/lib/synthra/personas.rb +397 -0
  161. data/lib/synthra/property_testing.rb +172 -0
  162. data/lib/synthra/quality_metrics.rb +405 -0
  163. data/lib/synthra/rails_test_helper.rb +248 -0
  164. data/lib/synthra/registry.rb +533 -0
  165. data/lib/synthra/relationships.rb +193 -0
  166. data/lib/synthra/repl/enhanced_repl.rb +607 -0
  167. data/lib/synthra/repl/formatter.rb +191 -0
  168. data/lib/synthra/scenarios.rb +423 -0
  169. data/lib/synthra/schema.rb +605 -0
  170. data/lib/synthra/schema_inheritance.rb +104 -0
  171. data/lib/synthra/schema_versioning.rb +212 -0
  172. data/lib/synthra/snapshot_testing.rb +199 -0
  173. data/lib/synthra/time_travel.rb +338 -0
  174. data/lib/synthra/type_definitions.rb +274 -0
  175. data/lib/synthra/types/address_location/addresses.rb +125 -0
  176. data/lib/synthra/types/address_location/airports.rb +200 -0
  177. data/lib/synthra/types/address_location/banks_hospitals.rb +207 -0
  178. data/lib/synthra/types/address_location/locations.rb +406 -0
  179. data/lib/synthra/types/base.rb +48 -0
  180. data/lib/synthra/types/commerce_products/commerce.rb +119 -0
  181. data/lib/synthra/types/commerce_products/companies.rb +71 -0
  182. data/lib/synthra/types/commerce_products/construction.rb +126 -0
  183. data/lib/synthra/types/commerce_products/products.rb +205 -0
  184. data/lib/synthra/types/core/collections.rb +513 -0
  185. data/lib/synthra/types/core/defaults.rb +76 -0
  186. data/lib/synthra/types/core/enums.rb +102 -0
  187. data/lib/synthra/types/core/identifiers.rb +445 -0
  188. data/lib/synthra/types/core/primitives.rb +586 -0
  189. data/lib/synthra/types/core/references.rb +466 -0
  190. data/lib/synthra/types/core/sequences.rb +304 -0
  191. data/lib/synthra/types/crypto/crypto.rb +162 -0
  192. data/lib/synthra/types/date_time/dates.rb +387 -0
  193. data/lib/synthra/types/finance_banking/banking.rb +424 -0
  194. data/lib/synthra/types/finance_banking/credit_cards.rb +24 -0
  195. data/lib/synthra/types/finance_banking/identifiers.rb +93 -0
  196. data/lib/synthra/types/formula.rb +184 -0
  197. data/lib/synthra/types/health_medical/medical.rb +150 -0
  198. data/lib/synthra/types/hostile_payloads.rb +122 -0
  199. data/lib/synthra/types/json_array.rb +51 -0
  200. data/lib/synthra/types/media_entertainment/media.rb +62 -0
  201. data/lib/synthra/types/naughty_string.rb +30 -0
  202. data/lib/synthra/types/personal_names/chinese.rb +41 -0
  203. data/lib/synthra/types/personal_names/identifiers.rb +187 -0
  204. data/lib/synthra/types/personal_names/names.rb +246 -0
  205. data/lib/synthra/types/personal_names/national_id.rb +89 -0
  206. data/lib/synthra/types/personal_names/titles_suffixes.rb +41 -0
  207. data/lib/synthra/types/regex.rb +248 -0
  208. data/lib/synthra/types/registry.rb +182 -0
  209. data/lib/synthra/types/repeating_element.rb +50 -0
  210. data/lib/synthra/types/scenario.rb +29 -0
  211. data/lib/synthra/types/technology_internet/apps.rb +67 -0
  212. data/lib/synthra/types/technology_internet/communication.rb +162 -0
  213. data/lib/synthra/types/technology_internet/devices.rb +80 -0
  214. data/lib/synthra/types/technology_internet/formats.rb +139 -0
  215. data/lib/synthra/types/technology_internet/networking.rb +143 -0
  216. data/lib/synthra/types/template.rb +92 -0
  217. data/lib/synthra/types/text_content/business.rb +128 -0
  218. data/lib/synthra/types/text_content/colors.rb +70 -0
  219. data/lib/synthra/types/text_content/misc.rb +237 -0
  220. data/lib/synthra/types/text_content/security.rb +130 -0
  221. data/lib/synthra/types/text_content/text_generation.rb +532 -0
  222. data/lib/synthra/types/travel/travel.rb +150 -0
  223. data/lib/synthra/utils/string_distance.rb +133 -0
  224. data/lib/synthra/validator/dsl_validator.rb +339 -0
  225. data/lib/synthra/validator/path_validator.rb +615 -0
  226. data/lib/synthra/version.rb +35 -0
  227. data/lib/synthra/webhook_simulator.rb +341 -0
  228. data/lib/synthra.rb +259 -0
  229. data/schemas/address.dsl +16 -0
  230. data/schemas/api_response.dsl +8 -0
  231. data/schemas/error_payload.dsl +9 -0
  232. data/schemas/order.dsl +10 -0
  233. data/schemas/order_item.dsl +8 -0
  234. data/schemas/payment.dsl +11 -0
  235. data/schemas/social_post.dsl +13 -0
  236. data/schemas/user.dsl +10 -0
  237. data/scripts/batch_fix_all.rb +96 -0
  238. data/scripts/delete_old_files.rb +32 -0
  239. data/scripts/fix_all_grouped_files.rb +137 -0
  240. data/scripts/fix_all_indentation.rb +48 -0
  241. data/scripts/fix_all_syntax.rb +124 -0
  242. data/scripts/fix_grouped_files.rb +184 -0
  243. data/scripts/fix_syntax_errors.rb +108 -0
  244. data/scripts/group_domain_types.rb +112 -0
  245. data/scripts/group_domain_types_fixed.rb +150 -0
  246. data/scripts/merge_domains_to_one_file.rb +68 -0
  247. data/scripts/move_existing_types.rb +130 -0
  248. data/scripts/split_grouped_types.rb +142 -0
  249. data/tech_docs/README.md +134 -0
  250. data/tech_docs/advanced/streaming.md +405 -0
  251. data/tech_docs/advanced/thread_safety.md +253 -0
  252. data/tech_docs/api/overview.md +485 -0
  253. data/tech_docs/appendices/type_chart.md +193 -0
  254. data/tech_docs/basic_concepts.md +383 -0
  255. data/tech_docs/behaviors/overview.md +346 -0
  256. data/tech_docs/dsl/complex_types.md +790 -0
  257. data/tech_docs/dsl/core_types.md +464 -0
  258. data/tech_docs/dsl/datetime_types.md +325 -0
  259. data/tech_docs/dsl/field_modifiers.md +414 -0
  260. data/tech_docs/dsl/grammar.md +431 -0
  261. data/tech_docs/dsl/schema_definition.md +399 -0
  262. data/tech_docs/export/README.md +276 -0
  263. data/tech_docs/installation.md +273 -0
  264. data/tech_docs/integration/ci_cd.md +707 -0
  265. data/tech_docs/integration/ci_cd_guide.md +579 -0
  266. data/tech_docs/integration/factory_bot.md +485 -0
  267. data/tech_docs/integration/rails.md +630 -0
  268. data/tech_docs/integration/rspec.md +449 -0
  269. data/tech_docs/modes/overview.md +350 -0
  270. data/tech_docs/performance/NATIVE_RUST_EXTENSION.md +1270 -0
  271. data/tech_docs/performance/OPTIMIZATION_GUIDE.md +901 -0
  272. data/tech_docs/quick_start.md +256 -0
  273. data/tech_docs/templates/README.md +805 -0
  274. data/tech_docs/tutorials/advanced.md +371 -0
  275. data/tech_docs/tutorials/getting_started.md +189 -0
  276. data/tech_docs/tutorials/intermediate.md +231 -0
  277. data/tech_docs/tutorials/template_gallery.md +569 -0
  278. data/tech_example/01_basic_usage.rb +238 -0
  279. data/tech_example/02_types_demo.rb +336 -0
  280. data/tech_example/04_cli_usage.md +429 -0
  281. data/tech_example/05_database_seeding.rb +283 -0
  282. data/tech_example/07_rspec_integration.rb +359 -0
  283. data/tech_example/10_custom_types.rb +387 -0
  284. data/tech_example/12_behaviors.rb +372 -0
  285. data/tech_example/13_twitter_dm_example.rb +120 -0
  286. data/tech_example/14_exact_json_structure.rb +253 -0
  287. data/tech_example/16_lsp_server.rb +56 -0
  288. data/tech_example/17_property_testing.rb +92 -0
  289. data/tech_example/18_enhanced_repl.rb +120 -0
  290. data/tech_example/19_security_fuzzing.rb +145 -0
  291. data/tech_example/NEW_FEATURES.md +169 -0
  292. data/tech_example/README.md +118 -0
  293. data/tech_example/schemas/api_response.dsl +123 -0
  294. data/tech_example/schemas/ecommerce.dsl +121 -0
  295. data/tech_example/schemas/twitter_dm.dsl +109 -0
  296. data/tech_example/schemas/user.dsl +36 -0
  297. data/vscode-extension/README.md +246 -0
  298. data/vscode-extension/language-configuration.json +31 -0
  299. data/vscode-extension/package.json +55 -0
  300. data/vscode-extension/snippets/fakedatadsl.json +198 -0
  301. data/vscode-extension/syntaxes/fakedatadsl.tmLanguage.json +128 -0
  302. metadata +478 -0
@@ -0,0 +1,805 @@
1
+ # Schema Templates Gallery
2
+
3
+ Production-ready schema templates for common use cases. Copy and customize for your needs.
4
+
5
+ ## Table of Contents
6
+
7
+ - [API Response](#api-response)
8
+ - [User Authentication](#user-authentication)
9
+ - [E-Commerce](#e-commerce)
10
+ - [Social Media](#social-media)
11
+ - [Webhook Events](#webhook-events)
12
+ - [Database Seeding](#database-seeding)
13
+ - [GraphQL Types](#graphql-types)
14
+ - [IoT Sensor Data](#iot-sensor-data)
15
+ - [Financial Transactions](#financial-transactions)
16
+ - [Logging & Analytics](#logging--analytics)
17
+ - [Messaging & Chat](#messaging--chat)
18
+ - [Content Management](#content-management)
19
+
20
+ ---
21
+
22
+ ## API Response
23
+
24
+ Standard REST API response wrapper with pagination.
25
+
26
+ ```dsl
27
+ # api_response.dsl
28
+ APIResponse:
29
+ success: boolean(true:95%)
30
+ data: object
31
+ meta: ResponseMeta
32
+ errors?: array(APIError, 0..3)
33
+
34
+ ResponseMeta:
35
+ request_id: uuid
36
+ timestamp: now
37
+ version: const("1.0")
38
+ pagination?: Pagination
39
+
40
+ Pagination:
41
+ page: number(1..100)
42
+ per_page: number(10..100)
43
+ total_items: number(0..10000)
44
+ total_pages: number(1..100)
45
+
46
+ APIError:
47
+ code: enum(VALIDATION_ERROR, NOT_FOUND, UNAUTHORIZED, RATE_LIMITED)
48
+ message: text(20..100)
49
+ field?: text(5..30)
50
+ ```
51
+
52
+ **Ruby Usage:**
53
+ ```ruby
54
+ schema = FakeDataDSL.load('api_response.dsl')
55
+ response = schema.generate(seed: 42)
56
+ ```
57
+
58
+ **CLI Usage:**
59
+ ```bash
60
+ fake_data_dsl generate APIResponse -d schemas/ --pretty
61
+ ```
62
+
63
+ ---
64
+
65
+ ## User Authentication
66
+
67
+ Complete user authentication system with sessions and tokens.
68
+
69
+ ```dsl
70
+ # auth.dsl
71
+ User:
72
+ id: uuid(unique: true)
73
+ email: email
74
+ password_hash: password_hash
75
+ first_name: first_name
76
+ last_name: last_name
77
+ full_name: custom(:full_name)
78
+ role: enum(user:80%, admin:5%, moderator:15%)
79
+ status: enum(active:85%, suspended:5%, pending:10%)
80
+ email_verified: boolean(true:90%)
81
+ created_at: past_date(2y)
82
+ updated_at: past_date(30d)
83
+ last_login?: past_date(7d)
84
+
85
+ Session:
86
+ id: uuid
87
+ user_id: Ref(User.id)
88
+ token: sha256
89
+ ip_address: ip
90
+ user_agent: user_agent
91
+ expires_at: future_date(7d)
92
+ created_at: now
93
+
94
+ AuthToken:
95
+ access_token: sha256
96
+ refresh_token: sha256
97
+ token_type: const("Bearer")
98
+ expires_in: number(3600..86400)
99
+ scope: enum(read, write, admin)
100
+ user_id: Ref(User.id)
101
+
102
+ LoginAttempt:
103
+ id: uuid
104
+ email: email
105
+ success: boolean(true:85%)
106
+ ip_address: ip
107
+ user_agent: user_agent
108
+ timestamp: now
109
+ failure_reason?: enum(invalid_password, account_locked, email_not_found)
110
+ ```
111
+
112
+ **Register custom function:**
113
+ ```ruby
114
+ FakeDataDSL.register_function(:full_name) do |ctx|
115
+ "#{ctx['first_name']} #{ctx['last_name']}"
116
+ end
117
+ ```
118
+
119
+ ---
120
+
121
+ ## E-Commerce
122
+
123
+ Complete e-commerce system with products, orders, and inventory.
124
+
125
+ ```dsl
126
+ # ecommerce.dsl
127
+ Product:
128
+ id: uuid(unique: true)
129
+ sku: sku
130
+ name: product_name
131
+ description: text(50..500)
132
+ price: money(range: 9.99..999.99)
133
+ sale_price?: money(range: 4.99..499.99)
134
+ category: product_category
135
+ subcategory: product_subcategory
136
+ brand: company_name
137
+ in_stock: boolean(true:85%)
138
+ stock_quantity: number(0..1000)
139
+ images: array(url, 1..5)
140
+ tags: array(text(3..20), 0..10)
141
+ rating: number(1..5)
142
+ review_count: number(0..500)
143
+ created_at: past_date(2y)
144
+
145
+ Order:
146
+ id: uuid(unique: true)
147
+ order_number: digit_sequence(start: "ORD-", pad: 8)
148
+ customer: Customer
149
+ customer_id: copy("customer.id")
150
+ items: array(OrderItem, 1..10)
151
+ subtotal: custom(:calculate_subtotal)
152
+ tax: custom(:calculate_tax)
153
+ shipping: money(range: 0..50)
154
+ total: custom(:calculate_total)
155
+ status: enum(pending:20%, processing:15%, shipped:30%, delivered:30%, cancelled:5%)
156
+ shipping_address: Address
157
+ billing_address: Address
158
+ payment_method: PaymentMethod
159
+ created_at: past_date(30d)
160
+ updated_at: past_date(7d)
161
+
162
+ OrderItem:
163
+ id: uuid
164
+ product_id: Ref(Product.id)
165
+ product_name: product_name
166
+ quantity: number(1..5)
167
+ unit_price: money(range: 9.99..999.99)
168
+ discount?: number(0..50)
169
+
170
+ Customer:
171
+ id: uuid(unique: true)
172
+ email: email
173
+ first_name: first_name
174
+ last_name: last_name
175
+ phone?: phone
176
+ tier: enum(standard:70%, silver:20%, gold:10%)
177
+ lifetime_value: money(range: 0..10000)
178
+ created_at: past_date(3y)
179
+
180
+ Address:
181
+ street: address
182
+ city: city
183
+ state: state
184
+ postal_code: postal_code
185
+ country: country_code
186
+
187
+ PaymentMethod:
188
+ type: enum(credit_card:60%, paypal:25%, apple_pay:10%, bank_transfer:5%)
189
+ last_four?: text(4)
190
+ card_type?: credit_card_type
191
+ ```
192
+
193
+ **Custom functions:**
194
+ ```ruby
195
+ FakeDataDSL.register_function(:calculate_subtotal) do |ctx|
196
+ items = ctx['items'] || []
197
+ items.sum { |item| (item['quantity'] || 1) * (item['unit_price'] || 0) }.round(2)
198
+ end
199
+
200
+ FakeDataDSL.register_function(:calculate_tax) do |ctx|
201
+ ((ctx['subtotal'] || 0) * 0.08).round(2)
202
+ end
203
+
204
+ FakeDataDSL.register_function(:calculate_total) do |ctx|
205
+ subtotal = ctx['subtotal'] || 0
206
+ tax = ctx['tax'] || 0
207
+ shipping = ctx['shipping'] || 0
208
+ (subtotal + tax + shipping).round(2)
209
+ end
210
+ ```
211
+
212
+ ---
213
+
214
+ ## Social Media
215
+
216
+ Social media platform with posts, comments, and followers.
217
+
218
+ ```dsl
219
+ # social_media.dsl
220
+ SocialUser:
221
+ id: snowflake_id
222
+ username: social_handle
223
+ display_name: full_name
224
+ bio?: text(0..160)
225
+ avatar_url: avatar
226
+ verified: boolean(true:5%)
227
+ follower_count: number(0..1000000)
228
+ following_count: number(0..5000)
229
+ post_count: number(0..10000)
230
+ joined_at: past_date(5y)
231
+ location?: city
232
+
233
+ Post:
234
+ id: snowflake_id
235
+ author: SocialUser
236
+ author_id: copy("author.id")
237
+ content: text(1..280)
238
+ media?: array(MediaAttachment, 0..4)
239
+ hashtags: array(hashtag_text, 0..5)
240
+ mentions: array(social_handle, 0..10)
241
+ like_count: number(0..100000)
242
+ repost_count: number(0..10000)
243
+ reply_count: number(0..5000)
244
+ created_at: past_date(30d)
245
+ is_reply: boolean(true:30%)
246
+ reply_to_id?: snowflake_id
247
+
248
+ MediaAttachment:
249
+ id: uuid
250
+ type: enum(image:70%, video:20%, gif:10%)
251
+ url: url
252
+ thumbnail_url?: url
253
+ width: number(100..4000)
254
+ height: number(100..4000)
255
+ duration_ms?: number(1000..600000)
256
+
257
+ Comment:
258
+ id: uuid
259
+ post_id: Ref(Post.id)
260
+ author_id: Ref(SocialUser.id)
261
+ content: text(1..500)
262
+ like_count: number(0..1000)
263
+ created_at: past_date(7d)
264
+ is_edited: boolean(true:10%)
265
+
266
+ Follow:
267
+ id: uuid
268
+ follower_id: Ref(SocialUser.id)
269
+ following_id: Ref(SocialUser.id)
270
+ created_at: past_date(2y)
271
+ notifications_enabled: boolean(true:60%)
272
+ ```
273
+
274
+ ---
275
+
276
+ ## Webhook Events
277
+
278
+ Generic webhook event system for integrations.
279
+
280
+ ```dsl
281
+ # webhooks.dsl
282
+ WebhookEvent:
283
+ id: uuid
284
+ type: enum(user.created, user.updated, order.placed, order.shipped, payment.completed)
285
+ version: const("1.0")
286
+ created_at: now
287
+ data: WebhookPayload
288
+ metadata: WebhookMetadata
289
+
290
+ WebhookPayload:
291
+ object_type: enum(user, order, payment, subscription)
292
+ object_id: uuid
293
+ previous_attributes?: object
294
+ current_attributes: object
295
+
296
+ WebhookMetadata:
297
+ request_id: uuid
298
+ idempotency_key: uuid
299
+ webhook_id: uuid
300
+ attempt: number(1..5)
301
+ timestamp: unix_timestamp_ms
302
+
303
+ WebhookDelivery:
304
+ id: uuid
305
+ event_id: Ref(WebhookEvent.id)
306
+ endpoint_url: url
307
+ status: enum(pending, delivered, failed, retrying)
308
+ http_status?: number(200..599)
309
+ response_time_ms?: number(50..5000)
310
+ error_message?: text(10..200)
311
+ attempts: number(1..5)
312
+ next_retry_at?: future_date(1h)
313
+ delivered_at?: past_date(1h)
314
+
315
+ WebhookEndpoint:
316
+ id: uuid
317
+ url: url
318
+ secret: sha256
319
+ events: array(enum(user.created, user.updated, order.placed), 1..5)
320
+ enabled: boolean(true:90%)
321
+ created_at: past_date(1y)
322
+ ```
323
+
324
+ ---
325
+
326
+ ## Database Seeding
327
+
328
+ Database seed data for development environments.
329
+
330
+ ```dsl
331
+ # database_seed.dsl
332
+ Department:
333
+ id: id_sequence
334
+ name: department_corporate
335
+ code: text(2..4)
336
+ manager_id?: Ref(Employee.id)
337
+ budget: money(range: 50000..5000000)
338
+ created_at: past_date(5y)
339
+
340
+ Employee:
341
+ id: id_sequence
342
+ employee_number: digit_sequence(start: "EMP", pad: 6)
343
+ email: email
344
+ first_name: first_name
345
+ last_name: last_name
346
+ department_id: Ref(Department.id)
347
+ job_title: job_title
348
+ salary: money(range: 30000..250000)
349
+ hire_date: past_date(10y)
350
+ termination_date?: past_date(1y)
351
+ is_active: boolean(true:90%)
352
+ manager_id?: Ref(Employee.id)
353
+
354
+ Project:
355
+ id: id_sequence
356
+ name: catch_phrase
357
+ code: text(3..8)
358
+ department_id: Ref(Department.id)
359
+ lead_id: Ref(Employee.id)
360
+ budget: money(range: 10000..1000000)
361
+ start_date: past_date(2y)
362
+ end_date?: future_date(1y)
363
+ status: enum(planning:10%, active:50%, completed:30%, cancelled:10%)
364
+
365
+ TimeEntry:
366
+ id: id_sequence
367
+ employee_id: Ref(Employee.id)
368
+ project_id: Ref(Project.id)
369
+ date: past_date(30d)
370
+ hours: number(1..8)
371
+ description: text(10..200)
372
+ billable: boolean(true:80%)
373
+ approved: boolean(true:85%)
374
+ ```
375
+
376
+ ---
377
+
378
+ ## GraphQL Types
379
+
380
+ GraphQL-style types with connections and edges.
381
+
382
+ ```dsl
383
+ # graphql_types.dsl
384
+ PageInfo:
385
+ hasNextPage: boolean
386
+ hasPreviousPage: boolean
387
+ startCursor: uuid
388
+ endCursor: uuid
389
+
390
+ UserConnection:
391
+ edges: array(UserEdge, 0..20)
392
+ pageInfo: PageInfo
393
+ totalCount: number(0..1000)
394
+
395
+ UserEdge:
396
+ node: GraphQLUser
397
+ cursor: uuid
398
+
399
+ GraphQLUser:
400
+ id: uuid
401
+ email: email
402
+ name: full_name
403
+ avatar: avatar
404
+ createdAt: timestamp
405
+ updatedAt: timestamp
406
+ posts: PostConnection
407
+
408
+ PostConnection:
409
+ edges: array(PostEdge, 0..10)
410
+ pageInfo: PageInfo
411
+ totalCount: number(0..100)
412
+
413
+ PostEdge:
414
+ node: GraphQLPost
415
+ cursor: uuid
416
+
417
+ GraphQLPost:
418
+ id: uuid
419
+ title: text(10..100)
420
+ body: paragraph(1..3)
421
+ author: GraphQLUser
422
+ publishedAt?: timestamp
423
+ tags: array(text(3..20), 0..5)
424
+ ```
425
+
426
+ ---
427
+
428
+ ## IoT Sensor Data
429
+
430
+ IoT device telemetry and sensor readings.
431
+
432
+ ```dsl
433
+ # iot.dsl
434
+ Device:
435
+ id: uuid(unique: true)
436
+ device_id: text(10..20)
437
+ name: text(5..50)
438
+ type: enum(temperature, humidity, motion, light, air_quality)
439
+ location: DeviceLocation
440
+ firmware_version: app_version
441
+ battery_level?: number(0..100)
442
+ is_online: boolean(true:90%)
443
+ last_seen: past_date(1h)
444
+ registered_at: past_date(2y)
445
+
446
+ DeviceLocation:
447
+ building: text(5..30)
448
+ floor: number(1..50)
449
+ room: text(3..20)
450
+ latitude: latitude
451
+ longitude: longitude
452
+
453
+ SensorReading:
454
+ id: uuid
455
+ device_id: Ref(Device.id)
456
+ timestamp: now
457
+ reading_type: enum(temperature, humidity, motion, light, co2, pm25)
458
+ value: number(0..1000)
459
+ unit: enum(celsius, fahrenheit, percent, lux, ppm, ug_m3)
460
+ quality: enum(good:80%, moderate:15%, poor:5%)
461
+
462
+ Alert:
463
+ id: uuid
464
+ device_id: Ref(Device.id)
465
+ type: enum(threshold_exceeded, device_offline, battery_low, anomaly_detected)
466
+ severity: enum(info:40%, warning:35%, critical:20%, emergency:5%)
467
+ message: text(20..200)
468
+ acknowledged: boolean(true:60%)
469
+ acknowledged_by?: email
470
+ acknowledged_at?: past_date(1d)
471
+ created_at: past_date(7d)
472
+
473
+ Telemetry:
474
+ device_id: Ref(Device.id)
475
+ timestamp: now
476
+ cpu_usage: number(0..100)
477
+ memory_usage: number(0..100)
478
+ network_latency_ms: number(1..500)
479
+ uptime_seconds: number(0..31536000)
480
+ ```
481
+
482
+ ---
483
+
484
+ ## Financial Transactions
485
+
486
+ Banking and financial transaction data.
487
+
488
+ ```dsl
489
+ # financial.dsl
490
+ BankAccount:
491
+ id: uuid(unique: true)
492
+ account_number: account_number
493
+ routing_number: bank_routing_number
494
+ type: enum(checking:60%, savings:30%, money_market:10%)
495
+ balance: money(range: 0..1000000)
496
+ currency: currency
497
+ holder_name: full_name
498
+ opened_at: past_date(10y)
499
+ status: enum(active:90%, frozen:5%, closed:5%)
500
+
501
+ Transaction:
502
+ id: uuid
503
+ reference_number: digit_sequence(start: "TXN", pad: 12)
504
+ account_id: Ref(BankAccount.id)
505
+ type: enum(deposit:30%, withdrawal:25%, transfer:25%, payment:15%, fee:5%)
506
+ amount: transaction_amount
507
+ currency: currency
508
+ balance_after: money(range: 0..1000000)
509
+ description: text(10..100)
510
+ category: enum(income, expense, transfer, fee, refund)
511
+ merchant?: MerchantInfo
512
+ status: enum(completed:85%, pending:10%, failed:3%, reversed:2%)
513
+ created_at: past_date(90d)
514
+ processed_at?: past_date(90d)
515
+
516
+ MerchantInfo:
517
+ name: company_name
518
+ category: enum(retail, food, transport, utilities, entertainment)
519
+ mcc_code: text(4)
520
+ city?: city
521
+ country: country_code
522
+
523
+ Investment:
524
+ id: uuid
525
+ account_id: Ref(BankAccount.id)
526
+ symbol: text(1..5)
527
+ name: company_name
528
+ type: enum(stock:50%, etf:25%, bond:15%, mutual_fund:10%)
529
+ quantity: number(1..10000)
530
+ purchase_price: money(range: 1..5000)
531
+ current_price: money(range: 1..5000)
532
+ purchase_date: past_date(5y)
533
+
534
+ Wire Transfer:
535
+ id: uuid
536
+ reference: digit_sequence(start: "WIRE", pad: 10)
537
+ sender_account: BankAccount
538
+ sender_account_id: copy("sender_account.id")
539
+ recipient_name: full_name
540
+ recipient_iban: iban
541
+ recipient_swift: bank_swift_bic
542
+ amount: transaction_amount
543
+ currency: currency
544
+ fee: money(range: 10..50)
545
+ purpose: text(10..100)
546
+ status: enum(initiated:10%, processing:20%, completed:60%, failed:5%, cancelled:5%)
547
+ initiated_at: past_date(7d)
548
+ completed_at?: past_date(7d)
549
+ ```
550
+
551
+ ---
552
+
553
+ ## Logging & Analytics
554
+
555
+ Application logs and analytics events.
556
+
557
+ ```dsl
558
+ # logging.dsl
559
+ LogEntry:
560
+ id: uuid
561
+ timestamp: now
562
+ level: enum(DEBUG:10%, INFO:50%, WARN:25%, ERROR:12%, FATAL:3%)
563
+ service: enum(api, worker, scheduler, auth, payment)
564
+ message: text(20..500)
565
+ context: LogContext
566
+ stack_trace?: text(100..2000)
567
+
568
+ LogContext:
569
+ request_id: uuid
570
+ user_id?: uuid
571
+ session_id?: uuid
572
+ ip_address: ip
573
+ user_agent?: user_agent
574
+ duration_ms?: number(1..30000)
575
+ http_method?: enum(GET, POST, PUT, DELETE, PATCH)
576
+ http_path?: text(5..100)
577
+ http_status?: number(200..599)
578
+
579
+ AnalyticsEvent:
580
+ id: uuid
581
+ event_name: enum(page_view, button_click, form_submit, purchase, signup, login)
582
+ timestamp: now
583
+ user_id?: uuid
584
+ session_id: uuid
585
+ device_id: uuid
586
+ properties: EventProperties
587
+ context: AnalyticsContext
588
+
589
+ EventProperties:
590
+ page_url?: url
591
+ referrer?: url
592
+ element_id?: text(5..50)
593
+ value?: text(1..100)
594
+ revenue?: money(range: 0..10000)
595
+ currency?: currency
596
+
597
+ AnalyticsContext:
598
+ app_version: app_version
599
+ platform: enum(web:60%, ios:25%, android:15%)
600
+ os: enum(Windows, macOS, Linux, iOS, Android)
601
+ browser?: enum(Chrome, Firefox, Safari, Edge)
602
+ screen_width: number(320..3840)
603
+ screen_height: number(480..2160)
604
+ locale: language_code
605
+ timezone: timezone
606
+
607
+ Metric:
608
+ name: enum(response_time, error_rate, throughput, cpu_usage, memory_usage)
609
+ value: number(0..100000)
610
+ unit: enum(ms, percent, requests_per_second, bytes)
611
+ tags: MetricTags
612
+ timestamp: now
613
+
614
+ MetricTags:
615
+ service: enum(api, worker, database, cache)
616
+ environment: enum(production, staging, development)
617
+ region: enum(us-east-1, us-west-2, eu-west-1, ap-southeast-1)
618
+ instance_id: text(10..20)
619
+ ```
620
+
621
+ ---
622
+
623
+ ## Messaging & Chat
624
+
625
+ Real-time messaging and chat application.
626
+
627
+ ```dsl
628
+ # messaging.dsl
629
+ Conversation:
630
+ id: uuid
631
+ type: enum(direct:60%, group:40%)
632
+ name?: text(3..50)
633
+ participants: array(ConversationParticipant, 2..50)
634
+ created_by: Ref(ChatUser.id)
635
+ created_at: past_date(1y)
636
+ updated_at: past_date(1h)
637
+ last_message_at?: past_date(1h)
638
+
639
+ ConversationParticipant:
640
+ user_id: Ref(ChatUser.id)
641
+ role: enum(member:80%, admin:15%, owner:5%)
642
+ joined_at: past_date(1y)
643
+ muted: boolean(true:10%)
644
+ last_read_at?: past_date(1h)
645
+
646
+ ChatUser:
647
+ id: uuid(unique: true)
648
+ username: social_handle
649
+ display_name: full_name
650
+ avatar_url: avatar
651
+ status: enum(online:30%, away:20%, busy:10%, offline:40%)
652
+ last_seen: past_date(1d)
653
+
654
+ Message:
655
+ id: snowflake_id
656
+ conversation_id: Ref(Conversation.id)
657
+ sender_id: Ref(ChatUser.id)
658
+ content: message_text
659
+ type: enum(text:85%, image:8%, file:5%, system:2%)
660
+ attachments?: array(MessageAttachment, 0..5)
661
+ reactions: array(Reaction, 0..20)
662
+ reply_to_id?: snowflake_id
663
+ edited_at?: past_date(1h)
664
+ deleted_at?: past_date(1h)
665
+ created_at: past_date(30d)
666
+
667
+ MessageAttachment:
668
+ id: uuid
669
+ type: enum(image, video, audio, document)
670
+ url: url
671
+ filename: file_name
672
+ size_bytes: number(1000..100000000)
673
+ mime_type: mime_type
674
+
675
+ Reaction:
676
+ user_id: Ref(ChatUser.id)
677
+ emoji: enum(👍, ❤️, 😂, 😮, 😢, 🎉)
678
+ created_at: past_date(7d)
679
+
680
+ TypingIndicator:
681
+ conversation_id: Ref(Conversation.id)
682
+ user_id: Ref(ChatUser.id)
683
+ started_at: now
684
+ expires_at: future_date(5s)
685
+ ```
686
+
687
+ ---
688
+
689
+ ## Content Management
690
+
691
+ CMS and content management system.
692
+
693
+ ```dsl
694
+ # cms.dsl
695
+ Article:
696
+ id: uuid(unique: true)
697
+ slug: text(10..100)
698
+ title: text(20..200)
699
+ excerpt: text(50..300)
700
+ content: paragraphs(3..10)
701
+ author: Author
702
+ author_id: copy("author.id")
703
+ category: Category
704
+ tags: array(Tag, 0..10)
705
+ featured_image?: MediaAsset
706
+ status: enum(draft:20%, published:70%, archived:10%)
707
+ published_at?: past_date(1y)
708
+ created_at: past_date(2y)
709
+ updated_at: past_date(30d)
710
+ view_count: number(0..100000)
711
+ reading_time_minutes: number(1..30)
712
+
713
+ Author:
714
+ id: uuid
715
+ name: full_name
716
+ email: email
717
+ bio?: text(50..500)
718
+ avatar: avatar
719
+ social_links?: SocialLinks
720
+
721
+ SocialLinks:
722
+ twitter?: url
723
+ linkedin?: url
724
+ github?: url
725
+ website?: url
726
+
727
+ Category:
728
+ id: uuid
729
+ name: text(3..50)
730
+ slug: text(3..50)
731
+ description?: text(20..200)
732
+ parent_id?: uuid
733
+ article_count: number(0..1000)
734
+
735
+ Tag:
736
+ id: uuid
737
+ name: text(2..30)
738
+ slug: text(2..30)
739
+ article_count: number(0..500)
740
+
741
+ MediaAsset:
742
+ id: uuid
743
+ type: enum(image:70%, video:20%, document:10%)
744
+ url: url
745
+ alt_text?: text(10..100)
746
+ width?: number(100..4000)
747
+ height?: number(100..4000)
748
+ size_bytes: number(1000..50000000)
749
+ uploaded_at: past_date(1y)
750
+
751
+ Comment:
752
+ id: uuid
753
+ article_id: Ref(Article.id)
754
+ author_name: full_name
755
+ author_email: email
756
+ content: text(10..1000)
757
+ status: enum(pending:20%, approved:70%, spam:10%)
758
+ parent_id?: uuid
759
+ created_at: past_date(30d)
760
+ likes: number(0..100)
761
+ ```
762
+
763
+ ---
764
+
765
+ ## Usage Tips
766
+
767
+ ### 1. Combine Templates
768
+
769
+ ```dsl
770
+ # Combine auth + ecommerce
771
+ Order:
772
+ customer: User # From auth template
773
+ items: array(OrderItem, 1..5) # From ecommerce template
774
+ ```
775
+
776
+ ### 2. Customize for Your Needs
777
+
778
+ ```dsl
779
+ # Extend with custom fields
780
+ User:
781
+ id: uuid
782
+ # ... base fields ...
783
+ tenant_id: uuid # Multi-tenant extension
784
+ preferences: UserPreferences # Custom extension
785
+ ```
786
+
787
+ ### 3. Use with Registry
788
+
789
+ ```ruby
790
+ registry = FakeDataDSL::Registry.new
791
+ registry.load_file('auth.dsl')
792
+ registry.load_file('ecommerce.dsl')
793
+
794
+ # Generate with cross-schema references
795
+ order = registry.schema('Order').generate(registry: registry)
796
+ ```
797
+
798
+ ---
799
+
800
+ ## Next Steps
801
+
802
+ - [CI/CD Integration Guide](../integration/ci_cd_guide.md)
803
+ - [Complex Types Reference](../dsl/complex_types.md)
804
+ - [Custom Types Guide](../api/custom_types.md)
805
+