Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: use mermaid for class diagram #1547

Merged
merged 4 commits into from
Oct 5, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>>
String, ObjectPropertyModel properties
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there are a few of the properties that are missing their types. In the old image, it's a dictionary with string key and ObjectPropertyModel value 🙂

There are a few places this applies 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonaslagoni There you go! I've fixed it up. 🙃

}

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>>
String, ConstrainedObjectPropertyModel 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


```