externalDocs : Object
externalDocs
ObjectPoints to an external resource that further documents the schema.
| Value |
This keyword must be set to an object that declares a url string, optionally a description string, and optionally any number of x- prefixed extensions
Hint: Use the jsonschema metaschema and jsonschema lint commands to catch keywords set to invalid values
|
|---|---|
| Kind | Other |
| Applies To | Any |
| Base Dialect | 2020-12 |
| Changed In | None |
| Introduced In | OpenAPI 3.1 |
| Vocabulary | OpenAPI 3.1 |
| Specification | https://spec.openapis.org/oas/v3.1.2.html#schema-external-docs |
| Metaschema | https://spec.openapis.org/oas/3.1/meta/base |
| Official Tests | None |
| Default | None |
| Annotation | None |
| Affected By | |
| Affects | None |
| Also See |
|
The externalDocs keyword
points to an external resource that further documents the schema it occurs in,
such as a reference page or a guide. It declares a required url and an
optional description that may use CommonMark
0.27 syntax. This keyword does not affect
validation and is not an annotation.
Common Pitfall
Only x- prefixed extensions may accompany the url and
description of this keyword’s value. Any other property makes the schema
invalid against the vocabulary meta-schema.
Digging Deeper
The url may be a relative reference. Within a schema, the
OpenAPI Specification resolves it against the nearest parent
$id
exactly as it resolves $ref. The
jsonschema bundle
command rewrites such references accordingly.
Best Practice
Keep descriptions within plain CommonMark 0.27 so that they render everywhere. The OpenAPI Specification sets that version as the minimum that tooling must support when rendering rich text. Any syntax beyond it is implementation-defined and not interoperable.
Examples
{
"$schema": "https://spec.openapis.org/oas/3.1/dialect/base",
"type": "object",
"externalDocs": {
"description": "The *Pet* data model",
"url": "https://example.com/docs/pet.html"
}
}{ "kind": "cat" }"Misty"{
"$schema": "https://spec.openapis.org/oas/3.1/dialect/base",
"$id": "https://example.com/schemas/pet",
"externalDocs": { "url": "../docs/pet.html" },
"properties": {
"kind": {
"type": "string",
"externalDocs": {
"url": "../docs/kind.html",
"x-internal-id": 7
}
}
}
}{ "kind": "cat" }{ "kind": 7 }