Skip to content

Instantly share code, notes, and snippets.

{
"id": "http://some.site.somewhere/entry-schema#",
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "schema for an fstab entry",
"type": "object",
"required": [ "storage" ],
"properties": {
"storage": {
"type": "object",
"oneOf": [
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"/": { "$ref": "http://some.site.somewhere/entry-schema#" }
},
"patternProperties": {
"^(/[^/]+)+$": { "$ref": "http://some.site.somewhere/entry-schema#" }
},
"additionalProperties": false,
@fge
fge / t2.html
Created January 17, 2013 16:05
test page for validation
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- There is, at present, no official xsd for (X)HTML5. A pity. Usefulness would depend on the parser and extensions made by the site. -->
<title>testcase</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
{
"definitions": {
"def1": {},
"def2": {
"id": "http://other.site/schema#",
"type": "array",
"items": { "$ref": "#/definitions/def1" }
}
}
}
@fge
fge / samples.json
Created January 22, 2013 19:26
broken testing sample
[
{
"schema": {
"minimum": 1.1,
"exclusiveMinimum": true
},
"data": 1.2,
"useV4": false,
"useId": false
},
@fge
fge / geometry.json
Created January 23, 2013 14:28
JSON Schema (v4) for a geometry as defined by GeoJSON
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://json-schema.org/geojson/geometry.json#",
"title": "geometry",
"description": "One geometry as defined by GeoJSON",
"type": "object",
"required": [ "type", "coordinates" ],
"oneOf": [
{
"title": "Point",
@fge
fge / geojson.json
Created January 23, 2013 15:34
Schema for a GeoJSON object
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://json-schema.org/geojson/geojson.json#",
"title": "Geo JSON object",
"description": "Schema for a Geo JSON object",
"type": "object",
"required": [ "type" ],
"oneOf": [
{ "$ref": "http://json-schema.org/geojson/geometry.json#" },
{ "$ref": "#/definitions/geometryCollection" },
package com.github.fge.jsonschema.processing;
import com.github.fge.jsonschema.exceptions.ProcessingException;
import com.github.fge.jsonschema.report.MessageProvider;
import com.github.fge.jsonschema.report.ProcessingMessage;
import com.github.fge.jsonschema.report.ProcessingReport;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
@fge
fge / schema
Created February 19, 2013 14:22
Fixed core metaschema for draft v3
{
"$schema": "http://json-schema.org/draft-03/schema#",
"id": "http://json-schema.org/draft-03/schema#",
"type": "object",
"properties": {
"type": {
"type": [ { "$ref": "#/definitions/simpleType" }, "array" ],
"items": {
"type": [ { "$ref": "#/definitions/simpleType" }, { "$ref": "#" } ]
@fge
fge / animals.json
Created February 26, 2013 11:19
Animals with additionalProperties: false
{
"$schema": "http://json-schema.org/draft-04/schema#",
"oneOf": [
{
"description": "a single animal",
"$ref": "#/definitions/animal"
},
{
"description": "a collection of animals",
"type": "array",