Skip to content
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

Try to deserialize data or metadata string to JSON object when writing through HTTP API #1881

Merged
merged 1 commit into from Apr 30, 2019

Conversation

2 participants
@shaan1337
Copy link
Member

commented Mar 5, 2019

Issue

Writing the following event with escaped JSON string does not mark the event with the IsJson=True flag internally:

[
  {
    "eventId": "769fbc2b-762d-4fc9-9fab-d4fc1fd4e4b6",
    "eventType": "someType",
    "data": "{\"testdata\":\"testvalue\"}",
    "metadata": "{\"testmetadata\":\"testvalue\"}"
  }
]

This one on the other hand, does mark the event with the IsJson=True flag:

[
  {
    "eventId": "769fbc2b-762d-4fc9-9fab-d4fc1fd4e4b6",
    "eventType": "someType",
    "data": {"testdata":"testvalue"},
    "metadata": {"testmetadata":"testvalue"}
  }
]

Test query (you can then subscribe to the stream to see if IsJson=True or False):

curl -i -d "@event.txt" "http://127.0.0.1:2113/streams/mystream" -H "Content-Type:application/vnd.eventstore.event+json"

Resolution
Try to parse strings as JSON object in the AutoEventConverter and if successful, mark the event with IsJson=True

Try to deserialize data or metadata string to JSON and mark isJson=tr…
…ue if the deserialization is successful

@shaan1337 shaan1337 changed the title Try to deserialize data or metadata string to JSON when writing through HTTP API Try to deserialize data or metadata string to JSON object when writing through HTTP API Mar 5, 2019

@shaan1337 shaan1337 requested a review from avish0694 Apr 30, 2019

@jageall jageall self-requested a review Apr 30, 2019

@jageall jageall merged commit c25a5a5 into master Apr 30, 2019

9 checks passed

EventStore.EventStore Build #20190305.1 succeeded
Details
EventStore.EventStore (Centos 7 x64 Debug) Centos 7 x64 Debug succeeded
Details
EventStore.EventStore (Centos 7 x64 Release) Centos 7 x64 Release succeeded
Details
EventStore.EventStore (Ubuntu 14.04 x64 Debug) Ubuntu 14.04 x64 Debug succeeded
Details
EventStore.EventStore (Ubuntu 14.04 x64 Release) Ubuntu 14.04 x64 Release succeeded
Details
EventStore.EventStore (Windows x64 Debug) Windows x64 Debug succeeded
Details
EventStore.EventStore (Windows x64 Release) Windows x64 Release succeeded
Details
EventStore.EventStore (macOS x64 Debug) macOS x64 Debug succeeded
Details
EventStore.EventStore (macOS x64 Release) macOS x64 Release succeeded
Details

@jageall jageall deleted the deserialize-json-string branch Apr 30, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.