{"id":19404936,"url":"https://github.com/samesystem/graphql_to_rest","last_synced_at":"2025-02-25T00:44:35.835Z","repository":{"id":64486981,"uuid":"565677974","full_name":"samesystem/graphql_to_rest","owner":"samesystem","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-03T05:35:09.000Z","size":115,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-02-03T06:28:22.963Z","etag":null,"topics":[],"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/samesystem.png","metadata":{"files":{"readme":"docs/README.md","changelog":"CHANGELOG.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-14T04:44:22.000Z","updated_at":"2025-02-03T05:35:11.000Z","dependencies_parsed_at":"2025-02-03T06:24:17.367Z","dependency_job_id":"2720685a-72f9-48b8-ace0-f09f0ef4f44a","html_url":"https://github.com/samesystem/graphql_to_rest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samesystem%2Fgraphql_to_rest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samesystem%2Fgraphql_to_rest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samesystem%2Fgraphql_to_rest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samesystem%2Fgraphql_to_rest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samesystem","download_url":"https://codeload.github.com/samesystem/graphql_to_rest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240582047,"owners_count":19824145,"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":[],"created_at":"2024-11-10T11:36:43.590Z","updated_at":"2025-02-25T00:44:35.814Z","avatar_url":"https://github.com/samesystem.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GraphqlToRest\n\nTool for serving GraphQL schema as fully functional and documented REST + swagger + JSON:API API.\n\n## Installation\n\nInstall the gem and add to the application's Gemfile by executing:\n\n```bash\n    $ bundle add graphql_to_rest\n```\n\nIf bundler is not being used to manage dependencies, install the gem by executing:\n\n```bash\n    $ gem install graphql_to_rest\n```\n\n## Quick start\n\n### Include GraphqlToRest controller module in your OpenAPI controllers\n\n```ruby\nmodule Api\n  # Base controller for all API controllers\n  class OpenApiController \u003c ApplicationController\n    include GraphqlToRest::Controller::JsonApi\n  end\nend\n```\n\n### Add configuration for each controller action\n\n```ruby\nmodule Api\n  # Base controller for all API controllers\n  class UsersController \u003c OpenApiController\n    open_api do |c|\n      c.model('User').default_fields(%i[id email fullName])\n\n      c.action(:index) do |a|\n        a.graphql_action(:getUsers)\n      end\n    end\n\n    def index\n      # MakeGraphqlQuery - imaginary class that makes actual GQL requests\n      # `graphql_action_name` and `action_output_fields` - methods provided by GraphqlToRest\n      MakeGraphqlQuery.call(\n        action_name: graphql_action_name,\n        output_fields: action_output_fields\n      )\n    end\n  end\nend\n```\n\n### Add rake task for generating openapi.json file\n\nPut this somewhere in the rake task\n\n```ruby\n    # lib/tasks/openapi.rake\n    desc 'Updates openapi.json file'\n    task update_openapi: :environment do\n      open_api = GraphqlToRest::Schema.new(\n        graphql_schema: Schema,\n        path_schemas_dir: Rails.root.join('lib/open_api/path_schemas')\n      )\n\n      File.write('public/openapi.json', JSON.pretty_generate(open_api.as_json))\n    end\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/graphql_to_rest. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/graphql_to_rest/blob/master/CODE_OF_CONDUCT.md).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the GraphqlToRest project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/graphql_to_rest/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamesystem%2Fgraphql_to_rest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamesystem%2Fgraphql_to_rest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamesystem%2Fgraphql_to_rest/lists"}