tlaplus / CommunityModules

TLA+ snippets, operators, and modules contributed and curated by the TLA+ community
MIT License
273 stars 36 forks source link

Add JSON operators for serializing/deserializing files #9

Closed kuujo closed 4 years ago

kuujo commented 4 years ago

This pull request adds new JSON operators for reading and writing JSON files and additional operators for encoding values to JSON:

JSON parsing and encoding is done using the Jackson library. Dependencies are added to the build to download Jackson jars.

Tests are added for the ToJson, ToJsonObject and ToJsonArray operators, but I wasn't sure how to test the file-dependent operators.

kuujo commented 4 years ago

May supersede #8

kuujo commented 4 years ago

I'm trying to ensure this PR is consistent with the added types supported by #8

kuujo commented 4 years ago

@lemmy I think I got everything covered. The converters now support all the types in #8, there are tests for JsonSerialize and JsonDeserialize, and the Jackson jars are stored locally rather than downloaded.

I modified .gitignore to only ignore the tla2tools.jar in the lib directory and put the Jackson jars there. I'm not familiar with Ant so that may be a bad idea. I can put them somewhere else if you have any suggestions, but that seemed the most sensible.

kuujo commented 4 years ago

Ahh wait I didn't add specs for the operators...

lemmy commented 4 years ago

Thanks for your contribution!

Merged in https://github.com/tlaplus/CommunityModules/commit/1b78c803ce60a22e1692921fa5c70ba40da646d4