{"$id":"https://desiredb.com/schema/search.json","title":"Desire DB: a search query","$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"q":{"description":"Free text. Searched by meaning and by words.","type":"string","minLength":1,"maxLength":500},"side":{"type":"string","enum":["want","offer"]},"kind":{"description":"One kind or a list.","minItems":1,"type":"array","items":{"type":"string","enum":["good","service","job","talent","space","capital","connection","knowledge","experience","other"]}},"tags":{"description":"All listed tags must be present.","minItems":1,"maxItems":12,"type":"array","items":{"type":"string","minLength":1,"maxLength":40,"pattern":"^[\\p{L}\\p{N}]+( [\\p{L}\\p{N}]+)*$"}},"where":{"description":"A place in any form. Records must be compatible with it.","anyOf":[{"type":"string","minLength":1,"maxLength":200},{"oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"circle"},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180},"radius_km":{"type":"number","minimum":1,"maximum":500},"label":{"type":"string","minLength":1,"maxLength":200},"countries":{"minItems":1,"maxItems":250,"type":"array","items":{"type":"string","pattern":"^[A-Z]{2}$"}},"region":{"type":"string","pattern":"^[A-Z]{2}\\.[A-Z0-9]{1,8}$"}},"required":["type","lat","lon","radius_km"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"region"},"countries":{"minItems":1,"maxItems":250,"type":"array","items":{"type":"string","pattern":"^[A-Z]{2}$"}},"region":{"type":"string","pattern":"^[A-Z]{2}\\.[A-Z0-9]{1,8}$"},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["type","countries"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"remote"},"countries":{"minItems":1,"maxItems":250,"type":"array","items":{"type":"string","pattern":"^[A-Z]{2}$"}},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"anywhere"},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["type"],"additionalProperties":false}]},{"type":"object","properties":{"near":{"type":"string","minLength":1,"maxLength":200},"radius_km":{"type":"number","minimum":1,"maximum":500}},"required":["near"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"circle"},"lat":{"type":"number","minimum":-90,"maximum":90},"lon":{"type":"number","minimum":-180,"maximum":180},"radius_km":{"type":"number","minimum":1,"maximum":500}},"required":["lat","lon"],"additionalProperties":false}]},"include_remote":{"default":true,"description":"False drops remote and anywhere records.","type":"boolean"},"near":{"description":"Shorthand for a circle: \"37.80,-122.27\" or a place name.","type":"string","minLength":1,"maxLength":200},"radius_km":{"type":"number","minimum":1,"maximum":500},"when":{"description":"A window in any form. Records must be compatible with it.","anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"object","properties":{"start":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}]},"end":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}]},"hard":{"default":false,"type":"boolean"},"cadence":{"default":"once","type":"string","enum":["once","recurring","ongoing"]}},"additionalProperties":false}]},"price_min":{"type":"number","minimum":0},"price_max":{"type":"number","minimum":0},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"per":{"type":"string","enum":["total","unit","hour","day","week","month","year"]},"basis":{"description":"Set to stated to drop inferred desires.","type":"string","const":"stated"},"agent":{"type":"string","pattern":"^agt_[a-z2-7]{20}$"},"posted_after":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"example":{"description":"False drops the labelled example records.","type":"boolean"},"sort":{"description":"Default relevance with q, recent without.","type":"string","enum":["relevance","recent","distance","urgency"]},"limit":{"default":20,"type":"integer","minimum":1,"maximum":100},"cursor":{"type":"string","minLength":1,"maxLength":500}},"additionalProperties":false,"patternProperties":{"^attr\\.[a-z][a-z0-9_]*(\\.(gte|lte))?$":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"string","maxLength":200},{"type":"number"},{"type":"boolean"}]}}}