Skip to content

Y25-318 Publish sanger-jsonapi-resources gem from master #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

seenanair
Copy link

Closes sanger/General-Backlog-Items#569

All Submissions:

This pull request creates a gem of version (0.2.0) from sanger-jsonapi-resources master branch (https://github.com/sanger/jsonapi-resources) ensuring compatibility with Rails version 7 and 8 and Ruby versions (3.3 and 3.2).
This pull request includes several updates to improve compatibility with newer Rails versions, simplify the codebase, and enhance testing and database configurations. The most notable changes involve introducing a compatibility helper for deprecation warnings, updating database configurations, and refining test setups. Below is a categorized summary of the most important changes:

Compatibility Enhancements:

  • Added JSONAPI::CompatibilityHelper module to provide a version-safe method for issuing deprecation warnings across Rails versions. Updated all deprecation warnings in lib/jsonapi files to use this helper instead of ActiveSupport::Deprecation.warn.

Database Configuration Updates:

  • Updated test/fixtures/active_record.rb to replace length with limit for string columns and added explicit foreign_key definitions for references to improve database schema compatibility.
  • Split t.references calls into separate lines for clarity and added explicit indexing for composite keys.

CI Workflow Updates:

  • Simplified .github/workflows/ruby.yml and updating Ruby and Rails version matrices to focus on newer versions.

Test Setup Refinements:

  • Adjusted test/test_helper.rb to silence deprecation warnings conditionally based on Rails version and updated fixture paths for compatibility.

Codebase Simplifications:

  • Added require 'rails/generators' to lib/generators/jsonapi/controller_generator.rb and lib/generators/jsonapi/resource_generator.rb for better clarity and dependency management.
  • Added a conditional check to skip processing in find_related_polymorphic_fragments if relation_position is nil.

@seenanair seenanair changed the title Y25-318 Publish gem as sanger-jsonapi-resources from master Y25-318 Publish sanger-jsonapi-resources gem from master Jun 18, 2025
@seenanair seenanair marked this pull request as draft June 18, 2025 10:50
@seenanair seenanair marked this pull request as ready for review June 18, 2025 12:33
Copy link

@stevieing stevieing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand most of it so as long as it works I'm good.

1 issue to resolve with ruby versions.

- '3.0'
- 3.1
- 3.2
- '3.3'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Traction Service is on ruby 3.4.4 so maybe worth adding ruby 3.4?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot! Done 👍

@seenanair
Copy link
Author

I don't understand most of it so as long as it works I'm good.

1 issue to resolve with ruby versions.
Thanks for the review. Most of the changes are just to make things work with the current Rails and Ruby versions—updating the schema (ActiveRecord), tweaking the test_helper, and changing method which is no longer supported in Rails 8 (ActiveSupport::Deprecation.warn)

@seenanair seenanair requested a review from stevieing June 18, 2025 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Y25-318 - As PSD we need to stabilise the JSON API resources repository and release it as a gem to be used by Sequencescape and Traction Service
2 participants