schema-drift-cli 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Syed Maarif R.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,77 @@
1
+ Metadata-Version: 2.4
2
+ Name: schema-drift-cli
3
+ Version: 0.1.0
4
+ Summary: Detect schema drift in JSON APIs
5
+ License-File: LICENSE
6
+ Requires-Python: >=3.9
7
+ Requires-Dist: requests>=2.31.0
8
+ Requires-Dist: rich>=13.0.0
9
+ Requires-Dist: typer[all]
10
+ Provides-Extra: dev
11
+ Requires-Dist: pytest; extra == 'dev'
12
+ Requires-Dist: ruff; extra == 'dev'
13
+ Description-Content-Type: text/markdown
14
+
15
+ # Schema Drift Detector - CLI
16
+
17
+ Schema Drift Detector is a CLI that:
18
+ - Fetches a JSON payload from an HTTP API endpoint (GET for v1).
19
+ - Loads a “baseline” schema from a local file (JSON).
20
+ - Compares structure: added/removed/changed fields, type changes, optional vs required.
21
+ - Outputs the diff in three formats: JSON, Markdown, and a pretty terminal table.
22
+
23
+ ## Language & Stack
24
+
25
+ I used Python and Click for the CLI as they make argument parsing, subcommands, and help text clean and maintainable.
26
+
27
+ ## Output Examples
28
+
29
+ ### JSON:
30
+ Simple:
31
+ ```bash
32
+ print(json.dumps(diff, indent=2))
33
+ ```
34
+ Good for machines and CI logs.
35
+
36
+ ### Markdown:
37
+ ```text
38
+ ### Added fields
39
+
40
+ | Path | Type |
41
+ |-------------------|--------|
42
+ | `user.middle_name`| string |
43
+ ```
44
+
45
+ ### Pretty Terminal Table:
46
+ ```text
47
+ ADDED | user.middle_name | - | string
48
+ ```
49
+
50
+ ## Installation
51
+
52
+ Use the package manager [pip](https://pypi.org/project/reorder-editable/) to install reorder-editable.
53
+
54
+ ```bash
55
+ pip install -e .
56
+ ```
57
+
58
+ ## Usage
59
+
60
+ ```bash
61
+ python -m schema_drift_cli --help
62
+ ```
63
+
64
+ ### Commands
65
+
66
+ - `version` - Shows the CLI version
67
+
68
+ ## Contributing
69
+
70
+ Pull requests are welcome. For major changes, please open an issue first
71
+ to discuss what you would like to change.
72
+
73
+ Please make sure to update tests as appropriate.
74
+
75
+ ## License
76
+
77
+ [MIT](https://choosealicense.com/licenses/mit/)
@@ -0,0 +1,63 @@
1
+ # Schema Drift Detector - CLI
2
+
3
+ Schema Drift Detector is a CLI that:
4
+ - Fetches a JSON payload from an HTTP API endpoint (GET for v1).
5
+ - Loads a “baseline” schema from a local file (JSON).
6
+ - Compares structure: added/removed/changed fields, type changes, optional vs required.
7
+ - Outputs the diff in three formats: JSON, Markdown, and a pretty terminal table.
8
+
9
+ ## Language & Stack
10
+
11
+ I used Python and Click for the CLI as they make argument parsing, subcommands, and help text clean and maintainable.
12
+
13
+ ## Output Examples
14
+
15
+ ### JSON:
16
+ Simple:
17
+ ```bash
18
+ print(json.dumps(diff, indent=2))
19
+ ```
20
+ Good for machines and CI logs.
21
+
22
+ ### Markdown:
23
+ ```text
24
+ ### Added fields
25
+
26
+ | Path | Type |
27
+ |-------------------|--------|
28
+ | `user.middle_name`| string |
29
+ ```
30
+
31
+ ### Pretty Terminal Table:
32
+ ```text
33
+ ADDED | user.middle_name | - | string
34
+ ```
35
+
36
+ ## Installation
37
+
38
+ Use the package manager [pip](https://pypi.org/project/reorder-editable/) to install reorder-editable.
39
+
40
+ ```bash
41
+ pip install -e .
42
+ ```
43
+
44
+ ## Usage
45
+
46
+ ```bash
47
+ python -m schema_drift_cli --help
48
+ ```
49
+
50
+ ### Commands
51
+
52
+ - `version` - Shows the CLI version
53
+
54
+ ## Contributing
55
+
56
+ Pull requests are welcome. For major changes, please open an issue first
57
+ to discuss what you would like to change.
58
+
59
+ Please make sure to update tests as appropriate.
60
+
61
+ ## License
62
+
63
+ [MIT](https://choosealicense.com/licenses/mit/)
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "schema-drift",
3
+ "version": "0.1.0",
4
+ "description": "Detect schema drift and breaking changes in your JSON APIs. Initialize a basline schema, then continuously check for structural changes. Get clear reports on what's changed and where. Perfect for API monitoring, CI/CD validation, and catching unintended data structure changes before they break production.",
5
+ "main": "pyproject.toml",
6
+ "scripts": {
7
+ "test": "pytest"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/MrFrayman/Schema-Drift-Detector-CLI.git"
12
+ },
13
+ "keywords": [
14
+ "schema-drift",
15
+ "schema",
16
+ "validation",
17
+ "json",
18
+ "validation",
19
+ "api",
20
+ "monitoring",
21
+ "breaking",
22
+ "changes",
23
+ "api",
24
+ "diff",
25
+ "data",
26
+ "contract",
27
+ "change",
28
+ "detection"
29
+ ],
30
+ "author": "Syed Maarif R.",
31
+ "license": "MIT",
32
+ "bugs": {
33
+ "url": "https://github.com/MrFrayman/Schema-Drift-Detector-CLI/issues"
34
+ },
35
+ "homepage": "https://github.com/MrFrayman/Schema-Drift-Detector-CLI#readme"
36
+ }
@@ -0,0 +1,24 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "schema-drift-cli"
7
+ version = "0.1.0"
8
+ description = "Detect schema drift in JSON APIs"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ dependencies = [
12
+ "typer[all]",
13
+ "rich>=13.0.0",
14
+ "requests>=2.31.0",
15
+ ]
16
+
17
+ [project.scripts]
18
+ schema-drift = "schema_drift_cli:main"
19
+
20
+ [project.optional-dependencies]
21
+ dev = [
22
+ "pytest",
23
+ "ruff",
24
+ ]
@@ -0,0 +1,3 @@
1
+ from schema_drift_cli.cli import main
2
+
3
+ __all__ = ["main"]
@@ -0,0 +1,4 @@
1
+ from schema_drift_cli.cli import main
2
+
3
+ if __name__ == "__main__":
4
+ main()
@@ -0,0 +1,73 @@
1
+ import typer
2
+
3
+ # The typer application object
4
+ app = typer.Typer(help="Schema Drift Detector CLI")
5
+
6
+ @app.callback(invoke_without_command=True)
7
+ def on_startup(ctx: typer.Context) -> None:
8
+ """Schema Drift Detector CLI"""
9
+ if ctx.invoked_subcommand is None:
10
+ ascii_art = """
11
+ ███████╗ ██████╗██╗ ██╗███████╗███╗ ███╗ █████╗ ██████╗ ██████╗ ██╗███████╗████████╗
12
+ ██╔════╝██╔════╝██║ ██║██╔════╝████╗ ████║██╔══██╗ ██╔══██╗██╔══██╗██║██╔════╝╚══██╔══╝
13
+ ███████╗██║ ███████║█████╗ ██╔████╔██║███████║ ██║ ██║██████╔╝██║█████╗ ██║
14
+ ╚════██║██║ ██╔══██║██╔══╝ ██║╚██╔╝██║██╔══██║ ██║ ██║██╔══██╗██║██╔══╝ ██║
15
+ ███████║╚██████╗██║ ██║███████╗██║ ╚═╝ ██║██║ ██║ ██████╔╝██║ ██║██║██║ ██║
16
+ ╚══════╝ ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═╝
17
+
18
+ """
19
+ typer.echo(ascii_art)
20
+ typer.echo("Welcome to the Schema Drift Detector CLI!")
21
+ typer.echo("Use --help for more information")
22
+
23
+
24
+ @app.command()
25
+ def version() -> None:
26
+ """
27
+ Show the version of the schema-drift CLI
28
+ """
29
+ typer.echo("schema-drift version 0.1.0")
30
+
31
+ @app.command()
32
+ def init(
33
+ url: str = typer.Option(None, "--url", "-u", help="API URL to fetch baseline from"),
34
+ file: str = typer.Option(None, "--file","-f",help="Local JSON file to use as baseline"),
35
+ out: str = typer.Option("schema.json", "--out", "-o", help="Output schema file")
36
+ ) -> None:
37
+ """
38
+ Initialize a baseline schema from an API URL or a local JSON file.
39
+ """
40
+ typer.echo("Initializing baseline schema...")
41
+ typer.echo(f"Source: {url or file or 'none specified'}")
42
+ typer.echo(f"Output: {out}")
43
+ typer.echo("Done! (This is just a dummy version tho, real ones coming later)")
44
+
45
+ @app.command()
46
+ def check(
47
+ url: str = typer.Option(None, "--url", "-u", help="API URL to check"),
48
+ file: str = typer.Option(None, "--file","-f", help="Local JSON file to check"),
49
+ schema: str = typer.Option("schema.json", "--schema", "-s", help="Baseline schema file"),
50
+ output_format: str = typer.Option("table", "--output-format", "-of", help="Output format (json, markdown, table, all)"),
51
+ fail_on_drift: bool = typer.Option(False, "--fail-on-drift", "-fod", help="Exit 1 if drift detected")
52
+ ) -> None:
53
+ """
54
+ Check the current JSON against baseline schema.
55
+ """
56
+ typer.echo("Checking for schema drift...")
57
+ typer.echo(f"Live Data: {url or file or 'none'}")
58
+ typer.echo(f"Schema: {schema}")
59
+ typer.echo(f"Format: {output_format}")
60
+ typer.echo("No Drift Detected! (This is just a dummy version asw)")
61
+
62
+ if fail_on_drift:
63
+ typer.echo(" (fail-on-drift flag ignored for now)")
64
+
65
+ def main() -> None:
66
+ # # Entrypoint that runs the Typer app
67
+ app()
68
+
69
+
70
+ if __name__ == "__main__":
71
+ # When I run this file directly with `python schema_drift_cli/cli.py`
72
+ # Python sets __name__ to "__main__" and this block executes.
73
+ main()