poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] JSON Schema Mapping property now works as expected


From: Konstantinos Chasialis
Subject: [PATCH] JSON Schema Mapping property now works as expected
Date: Thu, 1 Apr 2021 17:59:54 +0300
User-agent: SquirrelMail/1.4.23 [email.uoa.gr]

Hello,

Recently we had a discussion with Mohammad on IRC about "Mapping" object
on the JSON Schema.

We had an issue the following issue.

Suppose "mapped" was false (which means the object is not mapped), then
"IOS", "strict" and "offset" did not need to be defined so the only truly
"required" field was "mapped".

But this had a flaw. Because "maxProperties" were 4 and the only
"required" property was "mapped" the user could easily define something
like :

"PokeValue" : {
    ...
    "mapping" : {
        "mapped": false,
        "strict": true,
        "IOS": 123,
        "strict": false
    }
}

which is bad imo.

With the new changes, user is obliged to define "strict", "IOS", "offset"
only if the field "mapped" is true.
In case "mapped" is false he is not allowed to define anything else
(or even define the "mapped" field twice).

I know we do not have a validator right now and all of these are not
really applicable but we might have one in the future.

I also added the "default" property which I'd like to mention that it does
not work as : "in case the user did not define this property, define it
and give it this value".

Such thing does not exist in JSON Schema. The "default" property is like
"title", just for documentation purposes.

Sorry for long message, please tell me your comments.

Attachment: 0005-JSON-Schema-Mapping-property-now-works-as-expected.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]