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

Handle json objects without properties as scalars #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jordaaash
Copy link

First off, this could be regarded as an opinionated change, so I understand if it's not accepted for that reason alone. I also haven't included tests for it, which I'm happy to do if it's acceptable.

Objection and JSON schemas in general can handle nested JSON objects. I use these (with additionalProperties: true) in my schemas to correspond with json/jsonb columns in Postgres.

However, GraphQL chokes when provided with a property of type object without properties. This proposed change uses the graphql-type-json library to handle properties of type object as JSON scalar objects when their properties are not defined.

My opinion is that this is inline with how GraphQL would expect such unspecified objects in the schema, but I'm interested in seeing if there are other opinions.

@larryosborn
Copy link

This looks like it would fix my problem too. Any chance this could get reviewed? Perhaps add some integration tests with the PR.

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