json-schema-diff 0.1.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1aea7e4fe80d247f0391631e587a149d622839d7b78b99443e334eea7c422df1
4
+ data.tar.gz: 4a9aeceeb2c7d356306cb237c03f8710eb4bd8291d010f583e2d1bb433110046
5
+ SHA512:
6
+ metadata.gz: 86c942503b94f7ab01c896fabefa07e9def0701daabff6bf17725dbf9e148c49282293a95e52ebb06a9ee941905c767124134a38243533591bab35b1a59a06c0
7
+ data.tar.gz: 5ef4bbfcf3fc8957ec04800a8ea3ea3c3696553dec7f746050194ef6e241c8b55170cfbc87b0505c6238f0af4c5bccef205fe571b451d22cf9f27dcae0727e79
data/CHANGELOG.md ADDED
@@ -0,0 +1,33 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.0] - 2025-01-26
11
+
12
+ ### Added
13
+
14
+ - Initial release of json-schema-diff gem
15
+ - Schema-guided JSON diffing with metadata extraction from JSON Schema
16
+ - Support for JSON Schema properties: type, title, description, format, enum, readOnly
17
+ - Multiple output formats: pretty colorized output and machine-readable JSON
18
+ - Smart noisy field detection (timestamps, UUIDs, readOnly fields)
19
+ - Custom field filtering with --ignore-fields option for excluding specific paths
20
+ - Recursive comparison of nested objects and arrays with full path tracking
21
+ - Lightweight CLI using Ruby's built-in OptionParser (no external dependencies)
22
+ - Support for all standard JSON Schema formats (date-time, uuid, email, etc.)
23
+ - Comprehensive test suite with 100% core functionality coverage (13 tests, 58 assertions)
24
+ - Professional documentation including README, CONTRIBUTING, SECURITY, and examples
25
+ - Organized examples directory with tool-specific subdirectories and version-based naming
26
+ - Official schema support for security tools:
27
+ - Zizmor (GitHub Actions security auditor) - official v1 schema
28
+ - Capslock (Google's Go capability analysis) - official schema
29
+ - Generic security report template for other tools
30
+ - Real-world sample data demonstrating security finding detection and severity escalation
31
+ - CI/CD integration examples with structured JSON output for automation
32
+ - SchemaStore.org integration documentation for 600+ existing schemas
33
+ - Example outputs in README showing practical use cases and expected results
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,215 @@
1
+ # Contributing to json-schema-diff
2
+
3
+ Thank you for your interest in contributing to json-schema-diff! This document provides guidelines and information for contributors.
4
+
5
+ ## Code of Conduct
6
+
7
+ This project adheres to the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
8
+
9
+ ## How to Contribute
10
+
11
+ ### Reporting Bugs
12
+
13
+ Before creating bug reports, please check existing issues to avoid duplicates. When creating a bug report, include:
14
+
15
+ - **Clear title** describing the issue
16
+ - **Detailed description** of the problem
17
+ - **Steps to reproduce** the bug
18
+ - **Expected vs actual behavior**
19
+ - **Environment details** (Ruby version, OS, gem version)
20
+ - **Sample files** if relevant (JSON schema, test files)
21
+
22
+ ### Suggesting Features
23
+
24
+ Feature requests are welcome! Please:
25
+
26
+ - **Check existing issues** to avoid duplicates
27
+ - **Describe the use case** that motivates the feature
28
+ - **Provide examples** of how the feature would work
29
+ - **Consider implementation complexity** and maintenance burden
30
+
31
+ ### Pull Requests
32
+
33
+ 1. **Fork** the repository
34
+ 2. **Create a feature branch** (`git checkout -b feature/amazing-feature`)
35
+ 3. **Make your changes** following the coding standards
36
+ 4. **Add tests** for new functionality
37
+ 5. **Update documentation** if needed
38
+ 6. **Ensure all tests pass** (`rake test`)
39
+ 7. **Commit your changes** (`git commit -m 'Add amazing feature'`)
40
+ 8. **Push to your branch** (`git push origin feature/amazing-feature`)
41
+ 9. **Open a Pull Request**
42
+
43
+ ## Development Setup
44
+
45
+ ### Prerequisites
46
+
47
+ - Ruby 3.2.0 or higher
48
+ - Bundler
49
+
50
+ ### Getting Started
51
+
52
+ ```bash
53
+ # Clone your fork
54
+ git clone https://github.com/YOUR_USERNAME/json-schema-diff.git
55
+ cd json-schema-diff
56
+
57
+ # Install dependencies
58
+ bundle install
59
+
60
+ # Run tests
61
+ rake test
62
+
63
+ # Run linting (if available)
64
+ rake lint
65
+ ```
66
+
67
+ ### Running Tests
68
+
69
+ ```bash
70
+ # Run all tests
71
+ rake test
72
+
73
+ # Run specific test file
74
+ ruby test/json/schema/test_diff.rb
75
+
76
+ # Run specific test method
77
+ ruby test/json/schema/test_diff.rb -n test_comparer_detects_additions
78
+ ```
79
+
80
+ ## Coding Standards
81
+
82
+ ### Ruby Style
83
+
84
+ - Follow standard Ruby conventions
85
+ - Use 2 spaces for indentation
86
+ - Keep line length under 120 characters
87
+ - Use descriptive variable and method names
88
+ - Add comments for complex logic
89
+
90
+ ### Code Organization
91
+
92
+ - Keep classes focused and single-purpose
93
+ - Use modules for shared functionality
94
+ - Follow existing file structure and naming conventions
95
+ - Place new features in appropriate modules
96
+
97
+ ### Testing
98
+
99
+ - Write tests for all new functionality
100
+ - Use descriptive test method names
101
+ - Test both success and error cases
102
+ - Include edge cases and boundary conditions
103
+ - Use helper methods to reduce test duplication
104
+
105
+ Example test structure:
106
+ ```ruby
107
+ def test_descriptive_test_name
108
+ # Arrange
109
+ schema = create_test_schema
110
+
111
+ # Act
112
+ result = schema.parse_field("field.path")
113
+
114
+ # Assert
115
+ assert_equal expected_value, result
116
+ end
117
+ ```
118
+
119
+ ### Documentation
120
+
121
+ - Update README.md for new features
122
+ - Add inline documentation for public methods
123
+ - Include usage examples for new functionality
124
+ - Update CHANGELOG.md with notable changes
125
+
126
+ ## Architecture Overview
127
+
128
+ ### Core Components
129
+
130
+ - **SchemaParser**: Parses JSON Schema files and extracts field metadata
131
+ - **Comparer**: Performs recursive comparison of JSON objects using schema guidance
132
+ - **Formatter**: Formats diff results for human-readable or machine-readable output
133
+ - **CLI**: Command-line interface using Thor
134
+
135
+ ### Key Design Principles
136
+
137
+ - **Schema-driven**: Use JSON Schema metadata to enhance diff output
138
+ - **Configurable**: Support various output formats and filtering options
139
+ - **Extensible**: Easy to add new output formats or schema features
140
+ - **Defensive**: Handle malformed inputs gracefully with clear error messages
141
+
142
+ ## Testing Guidelines
143
+
144
+ ### Test Categories
145
+
146
+ 1. **Unit tests**: Test individual components in isolation
147
+ 2. **Integration tests**: Test component interactions
148
+ 3. **CLI tests**: Test command-line interface functionality
149
+ 4. **Example tests**: Validate example files work correctly
150
+
151
+ ### Test Data
152
+
153
+ - Use temporary files for test schemas and JSON files
154
+ - Include realistic examples that reflect real-world usage
155
+ - Test edge cases like empty objects, deeply nested structures
156
+ - Validate error handling with invalid inputs
157
+
158
+ ### Performance Considerations
159
+
160
+ - Test with reasonably large JSON files
161
+ - Ensure tests complete in reasonable time
162
+ - Avoid tests that consume excessive memory
163
+
164
+ ## Release Process
165
+
166
+ ### Version Numbers
167
+
168
+ We follow [Semantic Versioning](https://semver.org/):
169
+
170
+ - **MAJOR**: Incompatible API changes
171
+ - **MINOR**: New functionality (backward compatible)
172
+ - **PATCH**: Bug fixes (backward compatible)
173
+
174
+ ### Release Checklist
175
+
176
+ 1. Update version in `lib/json/schema/diff/version.rb`
177
+ 2. Update CHANGELOG.md with release notes
178
+ 3. Ensure all tests pass
179
+ 4. Tag the release (`git tag v1.2.3`)
180
+ 5. Push tags (`git push --tags`)
181
+ 6. Build and publish gem (`gem build && gem push`)
182
+
183
+ ## Documentation
184
+
185
+ ### README Updates
186
+
187
+ When adding features, update the README with:
188
+
189
+ - Installation instructions (if changed)
190
+ - Usage examples for new features
191
+ - Command-line options
192
+ - Configuration details
193
+
194
+ ### Code Documentation
195
+
196
+ - Document public methods with YARD comments
197
+ - Include parameter types and return values
198
+ - Provide usage examples for complex methods
199
+ - Document error conditions and exceptions
200
+
201
+ ## Getting Help
202
+
203
+ - **GitHub Issues**: For bugs and feature requests
204
+ - **Discussions**: For questions and general discussion
205
+ - **Email**: andrew@ecosyste.ms for security issues
206
+
207
+ ## Recognition
208
+
209
+ Contributors will be recognized in:
210
+
211
+ - Release notes
212
+ - Contributors section (if we add one)
213
+ - Special thanks for significant contributions
214
+
215
+ Thank you for contributing to json-schema-diff!