-
Notifications
You must be signed in to change notification settings - Fork 6
Revise Command
The revise command updates a bundle to conform to schema changes, normalize entity structures, and apply transformations. It's essential for migrating bundles between Gateway versions and ensuring bundle compatibility.
graphman revise --input <input-file>
[--output <output-file>]
[--options.<name> <value>,...]| Parameter | Description |
|---|---|
--input |
Input bundle file to revise |
| Parameter | Description | Default |
|---|---|---|
--output |
Output file for revised bundle | Standard output (console) |
--options.<name> |
Customize revise operation | See defaults below |
| Option | Default | Description |
|---|---|---|
normalize |
false |
Normalize/sanitize bundle for import |
excludeGoids |
false |
Remove GOIDs from entities (requires normalize) |
The revise command automatically:
- Updates entity structures to match current schema
- Adds new required fields with default values
- Removes deprecated fields
- Transforms field values to new formats
- Adjusts entity relationships
When normalize: true:
- Sanitizes bundle for import operations
- Removes duplicate entities
- Validates entity structures
- Applies import-ready transformations
- Optionally removes GOIDs
Revise bundle to current schema:
graphman revise --input old-bundle.json --output revised-bundle.jsonNormalize bundle for import:
graphman revise --input bundle.json --output normalized.json --options.normalize truePrepare portable bundle without GOIDs:
graphman revise --input bundle.json --output portable.json \
--options.normalize true \
--options.excludeGoids trueView revised bundle without saving:
graphman revise --input bundle.json --options.normalize trueMigrate bundle from older Gateway version:
# Export from old gateway (v10.x)
graphman export --gateway old-gw --output old-version.json
# Revise for new gateway (v11.x)
graphman revise --input old-version.json --output migrated.json
# Import to new gateway
graphman import --input migrated.json --gateway new-gwUpdate bundle to match current schema:
graphman revise --input legacy-bundle.json --output current-schema.jsonPrepare bundle for cross-environment deployment:
graphman revise --input dev-bundle.json --output portable.json \
--options.normalize true \
--options.excludeGoids trueClean up and normalize a bundle:
graphman revise --input messy-bundle.json --output clean-bundle.json \
--options.normalize trueRemove duplicate entities from bundle:
graphman revise --input bundle-with-dupes.json --output deduplicated.json \
--options.normalize truePrepare exported bundle for import:
# Export from source
graphman export --gateway source --output export.json
# Revise for import
graphman revise --input export.json --output import-ready.json \
--options.normalize true \
--options.excludeGoids true
# Import to target
graphman import --input import-ready.json --gateway targetPrepare bundle for version control:
graphman revise --input bundle.json --output vcs-ready.json \
--options.normalize true \
--options.excludeGoids trueThe revise command handles various schema changes:
New required fields are added with defaults:
// Before revision
{
"name": "MyService",
"enabled": true
}
// After revision (if new field added to schema)
{
"name": "MyService",
"enabled": true,
"newField": "defaultValue"
}Deprecated fields are removed:
// Before revision
{
"name": "MyService",
"enabled": true,
"deprecatedField": "value"
}
// After revision
{
"name": "MyService",
"enabled": true
}Field values are transformed to new formats:
// Before revision
{
"timeout": "30"
}
// After revision
{
"timeout": 30
}Entity structures are updated:
// Before revision
{
"properties": "key1=value1,key2=value2"
}
// After revision
{
"properties": [
{"key": "key1", "value": "value1"},
{"key": "key2", "value": "value2"}
]
}-
Sanitizes for Import
- Removes export-only fields
- Adds import-required fields
- Adjusts entity mappings
-
Removes Duplicates
- Identifies duplicate entities
- Keeps one instance per unique entity
- Preserves entity relationships
-
Validates Structure
- Ensures required fields exist
- Validates field types
- Checks entity relationships
-
Applies Transformations
- Converts data types
- Normalizes field values
- Updates entity references
When excludeGoids: true (requires normalize: true):
- Removes all GOID fields from entities
- Makes bundle portable across environments
- Entities will get new GOIDs on import
- Useful for version control and templates
- Schema Version: Uses the configured schema version
- Backward Compatibility: Handles older bundle formats
- Forward Compatibility: Updates to current schema
-
Normalization Required:
excludeGoidsrequiresnormalize: true - Bundle Properties: Preserved during revision
- Entity Order: Output is automatically sorted
- Non-Destructive: Original bundle is not modified
- Validation: Consider validating after revision
The revise command uses the schema version specified in:
- Command line:
--options.schema v11.2.0 - Configuration file:
graphman.configuration - Default: Latest supported schema version
graphman revise --input bundle.json --output revised.json --options.schema v11.1.1Common errors and solutions:
| Error | Solution |
|---|---|
| Input parameter is missing | Provide --input parameter |
| Invalid bundle format | Validate input bundle JSON syntax |
| Schema version not supported | Check supported versions with version command |
| Normalization failed | Check bundle structure and entity validity |
Always validate after revising:
graphman revise --input bundle.json --output revised.json --options.normalize true
graphman validate --input revised.json- Revision is generally fast (< 1 second for typical bundles)
- Large bundles (1000+ entities) may take longer
- Normalization adds minimal overhead
- Duplicate removal depends on entity count
- validate: Validate revised bundles
- export: Export with normalization options
- import: Import revised bundles
- schema: View schema information
- Always revise before import when migrating between versions
- Use normalize for imports to ensure bundle is import-ready
- Exclude GOIDs for portability when deploying across environments
- Validate after revision to catch any issues
- Test in non-production before production deployment
- Keep original bundles as backup before revision
- Document schema version used for revision
- Use version control for revised bundles
#!/bin/bash
# Export from old gateway
graphman export --gateway old-v10 --output old-export.json
# Revise for new schema
graphman revise --input old-export.json --output migrated.json \
--options.normalize true
# Validate
graphman validate --input migrated.json
# Import to new gateway
graphman import --input migrated.json --gateway new-v11#!/bin/bash
# Export from dev
graphman export --gateway dev --output dev-export.json
# Revise and make portable
graphman revise --input dev-export.json --output portable.json \
--options.normalize true \
--options.excludeGoids true
# Deploy to test
graphman import --input portable.json --gateway test
# Deploy to prod
graphman import --input portable.json --gateway prod#!/bin/bash
# Revise bundle to current schema
graphman revise --input old-bundle.json --output updated.json \
--options.normalize true
# Explode for version control
graphman explode --input updated.json --output config/ --options.level 2
# Commit to Git
git add config/
git commit -m "Updated bundle to current schema"If revision makes unexpected changes:
- Review schema changes between versions
- Check field deprecations and additions
- Validate entity structures
- Compare before/after with diff tool
If normalization fails:
- Validate input bundle JSON syntax
- Check for malformed entities
- Verify entity relationships
- Review error messages for specific issues
If GOIDs are not removed:
- Ensure
normalize: trueis set - Verify
excludeGoids: trueis set - Check that entities have GOID fields
Revise to specific schema version:
graphman revise --input bundle.json --output revised.json \
--options.schema v11.1.1 \
--options.normalize trueRevise multiple bundles:
#!/bin/bash
for file in bundles/*.json; do
output="revised/$(basename $file)"
graphman revise --input "$file" --output "$output" \
--options.normalize true \
--options.excludeGoids true
doneRevise and validate in one workflow:
#!/bin/bash
graphman revise --input bundle.json --output revised.json \
--options.normalize true
if graphman validate --input revised.json; then
echo "Revision successful and valid"
else
echo "Revision produced invalid bundle"
exit 1
fi