8000 Rails 6: Graphql class based approach by Tooyosi · Pull Request #1623 · zooniverse/caesar · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Rails 6: Graphql class based approach #1623

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

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

Conversation

Tooyosi
8000 Copy link
Contributor
@Tooyosi Tooyosi commented Apr 13, 2025
Failure/Error:
  CaesarSchema = GraphQL::Schema.define do
    query(QueryRoot)
    mutation(MutationRoot)
  end

NoMethodError:
  undefined method `define' for GraphQL::Schema:Class
  Did you mean?  defined?
# ./app/graphql/caesar_schema.rb:1:in `<main>'
# ./spec/graphql/caesar_schema_spec.rb:3:in `<main>'

Error is caused due to changes from use of objects to classes from graphql 1.xx to 2.xx
See:
https://imaharu.github.io/graphql-ruby-doc-ja/schema/class_based_api.html
https://graphql-ruby.org/mutations/mutation_classes

@Tooyosi Tooyosi requested review from zwolf and yuenmichelle1 April 13, 2025 19:49
if next?
gem "rails", '~> 6.0'
else
gem 'rails', '~> 5.2'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bundler/DuplicatedGem: Gem rails requirements already given on line 15 of the Gemfile.

@@ -8,7 +11,11 @@ end
gem 'active_record_extended'
gem 'httparty'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2'
if next?
gem "rails", '~> 6.0'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

@@ -1,3 +1,6 @@
def next?
File.basename(__FILE__) == "Gemfile.next"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

@@ -1,3 +1,6 @@
def next?
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/FrozenStringLiteralComment: Missing magic comment # frozen_string_literal: true.

class CaesarSchema < GraphQL::Schema
query(Types::QueryRoot)
mutation(Types::MutationRoot)
end
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingBlankLines: Final newline missing.

@@ -0,0 +1,9 @@
# app/graphql/types/credential_type.rb
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/FrozenStringLiteralComment: Missing magic comment # frozen_string_literal: true.

field 'url', String, null: true
field 'status', Enums::DataRequestStatus, null: false
end
end
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/EndAlignment: end at 12, 2 is not aligned with module at 2, 0.

@@ -0,0 +1,12 @@
# app/graphql/types/data_request.rb
module Types
class DataRequest < GraphQL::Schema::Object
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/IndentationWidth: Use 2 (not 4) spaces for indentation.
Style/Documentation: Missing top-level class documentation comment.

@@ -0,0 +1,12 @@
# app/graphql/types/data_request.rb
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/FrozenStringLiteralComment: Missing magic comment # frozen_string_literal: true.

# app/graphql/types/enums/data_request_requested_data.rb
module Types
module Enums
class DataRequestRequestedData < GraphQL::Schema::Enum
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/Documentation: Missing top-level class documentation comment.

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.

1 participant
0