Skip to content

Commit 3556a05

Browse files
engalarclaude
andcommitted
fix: reorder JSON structure examples for correct execution
DESCRIBE must come after CREATE (was referencing non-existent structure). Add CREATE MODULE MyModule setup and DROP MODULE cleanup. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e6f388a commit 3556a05

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

mdl-examples/doctype-tests/20-json-structure-examples.mdl

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
-- JSON Structure Examples
33
-- =============================================================================
44

5-
-- List all JSON structures in the project
5+
-- MARK: Setup
6+
CREATE MODULE MyModule;
7+
8+
-- MARK: Show (empty)
9+
10+
-- List all JSON structures in the project (empty initially)
611
SHOW JSON STRUCTURES;
712

813
-- List JSON structures in a specific module
914
SHOW JSON STRUCTURES IN MyModule;
1015

11-
-- Describe a JSON structure (shows element tree + JSON snippet)
12-
DESCRIBE JSON STRUCTURE MyModule.CustomerResponse;
16+
-- MARK: Create
1317

1418
-- Create a JSON structure from a JSON snippet (single-line)
1519
CREATE JSON STRUCTURE MyModule.SimpleItem SNIPPET '{"id": 1, "name": "John", "active": true}';
@@ -43,6 +47,13 @@ CUSTOM NAME MAP (
4347
'naam' AS 'CompanyName'
4448
);
4549

50+
-- MARK: Describe
51+
52+
-- Describe a JSON structure (shows element tree + JSON snippet)
53+
DESCRIBE JSON STRUCTURE MyModule.CustomerResponse;
54+
55+
-- MARK: Replace
56+
4657
-- Edit (replace) an existing JSON structure with an updated schema
4758
CREATE OR REPLACE JSON STRUCTURE MyModule.CustomerResponse SNIPPET $${
4859
"id": 1,
@@ -61,6 +72,8 @@ CREATE OR REPLACE JSON STRUCTURE MyModule.CustomerResponse SNIPPET $${
6172
"tags": ["premium", "verified"]
6273
}$$;
6374

75+
-- MARK: Drop
76+
6477
-- Delete JSON structures
6578
DROP JSON STRUCTURE MyModule.SimpleItem;
6679

@@ -69,3 +82,6 @@ DROP JSON STRUCTURE MyModule.ApiError;
6982
DROP JSON STRUCTURE MyModule.ExternalApi;
7083

7184
DROP JSON STRUCTURE MyModule.CustomerResponse;
85+
86+
-- MARK: Cleanup
87+
DROP MODULE MyModule;

0 commit comments

Comments
 (0)