-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Add support for JSON schema #6
Comments
@oskardudycz I would like to work on this issue. |
@vr-varad great, much appreciated! Feel invited! 🙂 Here's my suggestion on how I see the breakdown. Each of that can be a separate Pull Request (and that's what I suggest 😉 ):
CREATE TABLE json_schema_registry (
id SERIAL PRIMARY KEY,
schema_name VARCHAR(255) NOT NULL,
version INT NOT NULL,
schema JSONB NOT NULL,
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
UNIQUE (schema_name, version)
); This should enable storing multiple schema versions. We'd also need to extend the document collection with a schema version nullable column, as each document can have a different schema (or none). By default, the schema name can be derived from the collection name, and the initial one can have 1. collection.find({ tags: 'tag1' }); Without knowing if tags are arrays, we don't know if we should do a string equality comparison or check if the provided value is inside the array. Doing both is not always performant. Schema can help here, as then we will know what type. @vr-varad thoughts? If you're open, we can tackle that gradually or split the work. I'm also happy to expand if something I wrote is unclear or if you disagree with some of that. |
@oskardudycz I'm excited to start by tackling the first item – adding JSON schema capability to Pongo. I'll work on this and create a Pull Request soon for your feedback. |
Thank you, looking forward to that! |
FYI, I added some initial work around the schema. It doesn't include yet the collection schema, just collections list with names and types: #73. |
@oskardudycz I have also worked some on it but wasn't sure that it would work |
This is needed not only for validation but also for detecting if the property is an array and correctly resolving the nested queries if the element is in the object.
The text was updated successfully, but these errors were encountered: