Questions tagged [json-schema-defaults]

11 questions
7
votes
1 answer

How to specify defaults conditionally with JSON Schema

I have a field status. If the user is setting the job as draft status I don't want to require the description field - but I DO want to to have a default of empty string. If the user is publishing the job than I want the description to be…
nwkeeley
  • 1,397
  • 5
  • 18
  • 28
6
votes
1 answer

Importing all definitions from an external JSON Schema

I've been experimenting with JSON Pointers to reference and reuse JSON schemas. Following the examples, I'm able to reference a specific property declared in another JSON schema and everything goes as expected, but I haven't found a way to extend a…
3
votes
1 answer

How to create default json object from json schema in c#

I can not google that thing on json.net api reference or anywhere. I want to create object from json schema with default values filled in. Basically some thing like this: var JsonSchema=JsonSchema.ReadSchemaFromSomeWhere(); dynamic DefaultObject=…
Kostia Mololkin
  • 868
  • 9
  • 25
1
vote
2 answers

json schema to validate datetime is after unix epoch or not

I am new to json , I want to write a json schema which accepts array of time stamps in ISO8061 standard and make sure that the time is after unix epoch i.e 1 January 1970 00:00:00 the date-time in json-schema is making sure that time is ISO8061…
1
vote
0 answers

Object creation from separated json schema files

Now I am building node.js app and my needs are: 1.validate&delete props which are unneccesary before routing app.post('/comments', f_validateAndDeleteUnnecceraryPropsOfRequestBody, function(req, res, next){ ... 2.create objects from json schemas…
uzay95
  • 16,052
  • 31
  • 116
  • 182
0
votes
0 answers

Required field in json schema design - Any one of is mandatory

I have a specific case while designing schema for my json. In below Json schema design, I have 4 properties siteMapUrls s3SeedUrl s3SiteMapUrl seedUrlConnections Out of these 4 properties, any one is mandatory, how shall I use required field in…
Gunwant
  • 949
  • 1
  • 14
  • 29
0
votes
1 answer

json-schema - allow for logical-OR in required properties

An alternate title for this question would be "required property combinations". Say I am working with a json-schema like so: { "$schema": "http://json-schema.org/draft-07/schema#", "title": "JSON schema for NLU (npm-link-up) library.", "type":…
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817
0
votes
2 answers

Seggregation of Json Schema Validation and Json Validation

I have a use case where I will take a json-schema as input, validate it, then keep in my system. Later I will get json data which I need to validate with above mentioned json-schema. given the scenario, I need to do two level of validations: 1.…
0
votes
2 answers

How to handle default values of sub-objects within a JSON schema validation?

How should a JSON schema validator handle the case where a sub-object of an object has a default value but the parent object hasn't? Imagine the following schema { "type": "object", "properties": { "element": { "type":…
Patrick B.
  • 11,773
  • 8
  • 58
  • 101
0
votes
1 answer

Create JSON schema based on a json object

Given the following JSON object, how can I build json schema? Product1, Product2 and Product3 are dynamic "keys" and I could have many more like that, but each of them will have the same "value" object with required keys as packageId1, packageId2,…
RKG
  • 592
  • 1
  • 7
  • 23
0
votes
0 answers

How to create a json-schema out of a json object

Given a browser debugger output of root.value with two properties in javascript root.value __proto__: {...} firstname: "my name" age: 25 I want to parse it to a JSON string including the type like below. Or literally convert the above json object…
agentpx
  • 1,051
  • 1
  • 8
  • 24