Open
Conversation
Owner
|
Thank you for the PR! 🙏 I'll try to review this more seriously in the next month. |
Vlix
requested changes
Oct 19, 2024
| safeToJSON | ||
| , safeFromJSON | ||
| , strippedSafeToJSON | ||
| , strippedEncode |
Owner
There was a problem hiding this comment.
I feel these functions should be added under the Version section. The context there makes more sense and would be better when describing why these functions exist.
, Version
, noVersion
, setVersion
, setVersion'
, getVersion
-- *** Removing the 'SafeJSON' version
--
-- | Sometimes you might want (or need) to produce JSON without `SafeJSON` versioning.
-- Maybe you don't want to leak internals to third parties, or the version fields are
-- irrelevant and only clutter in a specific instance.
-- Regardless of the case, if you don't need to parse the JSON again, these functions
-- can be used to remove the `SafeJSON` versioning.
, removeVersion
, strippedSafeToJSON
, strippedEncodeAnd then we'll give a bit more context per function.
| @@ -1,5 +1,8 @@ | |||
| # Changelog for safe-json | |||
|
|
|||
| ## 1.3.0.0 | |||
Owner
There was a problem hiding this comment.
This would be a minor version increase. 1.2.1.0
| typeName _ = "Product" | ||
| version = noVersion | ||
|
|
||
| -- | safeToJSON with the version removed |
Owner
There was a problem hiding this comment.
-- | 'safeToJSON' without any `SafeJSON` versioning.
-- Effectively the same as 'Data.Aeson.toJSON', but using the 'safeTo' method.
--
-- Sometimes you don't need (or want) the versioning, so if you don't need to parse
-- the 'Data.Aeson.Value' later on, this is a convenience function to easily
-- remove the version fields from the resulting JSON.
--
-- @
-- strippedSafeToJSON = 'removeVersion' . 'safeToJSON'
-- @
--
-- @since 1.2.1.0| strippedSafeToJSON :: forall a. SafeJSON a => a -> Value | ||
| strippedSafeToJSON = removeVersion . safeToJSON | ||
|
|
||
| -- | encode with version removed |
Owner
There was a problem hiding this comment.
-- | Encode a 'SafeJSON' value to a 'LBS.ByteString' without SafeJSON versioning.
--
-- Like this package's own 'Data.Aeson.Safe.encode' function,
-- but without version fields in the resulting 'LBS.ByteString'.
--
-- @
-- strippedEncode = 'Data.Aeson.encode' . 'strippedSafeToJSON'
-- @
--
-- @since 1.2.1.0
Owner
|
Oh, and rebase onto master, please. The CI has been fixed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#36