Skip to content

Feature/rom 5 0#30

Draft
alex-lairan wants to merge 3 commits into
rom-rb:masterfrom
alex-lairan:feature/rom-5_0
Draft

Feature/rom 5 0#30
alex-lairan wants to merge 3 commits into
rom-rb:masterfrom
alex-lairan:feature/rom-5_0

Conversation

@alex-lairan
Copy link
Copy Markdown

No description provided.

@alex-lairan
Copy link
Copy Markdown
Author

Hi @solnic

I tried to make spec pass, but I have troubles with Dry::Struct :

     Dry::Struct::Error:
       [ROM::Struct::User.new] :_id is missing in Hash input

I think I'm not using it well

      schema do
        # TODO: we need ROM::Mongo::Types (similar to ROM::SQL::Types)
        attribute :_id, ROM::Types.Nominal(BSON::ObjectId)
        attribute :name, ROM::Types::String
        attribute :email, ROM::Types::String
      end

Any idea ?

@alex-lairan alex-lairan mentioned this pull request Jul 10, 2019
@solnic
Copy link
Copy Markdown
Member

solnic commented Jul 10, 2019

Does it coerce key names to symbols?

@alex-lairan
Copy link
Copy Markdown
Author

How to verify ?

I thought that transform_keys(&:to_sym) should to the job.

@solnic
Copy link
Copy Markdown
Member

solnic commented Jul 10, 2019

It does not look like this custom struct class is used. Regardless, structs should not be used for coercing keys. We have Relation#output_schema for this, as I mentioned - see how rom-elasticsearch is structured and mimic it here. We need a custom schema class configured and then you can do this.

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.

2 participants