-
Notifications
You must be signed in to change notification settings - Fork 4
Add strippedSafeToJSON #43
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
base: master
Are you sure you want to change the base?
Conversation
|
Thank you for the PR! 🙏 I'll try to review this more seriously in the next month. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also please update the package.yaml's version to 1.2.1.0
| safeToJSON | ||
| , safeFromJSON | ||
| , strippedSafeToJSON | ||
| , strippedEncode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be a minor version increase. 1.2.1.0
| typeName _ = "Product" | ||
| version = noVersion | ||
|
|
||
| -- | safeToJSON with the version removed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-- | '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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-- | 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|
Oh, and rebase onto master, please. The CI has been fixed. |
#36