-
Notifications
You must be signed in to change notification settings - Fork 602
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
[CORE-3182] Schema Registry json external references #24125
Open
BenPope
wants to merge
10
commits into
redpanda-data:dev
Choose a base branch
from
BenPope:feat/core-3182/schema-registry-json-external-references
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+926
−204
Open
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e99858f
schema_registry/avro: move collect_schema to util.h
andijcr ba1307f
schema_registry/util: collect_schema overlad, collected_schema::get
andijcr 7d164b4
schema_registry/json: move to_json_pointer, conversion jsoncons->rapi…
andijcr 12b52b2
schema_registry/json: prepare document_context to store external schemas
andijcr d3486a8
schema_registry/json: add the support to resolve external references
andijcr 06c46bd
schema_registry/json: convert parse_json to coroutine
andijcr 91956cb
schema_registry/json: move parse_json to jsoncons-only
andijcr 511f12e
schema_registry/json: parse_json extract external schemas
andijcr 57ff37c
schema_registry/json collect_bundled_schemas_and_fix_refs improvement
andijcr 117abf9
schema_registry/json: remaning work
andijcr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -19,8 +19,9 @@ | |||||
#include "pandaproxy/schema_registry/errors.h" | ||||||
#include "pandaproxy/schema_registry/schema_getter.h" | ||||||
#include "pandaproxy/schema_registry/types.h" | ||||||
#include "utils/absl_sstring_hash.h" | ||||||
|
||||||
#include <absl/container/flat_hash_set.h> | ||||||
#include <absl/container/flat_hash_map.h> | ||||||
#include <fmt/core.h> | ||||||
#include <fmt/format.h> | ||||||
#include <rapidjson/error/en.h> | ||||||
|
@@ -62,34 +63,44 @@ ss::sstring to_string(named_type<iobuf, Tag> def) { | |||||
} | ||||||
class collected_schema { | ||||||
public: | ||||||
bool contains(const ss::sstring& name) const { | ||||||
return _names.contains(name); | ||||||
using map_t = absl::flat_hash_map< | ||||||
ss::sstring, | ||||||
canonical_schema_definition::raw_string, | ||||||
sstring_hash, | ||||||
sstring_eq>; | ||||||
|
||||||
bool contains(std::string_view name) const { | ||||||
return _schemas.contains(name); | ||||||
} | ||||||
|
||||||
bool insert(ss::sstring name, canonical_schema_definition def) { | ||||||
bool inserted = _names.insert(std::move(name)).second; | ||||||
if (inserted) { | ||||||
_schemas.push_back(std::move(def).raw()); | ||||||
} | ||||||
return inserted; | ||||||
return _schemas.emplace(std::move(name), std::move(def).raw()).second; | ||||||
} | ||||||
|
||||||
canonical_schema_definition::raw_string flatten() && { | ||||||
iobuf out; | ||||||
for (auto& s : _schemas) { | ||||||
for (auto& [_, s] : _schemas) { | ||||||
out.append(std::move(s)); | ||||||
out.append("\n", 1); | ||||||
} | ||||||
return canonical_schema_definition::raw_string{std::move(out)}; | ||||||
} | ||||||
|
||||||
map_t get() && { return std::exchange(_schemas, {}); } | ||||||
|
||||||
private: | ||||||
absl::flat_hash_set<ss::sstring> _names; | ||||||
std::vector<canonical_schema_definition::raw_string> _schemas; | ||||||
map_t _schemas; | ||||||
}; | ||||||
|
||||||
ss::future<collected_schema> collect_schema( | ||||||
schema_getter& store, | ||||||
collected_schema collected, | ||||||
ss::sstring name, | ||||||
ss::sstring opt_name, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: this could stay as
Suggested change
|
||||||
canonical_schema schema); | ||||||
|
||||||
ss::future<collected_schema> collect_schema( | ||||||
schema_getter& store, | ||||||
collected_schema collected, | ||||||
canonical_schema_definition::references refs); | ||||||
|
||||||
} // namespace pandaproxy::schema_registry |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nit: I think this commit would be easier to review if it was squashed into the previous one