summaryrefslogtreecommitdiff
path: root/venv/lib/python3.11/site-packages/litestar/openapi/spec/example.py
blob: 414452eda43bab3013e3b3caa40e07ce27574bd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from __future__ import annotations

from dataclasses import dataclass
from typing import Any

from litestar.openapi.spec.base import BaseSchemaObject


@dataclass
class Example(BaseSchemaObject):
    summary: str | None = None
    """Short description for the example."""

    description: str | None = None
    """Long description for the example.

    `CommonMark syntax <https://spec.commonmark.org/>`_ MAY be used for rich text representation.
    """

    value: Any | None = None
    """Embedded literal example.

    The ``value`` field and ``externalValue`` field are mutually exclusive. To represent examples of media types that
    cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary.
    """

    external_value: str | None = None
    """A URL that points to the literal example. This provides the capability to reference examples that cannot easily
    be included in JSON or YAML documents.

    The ``value`` field and ``externalValue`` field are mutually exclusive. See the rules for resolving
    `Relative References <https://spec.openapis.org/oas/v3.1.0#relativeReferencesURI>`_.
    """