jpie 0.3.1 → 0.4.1
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 +4 -4
- data/{.aiconfig → .cursorrules} +14 -2
- data/CHANGELOG.md +51 -0
- data/README.md +179 -844
- data/examples/basic_example.md +146 -0
- data/examples/including_related_resources.md +491 -0
- data/examples/resource_attribute_configuration.md +147 -0
- data/examples/resource_meta_configuration.md +244 -0
- data/examples/single_table_inheritance.md +160 -0
- data/lib/jpie/controller/crud_actions.rb +10 -0
- data/lib/jpie/controller/error_handling.rb +168 -17
- data/lib/jpie/controller/json_api_validation.rb +171 -0
- data/lib/jpie/controller.rb +2 -0
- data/lib/jpie/errors.rb +41 -0
- data/lib/jpie/generators/resource_generator.rb +86 -9
- data/lib/jpie/generators/templates/resource.rb.erb +20 -1
- data/lib/jpie/resource/attributable.rb +21 -2
- data/lib/jpie/resource.rb +26 -0
- data/lib/jpie/version.rb +1 -1
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b3ade425c9173f2c516edbab70ee2991201648fb15d2e461b58667fda6a46a8
|
4
|
+
data.tar.gz: 7783e2e57be4b1a2f7e50fec35240413d873af2e1ab98ba8ed7f8305af272c9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 582998bde4d3fc2b44c280a8a4e87e45477bd66f808790c07a90f7110ca405b7e4695f4c306280fdd8a85b4bf36d4f1413b55a542c40d96a340d828ff2aaf2b2
|
7
|
+
data.tar.gz: 63d5d8f010159cb9aff0bcc99a5c8f5739c5d879b62611e980eb0c3ca0312ef02f31d550bfb14b5cbee0d0978c236fe28beb0df79a1006178c429c04d1457aa6
|
data/{.aiconfig → .cursorrules}
RENAMED
@@ -22,7 +22,7 @@
|
|
22
22
|
# Git commit guidelines
|
23
23
|
- Write clear, descriptive commit messages
|
24
24
|
- Keep commits focused and atomic
|
25
|
-
- Run tests before committing
|
25
|
+
- Run and pass tests before committing
|
26
26
|
- Update documentation in the same commit as code changes
|
27
27
|
- Ignore spec/examples.txt and other files listed in .gitignore
|
28
28
|
- Include Ruby/Rails version requirements in relevant commits
|
@@ -62,4 +62,16 @@
|
|
62
62
|
# When implementing new features or refactoring
|
63
63
|
- Always read the .aiconfig file
|
64
64
|
- Always implement code slowly and methodically
|
65
|
-
- Always test as you go
|
65
|
+
- Always test as you go
|
66
|
+
- Always make sure rubocop passes
|
67
|
+
|
68
|
+
# Examples
|
69
|
+
- The examples must _only_ include _required_ code
|
70
|
+
- The examples must not include any unrelated or supurflous code
|
71
|
+
- Examples must be a single markdown file
|
72
|
+
- Examples must use the `http` code blocks for its exampels
|
73
|
+
- Examples must only include the minium number of examples
|
74
|
+
- Examples must never include migrations.
|
75
|
+
- Examples must not include a features section or similar
|
76
|
+
- Examples must include an introduction to the example
|
77
|
+
- Examples live in /examples/*.md
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,57 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [0.4.1] - 2025-01-25
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
- **Test Suite Stability**: Fixed require statements in spec files that were incorrectly requiring `rails_helper` instead of `spec_helper`
|
14
|
+
- Fixed `spec/jpie/automatic_crud_spec.rb`
|
15
|
+
- Fixed `spec/jpie/polymorphic_crud_spec.rb`
|
16
|
+
- Fixed `spec/jpie/through_associations_crud_spec.rb`
|
17
|
+
- **Code Quality**: Addressed RuboCop warnings and improved code style compliance
|
18
|
+
- **Error Handling**: Improved error message consistency for unsupported sort fields and include parameters
|
19
|
+
|
20
|
+
### Enhanced
|
21
|
+
- **Test Coverage**: Maintained high test coverage (93.39%) with improved test reliability
|
22
|
+
- **Documentation**: Updated gem publishing workflow and development guidelines
|
23
|
+
|
24
|
+
### Technical Details
|
25
|
+
- All spec files now correctly use `spec_helper` for consistent test environment setup
|
26
|
+
- Improved gem build process with proper dependency management
|
27
|
+
- Enhanced RuboCop configuration for better code quality enforcement
|
28
|
+
|
29
|
+
## [0.4.0] - 2025-01-25
|
30
|
+
|
31
|
+
### Added
|
32
|
+
- **Semantic Generator Syntax**: Complete rewrite of resource generator with JSON:API-focused field categorization
|
33
|
+
- `attribute:field` - Explicit JSON:API attribute definition
|
34
|
+
- `meta:field` - Explicit JSON:API meta attribute definition
|
35
|
+
- `has_many:resource` - Shorthand relationship syntax
|
36
|
+
- `relationship:type:field` - Explicit relationship syntax
|
37
|
+
- **Improved Developer Experience**: More intuitive and semantic generator approach focused on JSON:API concepts rather than database types
|
38
|
+
|
39
|
+
### Enhanced
|
40
|
+
- **Generator Logic**: Refactored generator into cleaner, more maintainable methods with proper separation of concerns
|
41
|
+
- **Backward Compatibility**: Legacy `field:type` syntax fully preserved - existing usage continues to work unchanged
|
42
|
+
- **Code Quality**: Fixed all RuboCop violations in generator code with improved method structure
|
43
|
+
- **Test Coverage**: Comprehensive test suite covering semantic syntax, legacy compatibility, and all feature combinations
|
44
|
+
|
45
|
+
### Improved
|
46
|
+
- **Generator Syntax**: Replaced meaningless database types (`name:string`) with semantic JSON:API categorization (`attribute:name`)
|
47
|
+
- **Documentation**: README completely updated to showcase new semantic approach with comprehensive examples
|
48
|
+
- **Generator Help**: Updated help text and banners to reflect new semantic syntax
|
49
|
+
|
50
|
+
### Technical Details
|
51
|
+
- Generator automatically categorizes fields based on semantic prefixes
|
52
|
+
- Auto-detection of common meta attributes (`created_at`, `updated_at`, etc.) preserved
|
53
|
+
- Relationship inference and resource class detection maintained
|
54
|
+
- All 373 tests pass with 95.97% coverage maintained
|
55
|
+
|
56
|
+
### Migration Guide
|
57
|
+
- **New syntax (recommended)**: `rails generate jpie:resource User attribute:name meta:created_at has_many:posts`
|
58
|
+
- **Legacy syntax (still works)**: `rails generate jpie:resource User name:string created_at:datetime --relationships=has_many:posts`
|
59
|
+
- No breaking changes - existing generators continue to work as before
|
60
|
+
|
10
61
|
## [0.3.1] - 2025-01-24
|
11
62
|
|
12
63
|
### Fixed
|