Class: PropelFacets::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/propel_facets/templates/config/propel_facets.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Future features - not yet implemented attr_accessor :auto_include_concerns,

:cache_facets,
:naming_convention,
:include_metadata,
:date_format,
:null_handling,
:nested_depth_limit,
:default_excluded_fields,
:include_type_information,
:pagination_format,
:error_format,
:performance_logging


54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/generators/propel_facets/templates/config/propel_facets.rb', line 54

def initialize
  # Default facets to create on ApplicationRecord
  @default_facets = %w[reference included short details]
  
  # Strict mode - raise errors for missing facets instead of warnings
  @strict_mode = false
  
  # Default base facet for inheritance
  @default_base_facet = :reference
  
  # JSON root structure options: :model, :class, :data, :none
  # :model - { "user": {...} }, :class - { "User": {...} }
  # :data - { "data": {...} }, :none - {...} (flat structure)
  @root = :data
  
  # API format standard: :openapi, :rest, :jsonapi, :graphql, :hal, :collection_json, :siren
  @api_format = :rest
  
  # Future configuration options (commented out until implemented):
  
  # # Field naming convention: :snake_case, :camelCase, :PascalCase, :kebab_case
  # @naming_convention = :snake_case
  # 
  # # Include metadata (pagination, counts, etc.) in responses
  # @include_metadata = true
  # 
  # # Date/time format: :iso8601, :unix, :rfc3339, or custom strftime format
  # @date_format = :iso8601
  # 
  # # Null value handling: :include, :exclude, :empty_string
  # @null_handling = :include
  # 
  # # Maximum nesting depth to prevent infinite recursion
  # @nested_depth_limit = 5
  # 
  # # Fields to exclude by default from all facets (security sensitive)
  # @default_excluded_fields = %w[password_digest encrypted_password reset_password_token confirmation_token]
  # 
  # # Include model type information in JSON output
  # @include_type_information = false
  # 
  # # Pagination format: :cursor, :offset, :page, :limit_offset
  # @pagination_format = :page
  # 
  # # Error response format: :rails, :jsonapi, :rfc7807, :simple
  # @error_format = :rails
  # 
  # # Enable performance logging for facet rendering
  # @performance_logging = Rails.env.development?
end

Instance Attribute Details

#api_formatObject

Currently supported options



34
35
36
# File 'lib/generators/propel_facets/templates/config/propel_facets.rb', line 34

def api_format
  @api_format
end

#default_base_facetObject

Currently supported options



34
35
36
# File 'lib/generators/propel_facets/templates/config/propel_facets.rb', line 34

def default_base_facet
  @default_base_facet
end

#default_facetsObject

Currently supported options



34
35
36
# File 'lib/generators/propel_facets/templates/config/propel_facets.rb', line 34

def default_facets
  @default_facets
end

#rootObject

Currently supported options



34
35
36
# File 'lib/generators/propel_facets/templates/config/propel_facets.rb', line 34

def root
  @root
end

#strict_modeObject

Currently supported options



34
35
36
# File 'lib/generators/propel_facets/templates/config/propel_facets.rb', line 34

def strict_mode
  @strict_mode
end