Skip to content

airframe-codec: Support Base64 encoded binary#819

Merged
xerial merged 4 commits intowvlet:masterfrom
xerial:base64-string
Nov 22, 2019
Merged

airframe-codec: Support Base64 encoded binary#819
xerial merged 4 commits intowvlet:masterfrom
xerial:base64-string

Conversation

@xerial
Copy link
Copy Markdown
Member

@xerial xerial commented Nov 22, 2019

This will close #634

Previously airframe-codec encodes binary values as UTF-8 strings, but it may have caused data loss. This PR will use Base64 for representing binary values when generating JSON data.

Similarly, when reading string values to Array[Byte], try decoding the strings as Base64 binaries. If it fails, it will fall back to using the raw string byte arrays of the string.

This encoding is also used in Open API https://swagger.io/docs/specification/data-models/data-types/#string

cc: @takezoe @shimamoto

@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 22, 2019

Codecov Report

Merging #819 into master will decrease coverage by 0.07%.
The diff coverage is 82.35%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #819      +/-   ##
==========================================
- Coverage   81.03%   80.95%   -0.08%     
==========================================
  Files         224      224              
  Lines        8894     8904      +10     
  Branches      616      620       +4     
==========================================
+ Hits         7207     7208       +1     
- Misses       1687     1696       +9
Impacted Files Coverage Δ
.../main/scala/wvlet/airframe/msgpack/spi/Value.scala 78.98% <100%> (-2.45%) ⬇️
...in/scala/wvlet/airframe/codec/PrimitiveCodec.scala 85.49% <78.57%> (-1.41%) ⬇️
...ala/wvlet/airframe/msgpack/impl/UnpackerImpl.scala 81.69% <0%> (+1.4%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0c73d84...a914aff. Read the comment docs.

@xerial xerial merged commit f60af4e into wvlet:master Nov 22, 2019
@xerial xerial deleted the base64-string branch November 22, 2019 07:00
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.

airframe-codec: string-binary format encoding

1 participant