Skip to content

Commit

Permalink
docs: use mermaid for class diagram (#1547)
Browse files Browse the repository at this point in the history
  • Loading branch information
loan-mgt authored Oct 5, 2023
1 parent 37e4bb9 commit fab7037
Showing 1 changed file with 244 additions and 6 deletions.
250 changes: 244 additions & 6 deletions docs/internal-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,125 @@ These are the meta models and their meaning:
- **StringModel** represent string values.
- **AnyModel** represent generic values that cannot otherwise be represented by one of the other models.

<p align="center">
<img src="./img/MetaModel.png" />
</p>

```mermaid
---
title: Meta Model
---
classDiagram
direction BT
class MetaModel {
<<Abstract class>>
String name
Any originalInput
}
class TupleValueModel{
<<class>>
Number index
MetaModel value
}
class TupleModel{
<<class>>
TupleValueModel[] tupleModels
}
class ObjectModel{
<<class>>
&lt;String, ObjectPropertyModel&gt; properties
}
class ObjectPropertyModel{
<<class>>
String propertyName
Boolean required
MetaModel property
}
class ArrayModel{
<<class>>
MetaModel valueModel
}
class UnionModel{
<<class>>
MetaModel[] unionModels
}
class EnumValueModel{
<<class>>
String key
Any value
}
class EnumModel{
<<class>>
EnumValueModel[] values
}
class BooleanModel{
<<class>>
}
class StringModel{
<<class>>
}
class IntegerModel{
<<class>>
}
class FloatModel{
<<class>>
}
class AnyModel{
<<class>>
}
class ReferencedModel{
<<class>>
MetaModel referencedModel
}
class DictionaryModel{
<<class>>
MetaModel keyModel
MetaModel valueModel
'unwrap' | 'normanl' serializationType
}
TupleValueModel:value --> MetaModel
ObjectPropertyModel:property --> MetaModel
ArrayModel:valueModel --> MetaModel
DictionaryModel:valueModel --> MetaModel
DictionaryModel:keyModel --> MetaModel
TupleModel "1 ... n" *-- TupleValueModel
ObjectModel "1 ... n" *-- ObjectPropertyModel
UnionModel "1 ... n" *-- "1 ... n" MetaModel
EnumModel o-- EnumValueModel
TupleModel --|> MetaModel
ObjectModel --|> MetaModel
ArrayModel --|> MetaModel
UnionModel --|> MetaModel
EnumModel --|> MetaModel
BooleanModel --|> MetaModel
IntegerModel --|> MetaModel
StringModel --|> MetaModel
FloatModel --|> MetaModel
AnyModel --|> MetaModel
ReferencedModel --|> MetaModel
DictionaryModel --|> MetaModel
```

## The Constrained Meta Model

Expand All @@ -35,6 +151,128 @@ How and what are constrained?

The answer to this question is not straightforward, cause each output has unique constraints that the meta models must adhere to. You can read more about [the constraint behavior here](./constraints.md).

<p align="center">
<img src="./img/ConstrainedMetaModel.png" />
</p>
```mermaid
---
title: Constrained Meta Model
---
classDiagram
direction RL
class MetaModel {
<<Abstract class>>
String name
Any originalInput
}
class ConstrainedMetaModel {
<<Abstract class>>
String type
}
class ConstrainedTupleValueModel{
<<class>>
Number index
ConstrainedMetaModel value
}
class ConstrainedTupleModel{
<<class>>
ConstrainedTupleValueModel[] tupleModels
}
class ConstrainedObjectModel{
<<class>>
&lt;String, ObjectPropertyModel&gt; properties
}
class ConstrainedObjectPropertyModel{
<<class>>
String propertyName
Boolean required
ConstrainedMetaModel property
}
class ConstrainedArrayModel{
<<class>>
ConstrainedMetaModel valueModel
}
class ConstrainedUnionModel{
<<class>>
ConstrainedMetaModel[] unionModels
}
class ConstrainedEnumValueModel{
<<class>>
String key
Any value
}
class ConstrainedEnumModel{
<<class>>
EnumValueModel[] values
}
class ConstrainedBooleanModel{
<<class>>
}
class ConstrainedStringModel{
<<class>>
}
class ConstrainedIntegerModel{
<<class>>
}
class ConstrainedFloatModel{
<<class>>
}
class ConstrainedAnyModel{
<<class>>
}
class ConstrainedReferencedModel{
<<class>>
ConstrainedMetaModel referencedModel
}
class ConstrainedDictionaryModel{
<<class>>
ConstrainedMetaModel keyModel
ConstrainedMetaModel valueModel
'unwrap' | 'normanl' serializationType
}
ConstrainedTupleValueModel:value --> ConstrainedMetaModel
ConstrainedObjectPropertyModel:property --> ConstrainedMetaModel
ConstrainedArrayModel:valueModel --> ConstrainedMetaModel
ConstrainedDictionaryModel:valueModel --> ConstrainedMetaModel
ConstrainedDictionaryModel:keyModel --> ConstrainedMetaModel
ConstrainedTupleModel "1 ... n" *-- ConstrainedTupleValueModel
ConstrainedObjectModel "1 ... n" *-- ConstrainedObjectPropertyModel
ConstrainedUnionModel "1 ... n" *-- "1 ... n" ConstrainedMetaModel
ConstrainedEnumModel o-- ConstrainedEnumValueModel
ConstrainedTupleModel --|> ConstrainedMetaModel
ConstrainedObjectModel --|> ConstrainedMetaModel
ConstrainedArrayModel --|> ConstrainedMetaModel
ConstrainedUnionModel --|> ConstrainedMetaModel
ConstrainedEnumModel --|> ConstrainedMetaModel
ConstrainedBooleanModel --|> ConstrainedMetaModel
ConstrainedIntegerModel --|> ConstrainedMetaModel
ConstrainedStringModel --|> ConstrainedMetaModel
ConstrainedFloatModel --|> ConstrainedMetaModel
ConstrainedAnyModel --|> ConstrainedMetaModel
ConstrainedReferencedModel --|> ConstrainedMetaModel
ConstrainedDictionaryModel --|> ConstrainedMetaModel
ConstrainedMetaModel --|> MetaModel
```

0 comments on commit fab7037

Please sign in to comment.