public interface Ref
$ref
resolver. This interface is used to resolve $ref
in a JsonObject
. The result
is a new JsonObject
with all the $ref
replaced by actual object references.
This new object allows navigation and queries using JsonPointer
but will not be
able to be encoded back to JSON when circular dependencies are present.
The resolver will only resolve local references as defined in RFC3986. A local reference is a reference that starts
with #
and is followed by a valid JSON Pointer.Modifier and Type | Method and Description |
---|---|
static JsonObject |
resolve(JsonObject json)
Resolve all
$ref in the given JsonObject . |
static JsonObject resolve(JsonObject json)
$ref
in the given JsonObject
. The resolution algorithm is not aware of other
specifications. When resolving OpenAPI documents (which only allow $ref
at specific locations) you
should validate if the document is valid before performing a resolution.
It is important to note that any sibling elements of a $ref
is ignored. This is because $ref
works by replacing itself and everything on its level with the definition it is pointing at.json
- the JSON object to resolve.$ref
replaced by actual object references.IllegalArgumentException
- when the input JSON is not valid.UnsupportedOperationException
- reducing the JSON pointer to a value is undefined.Copyright © 2024 Eclipse. All rights reserved.