2020-01-21 02:38:04 -07:00
|
|
|
"""Configuration for API docs feature."""
|
2020-01-20 10:19:27 -07:00
|
|
|
# Third Party Imports
|
|
|
|
from pydantic import StrictBool
|
2020-01-21 02:38:04 -07:00
|
|
|
from pydantic import StrictStr
|
2020-01-20 10:19:27 -07:00
|
|
|
from pydantic import constr
|
|
|
|
|
|
|
|
# Project Imports
|
|
|
|
from hyperglass.configuration.models._utils import AnyUri
|
|
|
|
from hyperglass.configuration.models._utils import HyperglassModel
|
|
|
|
|
|
|
|
|
2020-02-01 12:50:12 -10:00
|
|
|
class EndpointConfig(HyperglassModel):
|
|
|
|
"""Validation model for per API endpoint documentation."""
|
|
|
|
|
|
|
|
title: StrictStr
|
|
|
|
description: StrictStr
|
|
|
|
summary: StrictStr
|
|
|
|
|
|
|
|
|
2020-01-20 10:19:27 -07:00
|
|
|
class Docs(HyperglassModel):
|
2020-01-28 08:59:27 -07:00
|
|
|
"""Validation model for params.docs."""
|
2020-01-20 10:19:27 -07:00
|
|
|
|
|
|
|
enable: StrictBool = True
|
|
|
|
mode: constr(regex=r"(swagger|redoc)") = "swagger"
|
|
|
|
uri: AnyUri = "/docs"
|
2020-01-21 17:32:31 -07:00
|
|
|
openapi_url: AnyUri = "/openapi.json"
|
2020-02-01 12:50:12 -10:00
|
|
|
query: EndpointConfig = {
|
|
|
|
"title": "Submit Query",
|
|
|
|
"description": "Request a query response per-location.",
|
|
|
|
"summary": "Query the Looking Glass",
|
|
|
|
}
|
|
|
|
devices: EndpointConfig = EndpointConfig(
|
|
|
|
title="Devices",
|
|
|
|
description="List of all devices/locations with associated identifiers, display names, networks, & VRFs.",
|
|
|
|
summary="Devices List",
|
|
|
|
)
|
|
|
|
queries: EndpointConfig = EndpointConfig(
|
|
|
|
title="Supported Queries",
|
|
|
|
description="List of supported query types.",
|
|
|
|
summary="Query Types",
|
|
|
|
)
|