Skip to content

Allow Enum objects part of a type map to be serialized and deserialized#105

Merged
Crell merged 4 commits into
Crell:masterfrom
agustingomes:issues/10
Jun 7, 2026
Merged

Allow Enum objects part of a type map to be serialized and deserialized#105
Crell merged 4 commits into
Crell:masterfrom
agustingomes:issues/10

Conversation

@agustingomes

Copy link
Copy Markdown
Contributor

Description

This proposed change aims to allow Enum objects part of a TypeMap to be serialized and deserialized by establishing a serialized structure expected when working with enums in this context.

Motivation and context

fixes #10

How has this been tested?

composer all-checks helped validate the proposed changes.

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

Go over all the following points, and put an x in all the boxes that apply.

Please, please, please, don't send your pull request until all of the boxes are ticked. Once your pull request is created, it will trigger a build on our continuous integration server to make sure your tests and code style pass.

  • I have read the CONTRIBUTING document.
  • My pull request addresses exactly one patch/feature.
  • I have created a branch for this patch/feature.
  • Each individual commit in the pull request is meaningful.
  • I have added tests to cover my changes.
  • If my change requires a change to the documentation, I have updated it accordingly.

Comment thread composer.json Outdated
Comment thread tests/TypeMapTest.php Outdated
Comment thread src/TypeMapOnNonObjectField.php Outdated
Comment thread src/TypeMapper.php Outdated
@agustingomes agustingomes force-pushed the issues/10 branch 2 times, most recently from ceb045c to b537a88 Compare March 27, 2026 22:48
Comment thread tests/SerdeTestCases.php Outdated
@Crell

Crell commented Apr 22, 2026

Copy link
Copy Markdown
Owner

(Haven't forgotten this, just been busy. And about to go on vacation for a few days.)

@agustingomes

agustingomes commented Apr 22, 2026

Copy link
Copy Markdown
Contributor Author

(Haven't forgotten this, just been busy. And about to go on vacation for a few days.)

No rush, I completely understand, time is often limited these days, so take your time.

This change uses the upstream commit allowing Crell#10 to be fixed.

NOTE: it is expected a new release of `crell/attributeutils` to be released. using directly the hash is for the purpose of validating the implementation changes in this PR
This commit implements serialization of an enum within a Type Map.

Therefore, individual enums being passed in a list, would be serialized as:

```
{"type": "enum", "value": "the-enum-value"}
```
@Crell Crell merged commit 4312cde into Crell:master Jun 7, 2026
6 checks passed
@agustingomes agustingomes deleted the issues/10 branch June 7, 2026 19:57
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.

Enums lose type information when serialised as part of a static map

2 participants