Skip to content

Comments

support resource that is not a list#27

Merged
TSMMark merged 3 commits intomasterfrom
support-resource-that-is-not-a-list
Aug 26, 2025
Merged

support resource that is not a list#27
TSMMark merged 3 commits intomasterfrom
support-resource-that-is-not-a-list

Conversation

@TSMMark
Copy link
Collaborator

@TSMMark TSMMark commented Aug 26, 2025

Sometimes a resource is just a hash with properties, and not a list. This PR supports this.

Example:

attribute(:branding_input, type: :hash, input_field: "InputObjects::SmartPageBrandingInput", required: true, skip: true)

def validate
  with_resource(:branding_input) do
    validate_format(:primary_color, /\A#(?:[0-9a-fA-F]{3}){1,2}\z/)
    validate_format(:background_overlay, /\Argba\((\s*(1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])\s*,){3}\s*(0|0?\.\d+|1)\s*\)\z/)
  end
end

Copy link

@MVV90 MVV90 left a comment

Choose a reason for hiding this comment

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

Cools

@TSMMark TSMMark merged commit 2db5e17 into master Aug 26, 2025
2 checks passed
@TSMMark TSMMark deleted the support-resource-that-is-not-a-list branch August 26, 2025 21:14
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.

3 participants