Skip to content

Commit 8895880

Browse files
authored
remove /diff/data and /diff/schema endpoints (#4865)
* remove /diff/data and /diff/schema endpoints * remove unit tests for deleted endpoints * add changelog
1 parent 1c5caf1 commit 8895880

File tree

3 files changed

+1
-105
lines changed

3 files changed

+1
-105
lines changed

backend/infrahub/api/diff/diff.py

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from infrahub.core.diff.branch_differ import BranchDiffer
1414
from infrahub.core.diff.model.diff import (
1515
ArtifactTarget,
16-
BranchDiff,
1716
BranchDiffArtifact,
1817
BranchDiffArtifactStorage,
1918
BranchDiffFile,
@@ -24,64 +23,15 @@
2423
DiffPayloadBuilder,
2524
get_display_labels_per_kind,
2625
)
27-
from infrahub.core.schema.constants import INTERNAL_SCHEMA_NODE_KINDS
2826
from infrahub.database import InfrahubDatabase # noqa: TCH001
2927

30-
from .validation_models import DiffQueryValidated
31-
3228
if TYPE_CHECKING:
3329
from infrahub.services import InfrahubServices
3430

3531

3632
router = APIRouter(prefix="/diff")
3733

3834

39-
@router.get("/data")
40-
async def get_diff_data(
41-
db: InfrahubDatabase = Depends(get_db),
42-
branch: Branch = Depends(get_branch_dep),
43-
time_from: Optional[str] = None,
44-
time_to: Optional[str] = None,
45-
branch_only: bool = True,
46-
_: str = Depends(get_current_user),
47-
) -> BranchDiff:
48-
query = DiffQueryValidated(branch=branch, time_from=time_from, time_to=time_to, branch_only=branch_only)
49-
50-
diff = await BranchDiffer.init(
51-
db=db,
52-
branch=branch,
53-
diff_from=query.time_from,
54-
diff_to=query.time_to,
55-
branch_only=query.branch_only,
56-
namespaces_exclude=["Schema"],
57-
)
58-
schema = registry.schema.get_full(branch=branch)
59-
diff_payload_builder = DiffPayloadBuilder(db=db, diff=diff, kinds_to_include=list(schema.keys()))
60-
return await diff_payload_builder.get_branch_diff()
61-
62-
63-
@router.get("/schema")
64-
async def get_diff_schema(
65-
db: InfrahubDatabase = Depends(get_db),
66-
branch: Branch = Depends(get_branch_dep),
67-
time_from: Optional[str] = None,
68-
time_to: Optional[str] = None,
69-
branch_only: bool = True,
70-
_: str = Depends(get_current_user),
71-
) -> BranchDiff:
72-
query = DiffQueryValidated(branch=branch, time_from=time_from, time_to=time_to, branch_only=branch_only)
73-
diff = await BranchDiffer.init(
74-
db=db,
75-
branch=branch,
76-
diff_from=query.time_from,
77-
diff_to=query.time_to,
78-
branch_only=query.branch_only,
79-
kinds_include=INTERNAL_SCHEMA_NODE_KINDS,
80-
)
81-
diff_payload_builder = DiffPayloadBuilder(db=db, diff=diff, kinds_to_include=INTERNAL_SCHEMA_NODE_KINDS)
82-
return await diff_payload_builder.get_branch_diff()
83-
84-
8535
@router.get("/files")
8636
async def get_diff_files(
8737
request: Request,

backend/tests/unit/api/diff/test_diff_data_query.py

Lines changed: 0 additions & 55 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove the /api/diff/data and /api/diff/schema endpoints that have been replaced by the DiffTree graphql query

0 commit comments

Comments
 (0)