Coverage for src/common/models/openapi_path.py: 100%
14 statements
« prev ^ index » next coverage.py v7.6.10, created at 2025-03-24 21:51 -0400
« prev ^ index » next coverage.py v7.6.10, created at 2025-03-24 21:51 -0400
1"""OpenAPI Path object, as defined in the OpenAPI spec. This object stores
2the OpenAPI endpoint"""
4import uuid
5from typing import List
7from sqlalchemy import Column, ForeignKey, String
8from sqlalchemy.dialects.postgresql import UUID
9from sqlalchemy.orm import Mapped, relationship
11from common.models.openapi_operation import OpenAPIOperation
13from .base import Base
16class OpenAPIPath(Base): # pylint: disable=too-few-public-methods
17 """OpenAPI Server object, as defined in the OpenAPI spec."""
19 __tablename__ = "openapi_path"
21 openapi_path_id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
22 openapi_spec_id = Column(
23 UUID(as_uuid=True), ForeignKey("openapi_spec.openapi_spec_id"), nullable=False
24 )
25 path_templated = Column(String, nullable=False)
26 operations: Mapped[List[OpenAPIOperation]] = relationship(back_populates="path")
28 spec: Mapped["OpenAPISpec"] = relationship(back_populates="paths") # type: ignore