Skip to content

Commit 738a14b

Browse files
committed
chore: add Cargo.toml and README
1 parent d51b3fe commit 738a14b

File tree

2 files changed

+144
-0
lines changed

2 files changed

+144
-0
lines changed

Cargo.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[package]
2+
name = "rusty-schema-diff"
3+
description = "A powerful schema evolution analyzer supporting JSON Schema, OpenAPI, Protobuf, and SQL DDL"
4+
license-file = "LICENSE.md"
5+
documentation = "https://rusty-libraries.github.io/rusty-schema-diff/"
6+
readme = "README.md"
7+
homepage = "https://github.com/rusty-libraries/rusty-schema-diff"
8+
keywords = ["schema", "diff", "openapi", "protobuf", "sql"]
9+
categories = ["development-tools", "web-programming"]
10+
exclude = ["docs/", "rustfmt.toml"]
11+
version = "0.1.0"
12+
edition = "2021"
13+
14+
[dependencies]
15+
serde = { version = "1", features = ["derive"] }
16+
serde_json = "1"
17+
thiserror = "2.0.6"
18+
semver = { version = "1.0", features = ["serde"] }
19+
openapiv3 = "2.0.0"
20+
sqlparser = "0.52.0"
21+
protobuf = "3.2"
22+
serde_yaml = "0.9"
23+
24+
[dev-dependencies]
25+
tokio = { version = "1", features = ["full"] }

README.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Rusty Schema Diff
2+
3+
![Crates.io](https://img.shields.io/crates/v/rusty-schema-diff) ![docs.rs](https://img.shields.io/docsrs/rusty-schema-diff) ![License](https://img.shields.io/crates/l/rusty-schema-diff)
4+
5+
Welcome to Rusty Schema Diff, a powerful schema evolution analyzer that supports multiple schema formats including JSON Schema, OpenAPI, Protobuf, and SQL DDL. This library helps you analyze and manage schema changes across different versions, detect breaking changes, and generate migration paths.
6+
7+
## Table of Contents
8+
9+
- [Rusty Schema Diff](#rusty-schema-diff)
10+
- [Table of Contents](#table-of-contents)
11+
- [Features](#features)
12+
- [Installation](#installation)
13+
- [Getting Started](#getting-started)
14+
- [Basic Usage](#basic-usage)
15+
- [Analyzing JSON Schema Changes](#analyzing-json-schema-changes)
16+
- [Analyzing OpenAPI Changes](#analyzing-openapi-changes)
17+
- [Analyzing SQL DDL Changes](#analyzing-sql-ddl-changes)
18+
- [Documentation](#documentation)
19+
- [License](#license)
20+
21+
## Features
22+
23+
- Multi-format support (JSON Schema, OpenAPI, Protobuf, SQL DDL)
24+
- Breaking change detection
25+
- Compatibility scoring
26+
- Migration path generation
27+
- Detailed change analysis
28+
- Validation and error reporting
29+
30+
## Installation
31+
32+
Add this to your `Cargo.toml`:
33+
34+
```toml
35+
[dependencies]
36+
rusty-schema-diff = "0.1.0"
37+
```
38+
39+
## Getting Started
40+
41+
### Basic Usage
42+
43+
```rust
44+
use rusty_schema_diff::{Schema, SchemaFormat, JsonSchemaAnalyzer, SchemaAnalyzer};
45+
use semver::Version;
46+
47+
// Create schema instances
48+
let old_schema = Schema::new(
49+
SchemaFormat::JsonSchema,
50+
r#"{"type": "object", "properties": {"name": {"type": "string"}}}"#.to_string(),
51+
Version::parse("1.0.0").unwrap()
52+
);
53+
54+
let new_schema = Schema::new(
55+
SchemaFormat::JsonSchema,
56+
r#"{"type": "object", "properties": {"name": {"type": "string"}, "age": {"type": "integer"}}}"#.to_string(),
57+
Version::parse("1.1.0").unwrap()
58+
);
59+
60+
// Analyze compatibility
61+
let analyzer = JsonSchemaAnalyzer;
62+
let report = analyzer.analyze_compatibility(&old_schema, &new_schema).unwrap();
63+
64+
println!("Compatible: {}", report.is_compatible);
65+
println!("Score: {}", report.compatibility_score);
66+
```
67+
68+
### Analyzing JSON Schema Changes
69+
70+
```rust
71+
use rusty_schema_diff::prelude::*;
72+
73+
let analyzer = JsonSchemaAnalyzer;
74+
let report = analyzer.analyze_compatibility(&old_schema, &new_schema).unwrap();
75+
76+
// Generate migration plan
77+
let plan = analyzer.generate_migration_path(&old_schema, &new_schema).unwrap();
78+
79+
for step in plan.steps {
80+
println!("Migration step: {}", step);
81+
}
82+
```
83+
84+
### Analyzing OpenAPI Changes
85+
86+
```rust
87+
use rusty_schema_diff::prelude::*;
88+
89+
let analyzer = OpenApiAnalyzer;
90+
let report = analyzer.analyze_compatibility(&old_api, &new_api).unwrap();
91+
92+
println!("Breaking changes:");
93+
for change in report.changes.iter().filter(|c| c.is_breaking) {
94+
println!("- {}: {}", change.location, change.description);
95+
}
96+
```
97+
98+
### Analyzing SQL DDL Changes
99+
100+
```rust
101+
use rusty_schema_diff::prelude::*;
102+
103+
let analyzer = SqlAnalyzer;
104+
let report = analyzer.analyze_compatibility(&old_ddl, &new_ddl).unwrap();
105+
106+
// Generate SQL migration statements
107+
let plan = analyzer.generate_migration_path(&old_ddl, &new_ddl).unwrap();
108+
for statement in plan.steps {
109+
println!("SQL: {}", statement);
110+
}
111+
```
112+
113+
## Documentation
114+
115+
For detailed information on all available analyzers and their functionality, please refer to the [API Documentation](https://docs.rs/rusty-schema-diff).
116+
117+
## License
118+
119+
This library is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for details.

0 commit comments

Comments
 (0)