Skip to content

Custom Properties & Modifiers

When using the JSON Schema workflow, your model classes are auto-generated from schema files. Custom properties and modifiers let you extend these generated classes with custom logic.

Python Classes

If you define models as Python classes, you add properties and methods directly on the class — no special mechanism needed.

Custom Properties

Add computed properties or methods to a JSON Schema model by creating Python files in a properties folder next to model.json:

📁 models
└── 📁 person
    ├── 📄 model.json
    └── 📁 properties
        └── 📄 full_name.py

full_name.py:

@property
def full_name(self):
    return f'{self.first_name} {self.last_name}'

The property is automatically added to the generated model class:

person = Person(first_name='John', last_name='Doe')
print(person.full_name)  # John Doe

You can add regular methods the same way — any Python file in properties/ becomes a method on the model.

Modifiers

Modifiers are a special type of custom property for overriding built-in model behavior. Generate them with:

amsdal generate modifier <model_name> <modifier_type>

Available Modifiers

Modifier Description
constructor Override the __init__ method
display_name Property that controls how the object appears in the UI
version_name Property that controls how the object version appears in the UI

Generated modifier files are placed in the modifiers folder next to model.json.