Commit Graph

6 Commits

Author SHA1 Message Date
Javi Martín
f87d4b589d Add and apply Naming/BlockForwarding rubocop rule
This syntax has been added in Ruby 3.1.

Not using a variable name might not be very descriptive, but it's just
as descriptive as using "block" as a variable name. Using just `&` we
get the same amount of information than using `&block`: that we're
passing a block.

We're still using `&action` in `around_action` methods because here we
aren't using a generic name for the variable, so (at least for now) we
aren't running this cop on controllers using `around_action`.
2023-09-12 15:17:28 +02:00
Javi Martín
a1439d0790 Apply Layout/LineLength rubocop rule
Note we're excluding a few files:

* Configuration files that weren't generated by us
* Migration files that weren't generated by us
* The Gemfile, since it includes an important comment that must be on
  the same line as the gem declaration
* The Budget::Stats class, since the heading statistics are a mess and
  having shorter lines would require a lot of refactoring
2023-08-30 14:46:35 +02:00
Javi Martín
7e89ecbb37 Merge pull request #4841 from consul/customize_graphql
Make it possible to customize GraphQL types
2022-06-03 12:28:29 +02:00
Javi Martín
4eea69faee Make it possible to customize GraphQL types 2022-06-02 16:22:25 +02:00
Javi Martín
4ff2e4573e Remove explicit inclusions of now-default modules
These modules are used by default in version 1.12.14 and so we were
getting deprecation warnings:

```
DEPRECATION WARNING: GraphQL::Execution::Interpreter is now the
default; remove `use GraphQL::Execution::Interpreter` from the schema
definition (app/graphql/consul_schema.rb:6)
DEPRECATION WARNING: GraphQL::Analysis::AST is now the default; remove
`use GraphQL::Analysis::AST` from the schema definition
(app/graphql/consul_schema.rb:7)
DEPRECATION WARNING: GraphQL::Pagination::Connections is now the
default, remove `use GraphQL::Pagination::Connections` from
app/graphql/consul_schema.rb:10
```
2022-06-02 13:23:56 +02:00
Finn Heemeyer
c984e666ff Add new GraphQL types, schema (with fields) & base mutation
The current consul GraphQL API has two problems.

1) It uses some unnecessary complicated magic to automatically create
   the GraphQL types and querys using an `api.yml` file. This approach
   is over-engineered, complex and has no benefits. It's just harder to
   understand the code for people which are not familiar with the
   project (like me, lol).

2) It uses a deprecated DSL [1] that is soon going to be removed from
   `graphql-ruby` completely. We are already seeing deprecation warning
   because of this (see References).

There was one problem. I wanted to create the API so that it is fully
backwards compatible with the old one, BUT the old one uses field names
which are directly derived from the ruby code, which results in
snake_case field names - not the GraphQL way. When I'm using the
graphql-ruby Class-based syntax, it automatically creates the fields in
camelCase, which breaks backwards-compatibility.

So I've added deprecated snake_case field names to keep it
backwards-compatible.

[1] https://graphql-ruby.org/schema/class_based_api.html
2022-06-01 11:41:09 +02:00