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

$formatDatabaseJson doesn't work for a newer versions of this library #17

Closed
nasushkov opened this issue Aug 14, 2017 · 6 comments
Closed

Comments

@nasushkov
Copy link
Contributor

nasushkov commented Aug 14, 2017

Hi
I'm trying to upgrade from version 0.1.2. I use snake_case for db objects naming and camelCase for my ORM models. I use the following code to parse from one format to another:

  $formatDatabaseJson(json) {
        json = super.$formatDatabaseJson(json)
        return mapKeys(json, (value, key) => snakeCase(key))
    }
    $parseDatabaseJson(json) {
        json = mapKeys(json, (value, key) => camelCase(key))
        return super.$parseDatabaseJson(json)
    }

My queries used to work for version 0.1.2, but now they fail and I think the reason is wrong parsing behavior as I've got wrong queries in my log:

select "area_param"."paramName", "area_param"."type", "area_param"."displayUnit", "area_param"."displayName" from "area_param"

@nasushkov nasushkov changed the title $formatDatabaseJson doesn't work a newer versions of this library $formatDatabaseJson doesn't work for a newer versions of this library Aug 14, 2017
@koskimas
Copy link
Collaborator

Thanks for reporting this. I'll check out what is going on.

@koskimas
Copy link
Collaborator

Could you put this in your package.json

"objection": "git://github.com/Vincit/objection-graphql.git#382d2ed"

and test if it fixed you bug?

@nasushkov
Copy link
Contributor Author

@koskimas Thanks! I'll try it

@nasushkov
Copy link
Contributor Author

@koskimas it works!

@koskimas
Copy link
Collaborator

Great! I'll write couple of test cases to prevent this from happening again and I'll publish a patch after that.

@koskimas
Copy link
Collaborator

Fixed in v0.2.3

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

No branches or pull requests

2 participants