module OasRails::Builders::EsquemaBuilder

def build_incoming_schema(klass:, model_to_schema_class: Esquema)

Returns:
  • (Hash) - The schema as a JSON-compatible hash.

Parameters:
  • klass (Class) -- The class for which the schema is built.
def build_incoming_schema(klass:, model_to_schema_class: Esquema)
  configure_common_settings
  model_to_schema_class.configuration.excluded_columns = OasRails.config.excluded_columns_incoming
  model_to_schema_class::Builder.new(klass).build_schema.as_json
end

def build_outgoing_schema(klass:, model_to_schema_class: Esquema)

Returns:
  • (Hash) - The schema as a JSON-compatible hash.

Parameters:
  • klass (Class) -- The class for which the schema is built.
def build_outgoing_schema(klass:, model_to_schema_class: Esquema)
  configure_common_settings
  model_to_schema_class.configuration.excluded_columns = OasRails.config.excluded_columns_outgoing
  model_to_schema_class::Builder.new(klass).build_schema.as_json
end

def configure_common_settings

Excludes associations and foreign keys from the schema.

Configures common settings for schema building.
def configure_common_settings
  Esquema.configuration.exclude_associations = true
  Esquema.configuration.exclude_foreign_keys = true
end