{"id":13879266,"url":"https://github.com/ianks/dry-graphql","last_synced_at":"2025-06-16T11:34:39.601Z","repository":{"id":47160691,"uuid":"150434720","full_name":"ianks/dry-graphql","owner":"ianks","description":"Integrate dry-types/dry-struct with graphql-ruby","archived":false,"fork":false,"pushed_at":"2021-09-10T14:46:33.000Z","size":75,"stargazers_count":20,"open_issues_count":3,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-21T07:12:39.448Z","etag":null,"topics":["dry-rb","dry-types","graphql","rom-rb","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ianks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-26T13:53:32.000Z","updated_at":"2024-10-28T22:12:45.000Z","dependencies_parsed_at":"2022-09-04T02:41:20.601Z","dependency_job_id":null,"html_url":"https://github.com/ianks/dry-graphql","commit_stats":null,"previous_names":["adhawk/dry-graphql"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/ianks/dry-graphql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianks%2Fdry-graphql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianks%2Fdry-graphql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianks%2Fdry-graphql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianks%2Fdry-graphql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ianks","download_url":"https://codeload.github.com/ianks/dry-graphql/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianks%2Fdry-graphql/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260150995,"owners_count":22966427,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dry-rb","dry-types","graphql","rom-rb","ruby"],"created_at":"2024-08-06T08:02:15.694Z","updated_at":"2025-06-16T11:34:39.580Z","avatar_url":"https://github.com/ianks.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# Dry::GraphQL\n\n[![Build Status](https://travis-ci.org/adHawk/dry-graphql.svg?branch=master)](https://travis-ci.org/adHawk/dry-graphql)\n\n`dry-graphql` makes [dry-types](https://dry-rb.org/gems/dry-types/) and\n[dry-struct](https://dry-rb.org/gems/dry-types/) play nicely with GraphQL. It\nadds a `graphql_type` method which will automatically generate a\n[graphql-ruby](http://graphql-ruby.org/). This takes the manual work out of\nmaintaining multiple type definitions. Specify your `dry-type`, and re-use it\nfor GraphQL.\n\n## Usage\n\nHere is an example of using it with `dry-struct`:\n\n```ruby\nclass User \u003c Dry::Struct\n  module Types\n    include Dry.Types()\n  end\n\n  attribute :name, Types::Strict::String.optional\n  attribute :age, Types::Coercible::Integer\n  attribute :middle_name, Types::Coercible::String\nend\n\nclass UserType \u003c User.graphql_type(only: [:name, :age])\n  # you can add other fields here if you want\nend\n\nclass Query \u003c GraphQL::Schema::Object\n  field :user, UserType, null: false\nend\n\nclass Schema \u003c GraphQL::Schema\n  query Query\nend\n\nputs schema.to_definition # =\u003e\n# type Query {\n#   user: User!\n# }\n#\n# type User {\n#   age: Int!\n#   name: String\n# }\nend\n```\n\n### Usage with rom-sql\n\nTo add a `graphql_type` method to a `ROM::Relation`:\n\n```ruby\nrequire 'dry/graphql/rom'\n\nclass Users \u003c ROM::Relation[:sql]\n  extend Dry::GraphQL::ROM\nend\n```\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'dry-graphql'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install dry-graphql\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run\n`rake spec` to run the tests. You can also run `bin/console` for an interactive\nprompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To\nrelease a new version, update the version number in `version.rb`, and then run\n`bundle exec rake release`, which will create a git tag for the version, push\ngit commits and tags, and push the `.gem` file to\n[rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at\nhttps://github.com/adhawk/dry-graphql. This project is intended to be a safe,\nwelcoming space for collaboration, and contributors are expected to adhere to\nthe [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT\nLicense](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Dry::GraphQL project’s codebases, issue trackers,\nchat rooms and mailing lists is expected to follow the [code of\nconduct](https://github.com/adhawk/dry-graphql/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fianks%2Fdry-graphql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fianks%2Fdry-graphql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fianks%2Fdry-graphql/lists"}