Update Data Type

Update DataType Mutation

Updates an existing data type definition in the system.

Arguments

Name
Type
Description

id

ID!

The ID of the data type to update

input

UpdateDataTypeInput!

Input data for updating the data type

Return Type

DataType - The updated data type object.

Input Fields

UpdateDataTypeInput:

Field
Type
Description

name

String

Name of the data type

description

String

Optional description of the data type

clearDescription

Boolean

Clear the description field

jsonSchema

String

JSON schema definition

frontendSchema

String

Optional frontend schema definition

clearFrontendSchema

Boolean

Clear the frontend schema field

Usage Example

Update Strategies

Schema Evolution

When updating JSON schemas, consider:

  • Backward Compatibility: Ensure existing data remains valid

  • Field Addition: New optional fields are safe to add

  • Field Removal: Removing fields may break existing data

  • Validation Changes: Stricter validation may invalidate existing records

Frontend Schema Updates

The frontendSchema field provides UI hints for form generation:

  • Update field types and labels

  • Add new form fields for new schema properties

  • Remove obsolete UI elements

  • Update validation rules and help text

Field Clearing

Use clear flags to remove optional fields:

  • clearDescription: true - Removes the description

  • clearFrontendSchema: true - Removes the frontend schema

Common Update Scenarios

Schema Enhancement

  • Add new optional fields to accommodate evolving business needs

  • Update validation rules to enforce data quality

  • Modify field types to support new data formats

  • Add enum values for new category options

UI Improvements

  • Update frontend schema to improve form usability

  • Add better field labels and help text

  • Reorganize field order for better user experience

  • Add conditional field visibility rules

Maintenance Updates

  • Fix validation issues in existing schemas

  • Update descriptions for better documentation

  • Align schemas with current business processes

  • Remove deprecated fields and constraints

Validation Considerations

JSON Schema Validation

  • Ensure the JSON schema is syntactically valid

  • Test schema against existing data before updating

  • Consider migration path for existing records

  • Document breaking changes for dependent systems

Impact Assessment

Before updating a data type:

  • Identify entities using this data type

  • Check for data compatibility issues

  • Plan data migration if needed

  • Notify affected users and systems

Best Practices

  1. Version Control: Keep track of schema changes over time

  2. Testing: Validate new schemas against sample data

  3. Documentation: Update descriptions to reflect changes

  4. Communication: Notify stakeholders of significant changes

  5. Rollback Plan: Have a plan to revert problematic changes

  6. Gradual Updates: Make incremental changes rather than major overhauls

Error Handling

Updates may fail due to:

  • Invalid JSON: Malformed JSON schema syntax

  • Schema Conflicts: New schema incompatible with existing data

  • Permission Issues: Insufficient rights to modify data types

  • Dependency Violations: Other systems depend on current schema structure

Notes

  • Schema changes affect all entities using this data type

  • Consider creating new data types instead of modifying critical existing ones

  • Test schema changes in development environments first

  • Monitor system performance after schema updates

  • Keep backup copies of working schemas before making changes

Last updated

Was this helpful?