Skip to content

Standardizing and fixing serialization#161

Merged
MatejMa2ur merged 3 commits intoYet-another-solution:mainfrom
Jacob-Steentoft:main
Feb 4, 2026
Merged

Standardizing and fixing serialization#161
MatejMa2ur merged 3 commits intoYet-another-solution:mainfrom
Jacob-Steentoft:main

Conversation

@Jacob-Steentoft
Copy link
Contributor

Been diving a bit deeper into the library to fix the issues that we're having with the current preview as the serialization process is a bit strange from a normal STJ pattern.

The following changes fixes callbacks having out of order type params and fully supporting serialization and deserialization of all the existing polymorphic types.

Layers is still a bit of a beast due to the way that the properties are setup, but I'll have a pass on the OneOf serialization process to see if we can support the built-in types mixing with normal types.

@Jacob-Steentoft
Copy link
Contributor Author

Note that this removed the simple type that was created for callbacks. This is a breaking change, but will allow for more data in the future.

Comment on lines +5 to +6
[JsonPolymorphic(TypeDiscriminatorPropertyName = "type")]
[JsonDerivedType(typeof(FeatureCollection), "FeatureCollection")]
Copy link
Member

Choose a reason for hiding this comment

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

Does this work without a problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In my testing, yes. The data is returned from MapLibre using the type property, and the type descriminator is FeatureCollection. So STJ can handle everything for us for serial and deserial

@MatejMa2ur
Copy link
Member

Hi,
can you please elaborate more about the breaking change on callbacks?

I am mainly asking, because the code seem fine, I just do not fully understand what will be the breaking change.

@Jacob-Steentoft
Copy link
Contributor Author

Hi, can you please elaborate more about the breaking change on callbacks?

I am mainly asking, because the code seem fine, I just do not fully understand what will be the breaking change.

The SimpleFeature is replaced with another type which can break if people have any dependencies on the type itself. The fix is very quick however as you just need to replace the type reference since the properties are the same.

@MatejMa2ur MatejMa2ur merged commit 85ba2c5 into Yet-another-solution:main Feb 4, 2026
9 checks passed
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.

2 participants