Last active
August 29, 2015 14:16
-
-
Save Deiru2k/e602c6fca94f5df2c5b6 to your computer and use it in GitHub Desktop.
Of Projections and schemas
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
{ | |
"type": "object", | |
"properties": { | |
"mainPhoto": {"type": "string"}, | |
"propertyType": {"type": "string"}, | |
"price": { | |
"type": "object", | |
"properties": { | |
"USD": {"type": "number"}, | |
"RUB": {"type": "number"} | |
} | |
}, | |
} | |
} | |
{"mainPhoto": True, "propertyType": True, "price.USD": True, "price.RUB": True} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
price не может быть, если у него есть вложенные объекты.
Если пояснить за контекст: Есть жсон схема, которая валидирует объект на входе\выходе ресурса.
Чтобы из БД лишний раз не тянуть не нужные поля, надо написать хуйню которая будет плющить многомерный словарь до того формата, который я пояснял, чтобы забирать из БД.
P.S.: Попробую сделать по твоей схеме, я о ней и думал. Просто мало ли, есть более красивые подходы.