Skip to content

Nested Object Deserializer #1296

Open
Open
@geethanandh

Description

@geethanandh

I am trying to build a dynamic SQL query language and have a JSON like this for representing where clause

{
    "filter": {
        _and: [
            { rating: { _gte: 4 } },
            { published_on: { _gte: "2018-01-01" } },
            {
                _or: [{
                    type: { _eq: 'Books' },
                    language: { _eq: "Spanish" }
                },
                {
                    type: { _eq: 'Movies' },
                    language: { _eq: "English" }
                }]
            }
        ]
    }
}

Idea here is, Get me all Spanish books or English Movies published after 2018 with a rating greater than 4

Schema is something like this

filter: BoolExp
BoolExp: [AndExp] | [OrExp]| [ColumnExp]
{_and: [BoolExp]}
{_or: [BoolExp]}
ColumnExp => { field-name: { [Operator]: Value }}

Operator has values like eq, gt, lt,..

Please note there could be nested conditions like or within an and which is also within another or

I am unsure about how to create typescript classes and configure them. Any help is appreciated.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: questionQuestions about the usage of the library.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions