jsonschema multiple values for string property

If you want data to be one of a fixed set of exact values, you can use enum: { “type”: “string”, “enum”: [“stop”, “go”] } So, to fit this in your example, try: { “type”: “object”, “properties”: { “$gte”: { “type”: “string”, “oneOf”: [ {“pattern”: “<some-pattern>”}, {“enum”: [“TOKEN”, “ANOTHER_TOKEN”]} ] } } }

JSON Schema regarding use of $ref

OK: each $ref is resolved into a full URI. Once that is done, all your questions are answered by asking the question: What schema would I end up with, if I simply fetched that URI? Where the $ref is, how it was loaded, all of that is irrelevant – it’s entirely dependent on the resolved … Read more

JSON Schema to check date of YYYY-MM-DD

JSON Schema already have defined format for date, time, datetime, email, hostname, IP address. You can prefer this easier and recommended method rather than writing your own regex. “date”: { “type”: “string”, “format”: “date” } Date and time format names are derived from RFC 3339, section 5.6 [RFC3339]. Reference: http://json-schema.org/latest/json-schema-validation.html#rfc.section.7.3

JSON Schema validation in PostgreSQL?

There is another PostgreSQL extension that implements json validation. The usage is almost the same as “Postgres-JSON-schema” CREATE TABLE example (id serial PRIMARY KEY, data jsonb); — do is_jsonb_valid instead of validate_json_schema ALTER TABLE example ADD CONSTRAINT data_is_valid CHECK (is_jsonb_valid(‘{“type”: “object”}’, data)); INSERT INTO example (data) VALUES (‘{}’); — INSERT 0 1 INSERT INTO example … Read more

How do I configure VS Code to enable code completion on .json files (jsonschema support)?

The association of JSON schemas to files is done in the settings (File, Preferences, User Settings or Workspace Settings), under the property ‘json.schemas’. This is an example how the JSON schema for bower is associated to the bower schema. “json.schemas”: [ { “fileMatch”: [ “/bower.json”, “/.bower.json” ], “url”: “http://json.schemastore.org/bower” }, … You can also use … Read more

How to specify a property as null or a reference?

What you’ve posted should work, if you remove the “type”:”object” from the definition. However, a neater, more explicit way to specify alternatives is to use oneOf. You can keep your “id” definition untouched, and just use: “owner”:{ “oneOf”: [ {“type”: “null”}, {“$ref”:”#/definitions/id”} ] }

Understanding the “additionalProperties” keyword in JSON Schema draft version 4

You have found an error in the spec, so your not actually misinterpreting something. There is an updated version (from two days later) of the internet draft on the IETF website, where this example is different. see: https://datatracker.ietf.org/doc/html/draft-fge-json-schema-validation-00#page-13 As the document is an internet draft, most likely the version on http://datatracker.ietf.org/ is the correct version. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)