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

Consider changing the JSON serialization for custom types #25

Closed
AttilaMihaly opened this issue Mar 19, 2020 · 5 comments
Closed

Consider changing the JSON serialization for custom types #25

AttilaMihaly opened this issue Mar 19, 2020 · 5 comments
Labels
discussion needed An issue that needs further discussion. enhancement New feature or request

Comments

@AttilaMihaly
Copy link
Member

No description provided.

@AttilaMihaly AttilaMihaly added enhancement New feature or request discussion needed An issue that needs further discussion. labels Mar 19, 2020
@AttilaMihaly
Copy link
Member Author

We discussed an concluded to change the current approach of:

{
  "$type": "typeTag",
  "field1": "value1",
  "field2": "value2"
}

To this:

["typeTag", "value1", "value2"]

AttilaMihaly added a commit to AttilaMihaly/morphir-elm that referenced this issue Mar 23, 2020
@DamianReeves
Copy link
Member

I think it might be valuable for us to specify what this mapping looks like when we are coming from Frontend's that provide names for the fields such as in F# and Scala

type Shape 
    = Rectangle Float Float
    | Circle Float
    | Prism Float Float
type Shape =
    | Rectangle of width : float * length : float
    | Circle of radius : float
    | Prism of width : float * float * height : float
sealed abstract class Shape
object Shape {
   case class Rectangle(width:Float, length:Float) extends Shape
   case class Circle(radius:Float) extends Shape
   case class Prism(width:Float, anonymous1:Float, height:Float) extends Shape
}

@AttilaMihaly
Copy link
Member Author

It would be the same, right? This represents the constructor invocation not the declaration.

@DamianReeves
Copy link
Member

That's what I wanted to get into actually. So in this case the declaration would have the field names, right?
In the case where there are field names do we allow a call invocation with named arguments, or do we always translate to positional?

AttilaMihaly added a commit to AttilaMihaly/morphir-elm that referenced this issue Mar 23, 2020
AttilaMihaly added a commit that referenced this issue Mar 23, 2020
* Utilities to make the JSON mapping easier. #25

* Fix compile error. #25
@AttilaMihaly
Copy link
Member Author

I think we should always translate to positional. The field names are just to make it more readable. That makes sense to capture in the type but probably not the value. It's debatable though.

AttilaMihaly added a commit that referenced this issue Mar 23, 2020
* Utilities to make the JSON mapping easier. #25

* Fix compile error. #25

* Fix `EncodersCLI`.
AttilaMihaly added a commit that referenced this issue Mar 23, 2020
* Utilities to make the JSON mapping easier. #25

* Fix compile error. #25

* Fix `EncodersCLI`.

* Make source dir relative to project dir. #27
AttilaMihaly added a commit that referenced this issue Mar 24, 2020
* Utilities to make the JSON mapping easier. #25

* Fix compile error. #25

* Fix `EncodersCLI`.

* Make source dir relative to project dir. #27

* Better error reporting in the frontend. #24
AttilaMihaly added a commit that referenced this issue Mar 25, 2020
* Utilities to make the JSON mapping easier. #25

* Fix compile error. #25

* Fix `EncodersCLI`.

* Make source dir relative to project dir. #27

* Better error reporting in the frontend. #24

* Initial version of SDK. #34
AttilaMihaly added a commit to AttilaMihaly/morphir-elm that referenced this issue Apr 1, 2020
AttilaMihaly added a commit to AttilaMihaly/morphir-elm that referenced this issue Apr 1, 2020
AttilaMihaly added a commit to AttilaMihaly/morphir-elm that referenced this issue Apr 1, 2020
AttilaMihaly added a commit to AttilaMihaly/morphir-elm that referenced this issue Apr 1, 2020
AttilaMihaly added a commit to AttilaMihaly/morphir-elm that referenced this issue Apr 2, 2020
AttilaMihaly added a commit that referenced this issue Apr 2, 2020
* Added missing module declarations. #37

* Process only those modules that are reachable from exposed ones. Remove package path from module names. #21

* Renaming concepts based on review feedback. #41

* Moved Advanced module up a level. #43

* Removed unused unindent function.

* Moved name to SDK.

* Added missing module to SDK.

* Partial implementation of value mapping.

* Ignore all generated JS.

* Change extra arg position and naming. #46, #25

* Change extra arg position and naming. #46, #25

* Removed remaining references to extra. #5

* Change extra arg position. #46, #25, #5

* Added more coverage. #46, #25, #5

* Changes suggested in the PR. #46, #25, #5
AttilaMihaly added a commit that referenced this issue Apr 6, 2020
* Added missing module declarations. #37

* Process only those modules that are reachable from exposed ones. Remove package path from module names. #21

* Renaming concepts based on review feedback. #41

* Moved Advanced module up a level. #43

* Removed unused unindent function.

* Moved name to SDK.

* Added missing module to SDK.

* Partial implementation of value mapping.

* Ignore all generated JS.

* Change extra arg position and naming. #46, #25

* Change extra arg position and naming. #46, #25

* Removed remaining references to extra. #5

* Change extra arg position. #46, #25, #5

* Added more coverage. #46, #25, #5

* Changes suggested in the PR. #46, #25, #5

* Use more explicit names.

* All patterns supported.

* Pattern-match supported.

* Added support for SDK operators. #52
AttilaMihaly added a commit that referenced this issue Apr 7, 2020
* Added missing module declarations. #37

* Process only those modules that are reachable from exposed ones. Remove package path from module names. #21

* Renaming concepts based on review feedback. #41

* Moved Advanced module up a level. #43

* Removed unused unindent function.

* Moved name to SDK.

* Added missing module to SDK.

* Partial implementation of value mapping.

* Ignore all generated JS.

* Change extra arg position and naming. #46, #25

* Change extra arg position and naming. #46, #25

* Removed remaining references to extra. #5

* Change extra arg position. #46, #25, #5

* Added more coverage. #46, #25, #5

* Changes suggested in the PR. #46, #25, #5

* Use more explicit names.

* All patterns supported.

* Pattern-match supported.

* Added support for SDK operators. #52

* Fix compile errors.
AttilaMihaly added a commit that referenced this issue Apr 15, 2020
* Added missing module declarations. #37

* Process only those modules that are reachable from exposed ones. Remove package path from module names. #21

* Renaming concepts based on review feedback. #41

* Moved Advanced module up a level. #43

* Removed unused unindent function.

* Moved name to SDK.

* Added missing module to SDK.

* Partial implementation of value mapping.

* Ignore all generated JS.

* Change extra arg position and naming. #46, #25

* Change extra arg position and naming. #46, #25

* Removed remaining references to extra. #5

* Change extra arg position. #46, #25, #5

* Added more coverage. #46, #25, #5

* Changes suggested in the PR. #46, #25, #5

* Use more explicit names.

* All patterns supported.

* Pattern-match supported.

* Added support for SDK operators. #52

* Fix compile errors.

* Prepare Elm module publishing. #2
AttilaMihaly added a commit that referenced this issue Apr 15, 2020
* Added missing module declarations. #37

* Process only those modules that are reachable from exposed ones. Remove package path from module names. #21

* Renaming concepts based on review feedback. #41

* Moved Advanced module up a level. #43

* Removed unused unindent function.

* Moved name to SDK.

* Added missing module to SDK.

* Partial implementation of value mapping.

* Ignore all generated JS.

* Change extra arg position and naming. #46, #25

* Change extra arg position and naming. #46, #25

* Removed remaining references to extra. #5

* Change extra arg position. #46, #25, #5

* Added more coverage. #46, #25, #5

* Changes suggested in the PR. #46, #25, #5

* Use more explicit names.

* All patterns supported.

* Pattern-match supported.

* Added support for SDK operators. #52

* Fix compile errors.

* Prepare Elm module publishing. #2

* Fix repo name. #2
AttilaMihaly added a commit that referenced this issue Apr 16, 2020
* Added missing module declarations. #37

* Process only those modules that are reachable from exposed ones. Remove package path from module names. #21

* Renaming concepts based on review feedback. #41

* Moved Advanced module up a level. #43

* Removed unused unindent function.

* Moved name to SDK.

* Added missing module to SDK.

* Partial implementation of value mapping.

* Ignore all generated JS.

* Change extra arg position and naming. #46, #25

* Change extra arg position and naming. #46, #25

* Removed remaining references to extra. #5

* Change extra arg position. #46, #25, #5

* Added more coverage. #46, #25, #5

* Changes suggested in the PR. #46, #25, #5

* Use more explicit names.

* All patterns supported.

* Pattern-match supported.

* Added support for SDK operators. #52

* Fix compile errors.

* Prepare Elm module publishing. #2

* Fix repo name. #2

* Support for let expressions. #54
AttilaMihaly added a commit that referenced this issue Apr 17, 2020
* Added missing module declarations. #37

* Process only those modules that are reachable from exposed ones. Remove package path from module names. #21

* Renaming concepts based on review feedback. #41

* Moved Advanced module up a level. #43

* Removed unused unindent function.

* Moved name to SDK.

* Added missing module to SDK.

* Partial implementation of value mapping.

* Ignore all generated JS.

* Change extra arg position and naming. #46, #25

* Change extra arg position and naming. #46, #25

* Removed remaining references to extra. #5

* Change extra arg position. #46, #25, #5

* Added more coverage. #46, #25, #5

* Changes suggested in the PR. #46, #25, #5

* Use more explicit names.

* All patterns supported.

* Pattern-match supported.

* Added support for SDK operators. #52

* Fix compile errors.

* Prepare Elm module publishing. #2

* Fix repo name. #2

* Support for let expressions. #54

* Simple join implementations. #64
AttilaMihaly added a commit that referenced this issue Apr 20, 2020
* Added missing module declarations. #37

* Process only those modules that are reachable from exposed ones. Remove package path from module names. #21

* Renaming concepts based on review feedback. #41

* Moved Advanced module up a level. #43

* Removed unused unindent function.

* Moved name to SDK.

* Added missing module to SDK.

* Partial implementation of value mapping.

* Ignore all generated JS.

* Change extra arg position and naming. #46, #25

* Change extra arg position and naming. #46, #25

* Removed remaining references to extra. #5

* Change extra arg position. #46, #25, #5

* Added more coverage. #46, #25, #5

* Changes suggested in the PR. #46, #25, #5

* Use more explicit names.

* All patterns supported.

* Pattern-match supported.

* Added support for SDK operators. #52

* Fix compile errors.

* Prepare Elm module publishing. #2

* Fix repo name. #2

* Support for let expressions. #54

* Simple join implementations. #64

* Refactoring to make the code more organized.

* Refactoring to make the code more organized.

* Prepare value mapping utils. #53

* More descriptive naming.

* More descriptive naming.

* Removed unused function

* Better naming

* Added utility function and removed unused one.

* Added variable resolution.

* Hooked up variable resolution and updated tests. #53

* Completed reference resolution. #53
AttilaMihaly added a commit that referenced this issue Apr 27, 2020
* Added missing module declarations. #37

* Process only those modules that are reachable from exposed ones. Remove package path from module names. #21

* Renaming concepts based on review feedback. #41

* Moved Advanced module up a level. #43

* Removed unused unindent function.

* Moved name to SDK.

* Added missing module to SDK.

* Partial implementation of value mapping.

* Ignore all generated JS.

* Change extra arg position and naming. #46, #25

* Change extra arg position and naming. #46, #25

* Removed remaining references to extra. #5

* Change extra arg position. #46, #25, #5

* Added more coverage. #46, #25, #5

* Changes suggested in the PR. #46, #25, #5

* Use more explicit names.

* All patterns supported.

* Pattern-match supported.

* Added support for SDK operators. #52

* Fix compile errors.

* Prepare Elm module publishing. #2

* Fix repo name. #2

* Support for let expressions. #54

* Simple join implementations. #64

* Refactoring to make the code more organized.

* Refactoring to make the code more organized.

* Prepare value mapping utils. #53

* More descriptive naming.

* More descriptive naming.

* Removed unused function

* Better naming

* Added utility function and removed unused one.

* Added variable resolution.

* Hooked up variable resolution and updated tests. #53

* Completed reference resolution. #53

* Added missing docs and refactored. #68

* Document and refactor driven by the goal to process Morphir using Morphir. #68
AttilaMihaly added a commit that referenced this issue Apr 28, 2020
* Added missing module declarations. #37

* Process only those modules that are reachable from exposed ones. Remove package path from module names. #21

* Renaming concepts based on review feedback. #41

* Moved Advanced module up a level. #43

* Removed unused unindent function.

* Moved name to SDK.

* Added missing module to SDK.

* Partial implementation of value mapping.

* Ignore all generated JS.

* Change extra arg position and naming. #46, #25

* Change extra arg position and naming. #46, #25

* Removed remaining references to extra. #5

* Change extra arg position. #46, #25, #5

* Added more coverage. #46, #25, #5

* Changes suggested in the PR. #46, #25, #5

* Use more explicit names.

* All patterns supported.

* Pattern-match supported.

* Added support for SDK operators. #52

* Fix compile errors.

* Prepare Elm module publishing. #2

* Fix repo name. #2

* Support for let expressions. #54

* Simple join implementations. #64

* Refactoring to make the code more organized.

* Refactoring to make the code more organized.

* Prepare value mapping utils. #53

* More descriptive naming.

* More descriptive naming.

* Removed unused function

* Better naming

* Added utility function and removed unused one.

* Added variable resolution.

* Hooked up variable resolution and updated tests. #53

* Completed reference resolution. #53

* Added missing docs and refactored. #68

* Document and refactor driven by the goal to process Morphir using Morphir. #68

* Various fixes. #68
AttilaMihaly added a commit that referenced this issue Apr 28, 2020
* Added missing module declarations. #37

* Process only those modules that are reachable from exposed ones. Remove package path from module names. #21

* Renaming concepts based on review feedback. #41

* Moved Advanced module up a level. #43

* Removed unused unindent function.

* Moved name to SDK.

* Added missing module to SDK.

* Partial implementation of value mapping.

* Ignore all generated JS.

* Change extra arg position and naming. #46, #25

* Change extra arg position and naming. #46, #25

* Removed remaining references to extra. #5

* Change extra arg position. #46, #25, #5

* Added more coverage. #46, #25, #5

* Changes suggested in the PR. #46, #25, #5

* Use more explicit names.

* All patterns supported.

* Pattern-match supported.

* Added support for SDK operators. #52

* Fix compile errors.

* Prepare Elm module publishing. #2

* Fix repo name. #2

* Support for let expressions. #54

* Simple join implementations. #64

* Refactoring to make the code more organized.

* Refactoring to make the code more organized.

* Prepare value mapping utils. #53

* More descriptive naming.

* More descriptive naming.

* Removed unused function

* Better naming

* Added utility function and removed unused one.

* Added variable resolution.

* Hooked up variable resolution and updated tests. #53

* Completed reference resolution. #53

* Added missing docs and refactored. #68

* Document and refactor driven by the goal to process Morphir using Morphir. #68

* Various fixes. #68

* Report parse errors.
AttilaMihaly added a commit that referenced this issue May 7, 2020
* Added missing module declarations. #37

* Process only those modules that are reachable from exposed ones. Remove package path from module names. #21

* Renaming concepts based on review feedback. #41

* Moved Advanced module up a level. #43

* Removed unused unindent function.

* Moved name to SDK.

* Added missing module to SDK.

* Partial implementation of value mapping.

* Ignore all generated JS.

* Change extra arg position and naming. #46, #25

* Change extra arg position and naming. #46, #25

* Removed remaining references to extra. #5

* Change extra arg position. #46, #25, #5

* Added more coverage. #46, #25, #5

* Changes suggested in the PR. #46, #25, #5

* Use more explicit names.

* All patterns supported.

* Pattern-match supported.

* Added support for SDK operators. #52

* Fix compile errors.

* Prepare Elm module publishing. #2

* Fix repo name. #2

* Support for let expressions. #54

* Simple join implementations. #64

* Refactoring to make the code more organized.

* Refactoring to make the code more organized.

* Prepare value mapping utils. #53

* More descriptive naming.

* More descriptive naming.

* Removed unused function

* Better naming

* Added utility function and removed unused one.

* Added variable resolution.

* Hooked up variable resolution and updated tests. #53

* Completed reference resolution. #53

* Added missing docs and refactored. #68

* Document and refactor driven by the goal to process Morphir using Morphir. #68

* Various fixes. #68

* Report parse errors.

* Updated docs.

* Link to Elm package.
AttilaMihaly added a commit that referenced this issue May 7, 2020
* Added missing module declarations. #37

* Process only those modules that are reachable from exposed ones. Remove package path from module names. #21

* Renaming concepts based on review feedback. #41

* Moved Advanced module up a level. #43

* Removed unused unindent function.

* Moved name to SDK.

* Added missing module to SDK.

* Partial implementation of value mapping.

* Ignore all generated JS.

* Change extra arg position and naming. #46, #25

* Change extra arg position and naming. #46, #25

* Removed remaining references to extra. #5

* Change extra arg position. #46, #25, #5

* Added more coverage. #46, #25, #5

* Changes suggested in the PR. #46, #25, #5

* Use more explicit names.

* All patterns supported.

* Pattern-match supported.

* Added support for SDK operators. #52

* Fix compile errors.

* Prepare Elm module publishing. #2

* Fix repo name. #2

* Support for let expressions. #54

* Simple join implementations. #64

* Refactoring to make the code more organized.

* Refactoring to make the code more organized.

* Prepare value mapping utils. #53

* More descriptive naming.

* More descriptive naming.

* Removed unused function

* Better naming

* Added utility function and removed unused one.

* Added variable resolution.

* Hooked up variable resolution and updated tests. #53

* Completed reference resolution. #53

* Added missing docs and refactored. #68

* Document and refactor driven by the goal to process Morphir using Morphir. #68

* Various fixes. #68

* Report parse errors.

* Updated docs.

* Link to Elm package.

* More documentation.
AttilaMihaly added a commit that referenced this issue May 8, 2020
* Added missing module declarations. #37

* Process only those modules that are reachable from exposed ones. Remove package path from module names. #21

* Renaming concepts based on review feedback. #41

* Moved Advanced module up a level. #43

* Removed unused unindent function.

* Moved name to SDK.

* Added missing module to SDK.

* Partial implementation of value mapping.

* Ignore all generated JS.

* Change extra arg position and naming. #46, #25

* Change extra arg position and naming. #46, #25

* Removed remaining references to extra. #5

* Change extra arg position. #46, #25, #5

* Added more coverage. #46, #25, #5

* Changes suggested in the PR. #46, #25, #5

* Use more explicit names.

* All patterns supported.

* Pattern-match supported.

* Added support for SDK operators. #52

* Fix compile errors.

* Prepare Elm module publishing. #2

* Fix repo name. #2

* Support for let expressions. #54

* Simple join implementations. #64

* Refactoring to make the code more organized.

* Refactoring to make the code more organized.

* Prepare value mapping utils. #53

* More descriptive naming.

* More descriptive naming.

* Removed unused function

* Better naming

* Added utility function and removed unused one.

* Added variable resolution.

* Hooked up variable resolution and updated tests. #53

* Completed reference resolution. #53

* Added missing docs and refactored. #68

* Document and refactor driven by the goal to process Morphir using Morphir. #68

* Various fixes. #68

* Report parse errors.

* Updated docs.

* Link to Elm package.

* More documentation.

* Moved out Literal and fixed codec. #75, #76

* Fix compile error. #75, #76

* Fix compile error. #75, #76

* Change naming convention for type tags. #77
AttilaMihaly added a commit that referenced this issue May 26, 2020
* Added missing module declarations. #37

* Process only those modules that are reachable from exposed ones. Remove package path from module names. #21

* Renaming concepts based on review feedback. #41

* Moved Advanced module up a level. #43

* Removed unused unindent function.

* Moved name to SDK.

* Added missing module to SDK.

* Partial implementation of value mapping.

* Ignore all generated JS.

* Change extra arg position and naming. #46, #25

* Change extra arg position and naming. #46, #25

* Removed remaining references to extra. #5

* Change extra arg position. #46, #25, #5

* Added more coverage. #46, #25, #5

* Changes suggested in the PR. #46, #25, #5

* Use more explicit names.

* All patterns supported.

* Pattern-match supported.

* Added support for SDK operators. #52

* Fix compile errors.

* Prepare Elm module publishing. #2

* Fix repo name. #2

* Support for let expressions. #54

* Simple join implementations. #64

* Refactoring to make the code more organized.

* Refactoring to make the code more organized.

* Prepare value mapping utils. #53

* More descriptive naming.

* More descriptive naming.

* Removed unused function

* Better naming

* Added utility function and removed unused one.

* Added variable resolution.

* Hooked up variable resolution and updated tests. #53

* Completed reference resolution. #53

* Added missing docs and refactored. #68

* Document and refactor driven by the goal to process Morphir using Morphir. #68

* Various fixes. #68

* Report parse errors.

* Updated docs.

* Link to Elm package.

* More documentation.

* Moved out Literal and fixed codec. #75, #76

* Fix compile error. #75, #76

* Fix compile error. #75, #76

* Change naming convention for type tags. #77

* Add documentation to types. #7

* Better docs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion needed An issue that needs further discussion. enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants