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

Update Name serialization to use JSON string #7

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

stephengoldbaum
Copy link
Owner

@stephengoldbaum stephengoldbaum commented Dec 18, 2024

Update the code to serialize instances of Name directly to a string instead of an array of characters.

  • Modify encodeName function in src/Morphir/IR/Name/Codec.elm to serialize Name to a JSON string.
  • Modify decodeName function in src/Morphir/IR/Name/Codec.elm to deserialize a JSON string to a Name.
  • Update references to Name serialization in src/Morphir/JsonSchema/Backend.elm to use the updated string serialization.
  • Update references to Name serialization in src/Morphir/JsonSchema/Backend/Codec.elm to use the updated string serialization.
  • Add tests in tests/Morphir/IR/NameTests.elm to verify Name serialization to a JSON string.
  • Add tests in tests/Morphir/IR/NameTests.elm to verify Name deserialization from a JSON string.

For more details, open the Copilot Workspace session.

Update the code to serialize instances of `Name` directly to a string instead of an array of characters.

* Modify `encodeName` function in `src/Morphir/IR/Name/Codec.elm` to serialize `Name` to a JSON string.
* Modify `decodeName` function in `src/Morphir/IR/Name/Codec.elm` to deserialize a JSON string to a `Name`.
* Update references to `Name` serialization in `src/Morphir/JsonSchema/Backend.elm` to use the updated string serialization.
* Update references to `Name` serialization in `src/Morphir/JsonSchema/Backend/Codec.elm` to use the updated string serialization.
* Add tests in `tests/Morphir/IR/NameTests.elm` to verify `Name` serialization to a JSON string.
* Add tests in `tests/Morphir/IR/NameTests.elm` to verify `Name` deserialization from a JSON string.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/stephengoldbaum/morphir-elm?shareId=XXXX-XXXX-XXXX-XXXX).
…ist of strings

* **`src/Morphir/IR/Name.elm`**
  - Change `Name` type definition to `String`
  - Modify `fromString` function to return the input string directly
  - Update `toTitleCase`, `toCamelCase`, `toSnakeCase`, `toHumanWords`, and `toHumanWordsTitle` functions to work with the new `Name` type as a `String`

* **`src/Morphir/IR/Name/Codec.elm`**
  - Update `encodeName` function to serialize `Name` to a JSON string
  - Update `decodeName` function to deserialize a JSON string to a `Name`

* **`src/Morphir/IR/Name/CodecV1.elm`**
  - Update `encodeName` function to serialize `Name` to a JSON string
  - Update `decodeName` function to deserialize a JSON string to a `Name`

* **`src/Morphir/IR/FQName.elm`**
  - Add `empty` function to return an empty `FQName` using the new `Name` structure
  - Replace all occurrences of `( [ [] ], [], [] )` with `FQName.empty`

* **`tests/Morphir/IR/NameTests.elm`**
  - Update tests to verify `Name` serialization to a JSON string
  - Update tests to verify `Name` deserialization from a JSON string
  - Modify tests for `fromString`, `toTitleCase`, `toCamelCase`, `toSnakeCase`, `toHumanWords`, and `toHumanWordsTitle` functions to work with the new `Name` type as a `String`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant