Skip to content

Conversation

jhollinger
Copy link
Contributor

@jhollinger jhollinger commented Mar 13, 2025

Changes:

  • V2 blueprints inherit views from parents (like Legacy/V1)
  • view option to skip inheriting fields from the parent
  • Freeze a blueprint/view's extensions, options and fields after it's first eval'd
  • Disallow defining a :default view
  • If a view is redefined, append to the existing definition instead of replacing it (like Legacy/V1)

Legacy/V1's "identifier" view can be emulated like this:

class ApplicationBlueprint < Blueprinter::V2::Base
  field :id

  # this view will not inherit any fields
  view :identifier, empty: true do
    field :id
  end
end

@jhollinger jhollinger added the enhancement New feature or request label Mar 13, 2025
@jhollinger jhollinger requested review from ritikesh and a team as code owners March 13, 2025 17:58
@jhollinger jhollinger force-pushed the jh/2.0-inherit-views branch from 9dbfa69 to f01f713 Compare March 14, 2025 18:52
@jhollinger jhollinger force-pushed the jh/2.0-inherit-views branch from dd86213 to fb230a0 Compare April 1, 2025 15:31
@jhollinger jhollinger requested a review from lessthanjacob April 1, 2025 16:53
@jhollinger jhollinger force-pushed the jh/2.0-inherit-views branch 6 times, most recently from 080e83d to 02009df Compare April 5, 2025 15:46
@siba2893
Copy link

siba2893 commented Apr 9, 2025

This looks amazing! Waiting for this to get merged

@jhollinger jhollinger force-pushed the jh/2.0-inherit-views branch from 02009df to a16d278 Compare April 29, 2025 19:21
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@jhollinger
Copy link
Contributor Author

Take another at the fields options (maybe inherit_fields). Use existing setters to clear options & extensions.

@jhollinger jhollinger force-pushed the jh/2.0-inherit-views branch from 14a18bb to 4d368ae Compare July 9, 2025 16:19
@jhollinger jhollinger force-pushed the jh/2.0-inherit-views branch from 4d368ae to 252443c Compare July 9, 2025 16:43
@jhollinger
Copy link
Contributor Author

@lessthanjacob I've tentatively settled on an empty: true option to skip inheriting fields.

Copy link

github-actions bot commented Sep 8, 2025

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request no-pr-activity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants