Last active
October 24, 2024 13:34
-
-
Save benissimo/d4fa3a9bd5561e14e96d029ffd6eee1d to your computer and use it in GitHub Desktop.
Manually tested with Confluent Platform 6.2.0
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
#!/bin/bash | |
# set -x | |
function schemaPost { | |
# Use heredoc to strip out newlines, needed so that post is pure JSON | |
cat <<EOF | |
{ | |
"schemaType": "PROTOBUF", | |
"schema": "${escapedSchema}" | |
} | |
EOF | |
} | |
valueSchema="`cat test_value_schema0.proto`" | |
escapedSchema=${valueSchema//\"/\\\"} # escape double quotes | |
curl -s "http://localhost:8081/subjects/TEST-value/versions" -H "Content-Type: application/vnd.schemaregistry.v1+json" --data @<(cat <<EOF | |
$(schemaPost) | |
EOF | |
) |
Marked, thanks Ben, really helpful
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This assumes you have a protobuf file
test_value_schema0.proto
and that you have Confluent Schema Registry running on port 8081.