Skip to content

Commit

Permalink
docs: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
minenwerfer committed Sep 10, 2024
1 parent 63e82c9 commit f301925
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,42 @@ The node accept the following Python primitive types (plus `objectid` and `datet
- `objectid`
- `boolean`

### Enums

Values can be mapped:

```python
mapping: Mapping = {
'__fields': {
'status': {
'enum': {
'ativo': 'active',
'inativo': 'inactive',
}
},
'colors': {
'array': True,
'enum': {
'azul': 'blue',
'vermelho': 'red',
'verde': 'green',
}
}
}
}

sample = {
'status': 'ativo',
'colors': [
'azul',
'vermelho',
]
}

# { 'status': 'active', 'colors': ['blue', 'red'] }
result = normalize.translate(sample, mapping)
```

### Modifiers

You can change the default behavior passing a array of "modifiers" in your mapping node. Those will be inherited all the way down until the "modifiers" property is overriden.
Expand Down

0 comments on commit f301925

Please sign in to comment.