Questions tagged [json-ref]

A JSON reference is an object with only a field named `$ref`, containing a URI that points to the resource providing the actual value that should have been in place of the JSON object.

JSON reference is not officially standardized, but a common convention is described in a draft specification on IETF:

a JSON structure which allows a JSON value to reference another value in a JSON document. This provides the basis for transclusion in JSON: the use of a target resource as an effective substitute for the reference.

(A JSON reference allows) transclusion in JSON: the use of a target resource as an effective substitute for the reference.

Example:

{
    "$ref": "https://example.com/data.json"
}

JSON references are commonly used in JSON specification documents, such as OpenAPI, JSON Schema, JSON spec.

10 questions
29
votes
1 answer

Liquid Studio: How to write a JSON schema $ref to another file

I'm trying to refer to a JSON schema located in a different file using "$ref" with Liquid Studio 2017. Both the referring JSON schema and the referred JSON schema are located within the same directory. I tried it using relative paths: "$ref":…
hounce
  • 312
  • 1
  • 3
  • 6
18
votes
2 answers

json schema property description and "$ref" usage

I am writting a json schema to validate my json outputs produced by an exe.The schema being little bit complexe, I have defined some "definitions" that are referenced in properties ("$ref": "#/definitions/...). And using definitions here is all the…
Azias
  • 547
  • 1
  • 4
  • 12
5
votes
1 answer

How to correctly reference other JSON Schema Documents ($ref)

I've read through the RFCs regarding JSON Schema and JSON pointers, but I'm still struggling to understand how to correctly reference other documents. Lets say I have the following files (on…
Andy Raines
  • 297
  • 1
  • 3
  • 9
4
votes
4 answers

Is there something wrong with this json reference?

I'm trying to take some JSON containing references and resolve them. I'm using the jsonref library to do it. I have reduced my problem to these two cases: import jsonref print(jsonref.JsonRef.replace_refs(jsonref.loads(''' { "foo": { …
MatrixManAtYrService
  • 8,023
  • 1
  • 50
  • 61
3
votes
1 answer

Using a $ref and other properties within a JSON Schema

In a JSON Schema is is valid to have a $ref and then other properties within the same schema, for example. { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "title": "My schema", "properties": { …
Sprotty
  • 5,676
  • 3
  • 33
  • 52
2
votes
1 answer

Resolving "$ref" in serde_json/serde_yaml

What is the best way to recursively resolve all JSON $ref in JSON documents? A direct approach is to create a Deserialize implementation that accepts either a {"$ref"} object or a desired value, say an enum like this: enum JRef { Value(T), …
SOFe
  • 7,867
  • 4
  • 33
  • 61
2
votes
1 answer

json complex schema reusable definitions, $ref validations in nested properties ignored

Trying to learn JSON schemas and I have a complex schema that is all based on relative URL's. When nesting properties call a definitions property defined in another file, the validations sometimes get ignored. My goal is to basically make reusable…
soulshined
  • 9,612
  • 5
  • 44
  • 79
1
vote
0 answers

Gatsby JSON loader not following refs

I need to dereference (swap out JSON References) when importing JSON or YAML files directly into Gatsby pages. Gatsby is pretty good at importing JSON files directly (probably due to some underlying webpack loader), but it doesn't seem to handle…
shennan
  • 10,798
  • 5
  • 44
  • 79
1
vote
1 answer

How can i use $ref in json-schema with vue-json-schema-form?

I am trying to generate a form which can have multiple recursive fields. I have used https://codepen.io/crickford/pen/ZmJqwd this demo (I am not using any custom component). Whenever i am using "$ref" it ignores it. I am using vue-json-schema-form.…
0
votes
1 answer

How do I merge multiple lists using JSON ref?

I have the following YAML - name: Core description: Core functionality - name: Artifact description: Artifact management # - $ref: "v1/publications.yml#/tags/" v1/publications.yml has tags: - name: Publication description: | This…
Archimedes Trajano
  • 35,625
  • 19
  • 175
  • 265