Skip to content

Commit

Permalink
Merge pull request finos#168 from KindsonTheGenius/documentation
Browse files Browse the repository at this point in the history
Syncing operations - tracking file deletion - 1
  • Loading branch information
AttilaMihaly authored Apr 21, 2023
2 parents cb63b24 + 117ca3e commit add116a
Show file tree
Hide file tree
Showing 44 changed files with 290 additions and 279 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ Morphir consists of a few projects based on the features they provide.
| Introduction & Background | Using Morphir | Applicability |
| :------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------- |
| [Resource Centre](https://resources.finos.org/morphir/) | [What Makes a Good Model](./docs/what-makes-a-good-domain-model.md) | [Sharing Business Logic Across Application Boundaries](./docs/shared_logic_modeling.md) |
| [Background](./docs/background.md) | [Development Automation (Dev Bots)](./docs/dev_bots.md) | [Regulatory Technology](./docs/regtech_modeling.md) |
| [Community](./docs/morphir_community.md) | [Modeling an Application](./docs/application_modeling.md) | |
| [What's it all about?](./docs/whats_it_about.md) | [Modeling Decision Tables](https://github.com/finos/morphir-examples/tree/master/src/Morphir/Sample/Rules) | |
| [Why we use Functional Programming?](./docs/why_functional_programming.md) | [Modeling for database developers](docs/modeling-for-database-developers.md) |
| [Background](./docs/background.md) | [Development Automation (Dev Bots)](./docs/dev-bots.md) | [Regulatory Technology](./docs/regtech-modeling.md) |
| [Community](./docs/morphir-community.md) | [Modeling an Application](./docs/application-modeling.md) | |
| [What's it all about?](./docs/whats-it-about.md) | [Modeling Decision Tables](https://github.com/finos/morphir-examples/tree/master/src/Morphir/Sample/Rules) | |
| [Why we use Functional Programming?](./docs/why-functional-programming.md) | [Modeling for database developers](docs/modeling-for-database-developers.md) |

## Roadmap

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Implement the Spark backend as a special case of a Relational backend
# Spark backend as a special case of a Relational backend

## Context and Problem Statement

Expand Down
2 changes: 0 additions & 2 deletions docs/Scala-Json-Backend.md

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion docs/background.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ that shape is decided, a great deal of the actual coding is very repetative and
practices and team standards and you get a lot of boilerplate code that can be automated for faster production with
fewer errors. Morphir relies heavily on such automation, which we call Dev Bots. As with any automation, smart use can
lead to drastic efficiency improvements, like taking seconds to generate what a developer would take days to
produce. Check out the [Dev Bot post](dev_bots) for more information on this topic.
produce. Check out the [Dev Bot post](dev-bots) for more information on this topic.

### Eliminating Rewrites

Expand Down
28 changes: 15 additions & 13 deletions docs/cadl-doc.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# [Morphir](https://package.elm-lang.org/packages/finos/morphir-elm/18.1.0/Morphir-IR-Type) to [Cadl Type](https://microsoft.github.io/cadl/docs/language-basics/type-relations/) Mappings
## Overview
# Morphir-Cadl Mapping
## [Morphir](https://package.elm-lang.org/packages/finos/morphir-elm/18.1.0/Morphir-IR-Type) to [Cadl Type](https://microsoft.github.io/cadl/docs/language-basics/type-relations/) Mappings
This is a documentation of the mapping strategy from Morphir types to Cadl types. This document describes how types in Morphir Models are represented in Cadl.
Below is a quick overview of the mapping in the table:



| | Type | Cadl Type | Comment |
|-------------------------------------------------------|-------------------------------------|------------------------------------------|-----------------------------------------------------|
| [Basic Types](#basic-types) | | | |
Expand Down Expand Up @@ -198,7 +200,7 @@ The `maybe` type in morphir represents a type that may or may not exist. The typ
}
```

3. In a Scenario where a field type is `maybe` of another `maybe` type, it is represented as an `optional field` of the `union` type. <br/>
3. In a Scenario where a field type is `maybe` of another `maybe` type, it is represented as an `optional field` of the `union` type.

Elm:
```elm
Expand All @@ -216,7 +218,7 @@ The `maybe` type in morphir represents a type that may or may not exist. The typ
baz ?: string | null
}
```
_<span style="color:red">Note:</span>_ <br/>
_<span style="color:red">Note:</span>_ \
_In the scenario of multiple `maybe` type for a field in a model, it shall be represented as just the type or null_

### Collection Types
Expand Down Expand Up @@ -329,7 +331,7 @@ model FooBarBaz {
```

### [Custom Types](https://package.elm-lang.org/packages/finos/morphir-elm/18.1.0/Morphir-IR-Type)
##### [General Case]()
##### [General Case](#)
A `custom` type in morphir is a user defined type used to represent a business term or type. This concept is not directly supported in CADL but can be achieved
as tagged `union` of Tuples, where the first element represents type name in string, followed by its arguments.

Expand All @@ -345,7 +347,7 @@ Cadl:
```cadl
alias FooBarBaz = ["Foo", int64] | ["Bar", string] | "Baz";
```
##### [Special Case]()
##### [Special Case](#)
A `custom` type in morphir whose constructors have no arguments would be represented in CADL as an `enum` type.

Elm:
Expand All @@ -369,13 +371,13 @@ enum Currency {

---

| <div style="width:100px"></div> | CADL Type <div style="width:450px"></div> | Morphir Type<div style="width: 350px"></div> | Comment <div style="width:350px"></div> |
|----------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Namespaces](https://microsoft.github.io/cadl/language-basics/namespaces) | `namespace Petstore` | `module PetStore exposing (...)` | Namespaces in CADL map to [Modules](https://package.elm-lang.org/packages/Morgan-Stanley/morphir-elm/latest/Morphir-IR-Module) in Morphir |
| [Models](https://microsoft.github.io/cadl/language-basics/models) | `model Dog { name: string; age: number}` | `type alias Dog = { name: string, age: int}` | Models in CADL map to [Records](https://package.elm-lang.org/packages/finos/morphir-elm/18.1.0/Morphir-IR-Value#record) in Morphir |
| [Enums](https://microsoft.github.io/cadl/language-basics/enums) | `enum Direction {East; West; North; South}` | `type Direction `<br/> `= East` &#124; `West` &#124; `North` &#124; `South` | Enums in CADL map to [Union Types](https://package.elm-lang.org/packages/finos/morphir-elm/18.1.0/Morphir-IR-Type) in Mophir |
| <div style="width:100px"></div> | CADL Type <div style="width:450px"></div> | Morphir Type<div style="width: 350px"></div> | Comment <div style="width:350px"></div> |
|----------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Namespaces](https://microsoft.github.io/cadl/language-basics/namespaces) | `namespace Petstore` | `module PetStore exposing (...)` | Namespaces in CADL map to [Modules](https://package.elm-lang.org/packages/Morgan-Stanley/morphir-elm/latest/Morphir-IR-Module) in Morphir |
| [Models](https://microsoft.github.io/cadl/language-basics/models) | `model Dog { name: string; age: number}` | `type alias Dog = { name: string, age: int}` | Models in CADL map to [Records](https://package.elm-lang.org/packages/finos/morphir-elm/18.1.0/Morphir-IR-Value#record) in Morphir |
| [Enums](https://microsoft.github.io/cadl/language-basics/enums) | `enum Direction {East; West; North; South}` | `type Direction `<br/> `= East` &#124; `West` &#124; `North` &#124; `South` | Enums in CADL map to [Union Types](https://package.elm-lang.org/packages/finos/morphir-elm/18.1.0/Morphir-IR-Type) in Mophir |
| [Union Type](https://package.elm-lang.org/packages/finos/morphir-elm/18.1.0/Morphir-IR-Type) |||
| | -<span style="color: grey; font-style: italic;" > Unnamed Union <br> `alias Breed = Breagle` &#124; `GermanShepherd` &#124; `GoldenRetriever` <br> <span style="color: grey; font-style: italic;" >- Named Union <br> `union Breed {`<br> &ensp; `beagle: Beagle,` <br> &ensp; `shepherd: GermanShepherd.` <br> &ensp; `retiever: GoldenRetriever`<br> `}` |`type Breed` <br> &ensp; `= Beagle Beagle`<br> &ensp; &ensp; &#124; `Shepherd GermanShepherd ` <br> &ensp; &ensp; &#124; `Retriever GoldenRetriever`| Named unions in CADL maps to a Custom Type with a `type parameter` in Morphir. Any other detail of the type is captured in Morphir's `Decorators(Custom Attributes).` <br> <span style="color: red; font-style: italic;" >NB: unnamed Unions are currently not supported in morphir |
| | -<span style="color: grey; font-style: italic;" > Unnamed Union </span> <br /> `alias Breed = Breagle` &#124; `GermanShepherd` &#124; `GoldenRetriever` <br /> <span style="color: grey; font-style: italic;" >- Named Union </span> <br /> `union Breed {`<br /> &ensp; `beagle: Beagle,` <br /> &ensp; `shepherd: GermanShepherd.` <br /> &ensp; `retiever: GoldenRetriever`<br /> `}` | `type Breed` <br /> &ensp; `= Beagle Beagle`<br /> &ensp; &ensp; &#124; `Shepherd GermanShepherd ` <br /> &ensp; &ensp; &#124; `Retriever GoldenRetriever` | Named unions in CADL maps to a Custom Type with a `type parameter` in Morphir. Any other detail of the type is captured in Morphir's `Decorators(Custom Attributes).` <br /> <span style="color: red; font-style: italic;" >NB: unnamed Unions are currently not supported in morphir</span> |


## [Type Relations](https://microsoft.github.io/cadl/language-basics/type-relations)
Expand All @@ -384,7 +386,7 @@ enum Currency {
Boolean in CADL, maps to [`bool`](https://package.elm-lang.org/packages/elm/core/latest/Basics#Bool), a `true` or `false` value in Morphir.

##### Integer
In Morphir, this maps to the type [`int`.](https://package.elm-lang.org/packages/elm/core/latest/Basics#Int) The `integer` type assignment is valid CADL, but <br/>
In Morphir, this maps to the type [`int`.](https://package.elm-lang.org/packages/elm/core/latest/Basics#Int) The `integer` type assignment is valid CADL, but \
<span style="color: red; font-style:italic;"> Things to note :: </span>
1. When dealing with emitters such as OpenApiSpec(OAS) it defaults to an object. To obtain an actual int value, specify a subtype `int64`.

Expand Down
Loading

0 comments on commit add116a

Please sign in to comment.