Skip to content

Commit

Permalink
Handle reading null JSON values when creating CDATA elements (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blacksmoke16 authored Aug 16, 2022
1 parent eef60fe commit a60acdd
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ The built binary will be available as `./bin/oq`. This can be relocated elsewhe

```dockerfile
# Set an arg to store the oq version that should be installed.
ARG OQ_VERSION=1.3.3
ARG OQ_VERSION=1.3.4

# Grab the binary from the latest Github release and make it executable; placing it within /usr/local/bin. Can also put it elsewhere if you so desire.
RUN wget https://github.com/Blacksmoke16/oq/releases/download/v${OQ_VERSION}/oq-v${OQ_VERSION}-linux-x86_64 -O /usr/local/bin/oq && chmod +x /usr/local/bin/oq
Expand Down
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: oq
description: |
A performant, and portable jq wrapper thats facilitates the consumption and output of formats other than JSON; using jq filters to transform the data.
version: 1.3.3
version: 1.3.4

authors:
- George Dietrich <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: oq
version: '1.3.3'
version: '1.3.4'
summary: A performant, and portable jq wrapper to support formats other than JSON
description: |
A performant, and portable jq wrapper thats facilitates the consumption and output of formats other than JSON; using jq filters to transform the data.
Expand Down
12 changes: 12 additions & 0 deletions spec/converters/xml_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,18 @@ describe OQ::Converters::XML do
)
end
end

it "should produce an empty CDATA if the json key starts with '!' and the value is null" do
run_binary(%({"!x":null}), args: ["-o", "xml", "."]) do |output|
output.should eq(<<-XML
<?xml version="1.0" encoding="UTF-8"?>
<root>
<x><![CDATA[]]></x>
</root>\n
XML
)
end
end
end
end

Expand Down
1 change: 1 addition & 0 deletions src/converters/xml.cr
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ module OQ::Converters::XML
when .int? then json.read_int
when .float? then json.read_float
when .bool? then json.read_bool
when .null? then json.read_null
else
""
end.to_s
Expand Down
2 changes: 1 addition & 1 deletion src/oq.cr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require "./converters/*"

# A performant, and portable jq wrapper thats facilitates the consumption and output of formats other than JSON; using jq filters to transform the data.
module OQ
VERSION = "1.3.3"
VERSION = "1.3.4"

# The support formats that can be converted to/from.
enum Format
Expand Down

0 comments on commit a60acdd

Please sign in to comment.