-
Notifications
You must be signed in to change notification settings - Fork 6
Schema Command
The schema command displays information about the GraphQL schema used by Graphman, including available entity types and their plural names. It can also refresh the pre-compiled schema metadata.
graphman schema [--refresh true|false]
[--options.<name> <value>,...]| Parameter | Description | Default |
|---|---|---|
--refresh |
Refresh the pre-compiled schema | false |
--options.refresh |
Alternative way to specify refresh | false |
When run without parameters, displays:
- Current schema version
- List of available entity types
- Entity type plural names
- Deprecated entity types (if any)
When --refresh true is specified:
- Reprocesses GraphQL schema files
- Regenerates metadata.json
- Updates entity type information
- Refreshes field definitions
The command displays:
| Information | Description |
|---|---|
| Schema Version | Current GraphQL schema version (e.g., v11.2.0) |
| Entity Types | All available entity types |
| Plural Names | Plural form used in bundles and commands |
| Deprecated Status | Indicates if entity type is deprecated |
View current schema details:
graphman schemaSample Output:
info: schema v11.2.0
info: available entity types:
AdministrativeUserAccountProperty - administrativeUserAccountProperties
AuditConfiguration - auditConfigurations
ClusterProperty - clusterProperties
EmailListener - emailListeners
EncapsulatedAssertion - encassConfigs
Folder - folders
InternalUser - internalUsers
JdbcConnection - jdbcConnections
JmsDestination - jmsDestinations
Key - keys
Policy - policies
PolicyFragment - policyFragments
ScheduledTask - scheduledTasks
Service - services
ServerModuleFile - serverModuleFiles
TrustedCert - trustedCerts
...
Refresh the pre-compiled schema:
graphman schema --refresh trueOutput:
info: pre-compiled schema is refreshed
info: schema v11.2.0
info: available entity types:
...
Alternative refresh syntax:
graphman schema --options.refresh trueFind available entity types for use in commands:
graphman schemaUse the plural names in commands like slice, export, and mappings.
Check which schema version is active:
graphman schemaRefresh schema after modifying GraphQL files:
# After editing schema files
graphman schema --refresh trueVerify entity type names when commands fail:
# Check correct plural name
graphman schema | grep -i "service"Generate entity type reference:
graphman schema > entity-types.txtUse in scripts to validate entity types:
#!/bin/bash
# Check if entity type exists
if graphman schema | grep -q "services"; then
echo "Services entity type is available"
fiEach entity type is displayed as:
<TypeName> - <pluralName> [status]
Examples:
Service - servicesPolicy - policiesClusterProperty - clusterPropertiesOldEntityType - oldEntityTypes (deprecated)
| Type Name | Plural Name | Description |
|---|---|---|
| Service | services | Web Services |
| Policy | policies | Policies |
| PolicyFragment | policyFragments | Policy Fragments |
| Folder | folders | Folders |
| Key | keys | Private Keys |
| TrustedCert | trustedCerts | Trusted Certificates |
| JdbcConnection | jdbcConnections | JDBC Connections |
| JmsDestination | jmsDestinations | JMS Destinations |
| ClusterProperty | clusterProperties | Cluster Properties |
| ScheduledTask | scheduledTasks | Scheduled Tasks |
| EncapsulatedAssertion | encassConfigs | Encapsulated Assertions |
| InternalUser | internalUsers | Internal Users |
| InternalGroup | internalGroups | Internal Groups |
| ServerModuleFile | serverModuleFiles | Server Module Files |
Check supported schema versions:
graphman versionShows:
- Current schema version
- All supported schema versions
Configure in graphman.configuration:
{
"options": {
"schema": "v11.1.1"
}
}Or specify on command line:
graphman export --options.schema v11.1.1 --gateway dev --output export.jsonSchema files are located in:
<graphman-home>/schema/<version>/
├── schema.graphql # GraphQL schema definition
├── metadata.json # Pre-compiled metadata
├── policy-code-schema.json # Policy code schema
└── metadata-base.json # Base metadata
The metadata.json file contains:
- Entity type definitions
- Field information
- Type relationships
- Query and mutation definitions
Refresh the schema when:
- GraphQL schema files are modified
- Custom entity types are added
- Schema definitions are updated
- Troubleshooting schema issues
- Entity type metadata
- Field definitions
- Type relationships
- Query structures
- Mutation structures
- Reads GraphQL schema files
- Parses type definitions
- Generates metadata
- Writes to
metadata.json - Validates schema structure
- Schema Version: Determined by configuration or default
- Plural Names: Used in bundle JSON and command parameters
- Case Sensitive: Entity type names are case-sensitive
- Deprecated Types: Marked but still available for compatibility
- Read-Only Display: Default mode doesn't modify anything
- Refresh Required: Only needed after schema file changes
- Multiple Versions: Different schema versions may have different entity types
- version: View supported schema versions
- describe: View query and mutation details
- slice: Use entity type plural names
- export: Export specific entity types
- Check schema before using entity types in commands
- Use correct plural names from schema output
- Refresh after schema modifications during development
- Document entity types used in automation scripts
- Verify schema version when troubleshooting
- Keep schema version consistent across environments
- Review deprecated types before using them
#!/bin/bash
# Find entity type for services
echo "Looking for service entity types:"
graphman schema | grep -i service
# Output:
# Service - services
# ServerModuleFile - serverModuleFiles#!/bin/bash
# Check current schema version
SCHEMA_VERSION=$(graphman schema | grep "schema" | awk '{print $3}')
echo "Current schema version: $SCHEMA_VERSION"
# Verify it matches expected version
if [ "$SCHEMA_VERSION" = "v11.2.0" ]; then
echo "Schema version is correct"
else
echo "Warning: Unexpected schema version"
fi#!/bin/bash
# Validate entity types before using in script
ENTITY_TYPES=("services" "policies" "folders")
for type in "${ENTITY_TYPES[@]}"; do
if graphman schema | grep -q " $type\$"; then
echo "✓ $type is valid"
else
echo "✗ $type is not found in schema"
fi
doneIf commands fail with unknown entity type:
# Check correct plural name
graphman schema | grep -i "<entity-name>"If schema seems incorrect:
# Check configured version
graphman version
# Refresh schema
graphman schema --refresh trueIf expected entity types are missing:
- Verify schema version supports the entity type
- Check if entity type is deprecated
- Ensure correct schema version is configured
- Try refreshing the schema
# Show only service-related types
graphman schema | grep -i service
# Show only policy-related types
graphman schema | grep -i policy
# Show deprecated types
graphman schema | grep deprecated# Export to file
graphman schema > entity-types.txt
# Export only entity names
graphman schema | grep " " | awk '{print $3}' > entity-names.txt# Compare schemas between versions
graphman schema --options.schema v11.1.1 > schema-v11.1.1.txt
graphman schema --options.schema v11.2.0 > schema-v11.2.0.txt
diff schema-v11.1.1.txt schema-v11.2.0.txtDifferent schema versions support different features:
| Feature | v11.0.00 | v11.1.1 | v11.2.0 |
|---|---|---|---|
| Mappings | ✓ | ✓ | ✓ |
| Mappings Source | ✗ | ✓ | ✓ |
| Policy as Code | ✗ | ✓ | ✓ |
Check feature support:
graphman version