Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moh-hassan/e53923ea9a62e850d6e8db84702c122f to your computer and use it in GitHub Desktop.
Save moh-hassan/e53923ea9a62e850d6e8db84702c122f to your computer and use it in GitHub Desktop.
The generated schema with external reference manually using NJsonSchema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"title": "personal",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"address": {
"type": "array",
"items": {
"$ref": "http://json-schema.org/address#"
}
},
"businessAddress": {
"$ref": "http://json-schema.org/address#"
}
}
}
-------------- Reloading the generated schema with # concatendted at the end of the uri path
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"title": "personal",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"address": {
"type": "array",
"items": {
"$ref": "http://json-schema.org/address#/definitions/Address"
}
},
"businessAddress": {
"$ref": "http://json-schema.org/address#/definitions/Address"
}
},
"definitions": {
"Address": {
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"required": [
"locality",
"region",
"country-name"
],
"properties": {
"post-office-box": {
"type": "string"
},
"extended-address": {
"type": "string"
},
"street-address": {
"type": "string"
},
"locality": {
"type": "string"
},
"region": {
"type": "string"
},
"postal-code": {
"type": "string"
},
"country-name": {
"type": "string"
}
},
"description": "An Address following the convention of http://microformats
.org/wiki/hcard",
"dependencies": {
"post-office-box": [
"street-address"
],
"extended-address": [
"street-address"
]
}
}
}
}
-------------- Reloading the generated schema without # concatendted at the end of the uri path
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"title": "personal",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"address": {
"type": "array",
"items": {
"$ref": "http://json-schema.org/address#/definitions/Address"
}
},
"businessAddress": {
"$ref": "http://json-schema.org/address#/definitions/Address"
}
},
"definitions": {
"Address": {
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"required": [
"locality",
"region",
"country-name"
],
"properties": {
"post-office-box": {
"type": "string"
},
"extended-address": {
"type": "string"
},
"street-address": {
"type": "string"
},
"locality": {
"type": "string"
},
"region": {
"type": "string"
},
"postal-code": {
"type": "string"
},
"country-name": {
"type": "string"
}
},
"description": "An Address following the convention of http://microformats
.org/wiki/hcard",
"dependencies": {
"post-office-box": [
"street-address"
],
"extended-address": [
"street-address"
]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment