Csv template admin set context#1119
Merged
ShanaLMoore merged 2 commits intobulkrax-v2-importerfrom Feb 20, 2026
Merged
Conversation
- Pass admin_set_id to CSV template generation and validation so the downloaded template and validation use the admin set's metadata context (HYRAX_FLEXIBLE) - Use Hyrax.schema_for(klass:, admin_set_id:) so context-gated properties (e.g. dimensions for ImageResource in special_context) appear in the template and in validation - Update download template link via JS to include selected admin set - ValkyrieObjectFactory and SchemaAnalyzer use keyword args for schema_for Co-authored-by: Cursor <cursoragent@cursor.com>
90bd87e to
488144a
Compare
There was a problem hiding this comment.
Pull request overview
This PR enables context-aware CSV template generation and validation in Bulkrax when HYRAX_FLEXIBLE is enabled. When a user selects an admin set with a metadata context (e.g., from the M3 profile), the CSV template download and validation now include context-gated properties like dimensions for ImageResource.
Changes:
- Pass
admin_set_idparameter from the UI through the controller to the CsvValidationService for both template generation and validation - Update the v2 importer UI to dynamically append the selected admin set ID to the CSV template download URL
- Add test coverage to verify admin_set_id is passed correctly to the service
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| app/controllers/bulkrax/importers_controller.rb | Extracts admin_set_id from request parameters and passes it to CsvValidationService.generate_template |
| app/views/bulkrax/importers/new_v2.html.erb | Adds id and data attribute to the download template link for JavaScript manipulation |
| app/assets/javascripts/bulkrax/importers_stepper.js | Implements updateDownloadTemplateLink function to dynamically append admin_set_id to download URL |
| spec/controllers/bulkrax/importers_controller_spec.rb | Adds test to verify admin_set_id parameter is passed to the service |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- In sample_csv_file spec, expect generate_template to be called with admin_set_id: nil when param is omitted - Restore "a" in download link text: "Download a CSV template for your tenant"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When HYRAX_FLEXIBLE is enabled and the user selects an admin set that has a metadata context (e.g. from the M3 profile), the CSV template download and validation now use that context. Context-gated properties (e.g.
dimensionsfor ImageResource inspecial_context) are included in the template columns and in validation instead of being omitted.Implementation: pass
admin_set_idinto CSV template generation and validation; callHyrax.schema_for(klass:, admin_set_id:)so the schema reflects the admin set’s context; update the "Download CSV template" link in the v2 importer UI so the selected admin set is in the URL.Ticket Number
Screenshots / Video
when an admin set using a context is selected, dimensions should be included in the template:
bulkrax_template_20260220_162644.csv
When an admin set is chosen, but it does not have a context - dimensions will not be included in the template:
bulkrax_template_20260220_162559.csv
Expected Behavior
special_contextin the M3 profile), the downloaded CSV template includes columns for properties that areavailable_onthat context (e.g.dimensionsfor ImageResource).Sample Files
available_on.context(e.g.dimensionsfor ImageResource inspecial_context).Notes
Hyrax.schema_for(klass:, admin_set_id:)and the admin set resource exposingcontextswhen flexible metadata is enabled.