Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/rom 5 0 #30

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Conversation

alex-lairan
Copy link

No description provided.

@alex-lairan
Copy link
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
Member

solnic commented Jul 10, 2019

Does it coerce key names to symbols?

@alex-lairan
Copy link
Author

How to verify ?

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

@solnic
Copy link
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