Demonstrate oneOf, allOf, and anyOf
1 min
code examples curl request post \\ \ url /example \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ data '{ "oneofexample" { "name" "", "meows" "" }, "allofexample" { "name" "", "pettype" "" }, "anyofexample" { "brand" "", "model" "" } }'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var raw = json stringify({ "oneofexample" { "name" "", "meows" "" }, "allofexample" { "name" "", "pettype" "" }, "anyofexample" { "brand" "", "model" "" } }); var requestoptions = { method 'post', headers myheaders, body raw, redirect 'follow' }; fetch("/example", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));require "uri" require "json" require "net/http" url = uri("/example") http = net http new(url host, url port); request = net http post new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" request body = json dump({ "oneofexample" { "name" "", "meows" "" }, "allofexample" { "name" "", "pettype" "" }, "anyofexample" { "brand" "", "model" "" } }) response = http request(request) puts response read body import requests import json url = "/example" payload = json dumps({ "oneofexample" { "name" "", "meows" "" }, "allofexample" { "name" "", "pettype" "" }, "anyofexample" { "brand" "", "model" "" } }) headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("post", url, headers=headers, data=payload) print(response text) responses // successful response { "message" "" }