@@ -372,53 +372,67 @@ SHOW EXTERNAL ACTIONS IN OdTest;
372372-- ############################################################################
373373-- LEVEL 10: CREATE EXTERNAL ENTITIES (bulk from contract)
374374-- ############################################################################
375+ --
376+ -- Bulk-creates external entities from the TripPin RW OData service.
377+ -- Validates mendixlabs/mxcli#143: key, attribute OData mapping, and
378+ -- capability annotations are all written correctly to BSON.
379+ --
380+ -- Requires network access to services.odata.org (public, no auth).
381+ -- CREATE ODATA CLIENT fetches and caches $metadata automatically.
382+ --
383+ -- ############################################################################
375384
376- /*
377- * Level 10.1: Create all external entities from a consumed OData service.
378- * Reads the service's cached $metadata and creates one external entity
379- * per entity type in the domain model.
380- * Prerequisite: The OData client must have cached metadata (fetched during CREATE).
381- *
382- * CREATE EXTERNAL ENTITIES FROM OdTest.SalesforceAPI;
385+ /**
386+ * Level 10.0: Set up the TripPin module, role, and constant.
383387 */
388+ CREATE MODULE TripPinClient;
389+ /
384390
385- /*
386- * Level 10.2: Create external entities into a different module.
387- * By default entities are created in the same module as the service.
388- * Use INTO to redirect them.
389- *
390- * CREATE EXTERNAL ENTITIES FROM OdTest.SalesforceAPI INTO Integration;
391- */
391+ CREATE MODULE ROLE TripPinClient."User"
392+ DESCRIPTION 'Role for TripPin API access';
393+ /
392394
393- /*
394- * Level 10.3: Create only specific external entities by name.
395- * Use the ENTITIES clause to filter which entity types to create.
396- *
397- * CREATE EXTERNAL ENTITIES FROM OdTest.SalesforceAPI ENTITIES (Account, Contact);
398- */
395+ CREATE CONSTANT TripPinClient."TripPinServiceUrl"
396+ TYPE String
397+ DEFAULT 'https://services.odata.org/TripPinRESTierService/';
398+ /
399399
400- /*
401- * Level 10.4: Idempotent bulk create — updates existing entities .
402- *
403- * CREATE OR MODIFY EXTERNAL ENTITIES FROM OdTest.SalesforceAPI;
400+ /**
401+ * Level 10.1: Register the TripPin RW service .
402+ * CREATE ODATA CLIENT fetches and caches $metadata from MetadataUrl.
403+ * ServiceUrl must reference a constant (CE6825).
404404 */
405+ CREATE ODATA CLIENT TripPinClient."TripPinApiClient" (
406+ ODataVersion: OData4,
407+ MetadataUrl: 'https://services.odata.org/TripPinRESTierService/$metadata',
408+ Timeout: 300,
409+ ServiceUrl: @TripPinClient.TripPinServiceUrl,
410+ UseAuthentication: No
411+ );
412+ /
405413
406- /*
407- * Level 10.5: Combine INTO, ENTITIES filter, and OR MODIFY.
408- *
409- * CREATE OR MODIFY EXTERNAL ENTITIES FROM OdTest.SalesforceAPI INTO Integration ENTITIES (Account, Contact);
414+ /**
415+ * Level 10.2: Bulk import all entity types from the TripPin contract.
416+ * Creates one external entity per OData entity type. Top-level entity
417+ * sets (Airlines, Airports, People) use the set name; derived/contained
418+ * types (Flight, PlanItem, Trip, etc.) use the type name.
410419 */
420+ CREATE EXTERNAL ENTITIES FROM TripPinClient."TripPinApiClient";
421+ /
411422
412- -- NOTE: These commands require a live OData client with cached $metadata,
413- -- so they are shown as comments above. The syntax is validated by mxcli check.
423+ /**
424+ * Level 10.3: Import only specific entity types by name.
425+ */
426+ CREATE OR MODIFY EXTERNAL ENTITIES FROM TripPinClient."TripPinApiClient"
427+ ENTITIES (Airline, Airport);
428+ /
414429
415- -- ############################################################################
416- -- NOTE: CREATE ODATA CLIENT now auto-fetches and caches $metadata from the
417- -- MetadataUrl. CONTRACT BROWSING commands (SHOW CONTRACT ENTITIES/ACTIONS)
418- -- work on services with cached metadata. The test URLs above are not reachable
419- -- from CI, so contract browsing examples are not included here.
420- -- See cmd/mxcli/help_topics/odata.txt for syntax reference.
421- -- ############################################################################
430+ /**
431+ * Level 10.4: Import all entities into a different module.
432+ */
433+ CREATE OR MODIFY EXTERNAL ENTITIES FROM TripPinClient."TripPinApiClient"
434+ INTO TripPinClient;
435+ /
422436
423437-- ############################################################################
424438-- LEVEL 8.8: DROP (cleanup)
@@ -443,7 +457,13 @@ DROP ODATA CLIENT OdTest.SalesforceAPI;
443457/
444458
445459/**
446- * Level 8.8c: Drop an OData service
460+ * Level 8.8c: Drop the TripPin client (cascades to its external entities)
461+ */
462+ DROP ODATA CLIENT TripPinClient."TripPinApiClient";
463+ /
464+
465+ /**
466+ * Level 8.8d: Drop an OData service
447467 */
448468DROP ODATA SERVICE OdTest.CustomerAPI;
449469/
0 commit comments