Commit Graph

9 Commits

Author SHA1 Message Date
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
Javi Martín
db97f9d08c Add and apply rubocop rules for empty lines
We were very inconsistent regarding these rules.

Personally I prefer no empty lines around blocks, clases, etc... as
recommended by the Ruby style guide [1], and they're the default values
in rubocop, so those are the settings I'm applying.

The exception is the `private` access modifier, since we were leaving
empty lines around it most of the time. That's the default rubocop rule
as well. Personally I don't have a strong preference about this one.


[1] https://rubystyle.guide/#empty-lines-around-bodies
2019-10-24 17:11:47 +02:00
Julian Herrero
3ba961a2d7 Use double quotes in models 2019-03-14 17:25:43 +01:00
Bertocq
22822aa173 Fix Style/RedundantParentheses rubocop issues 2017-09-25 22:44:58 +02:00
Bertocq
2888c20489 Fix all Style/RedundantSelf rubocop issues 2017-07-05 11:55:52 +02:00
Bertocq
28970c6701 Fix all Style/UnneededInterpolation rubocop issues and remove from rubocop_tod 2017-07-04 22:44:08 +02:00
Alberto Miedes Garcés
ad8aba0739 Revised public fields, wrote more exhaustive specs 2017-05-15 20:22:11 +02:00
Alberto Miedes Garcés
073ce38a8d Improved API docs autogeneration 2017-01-27 12:39:44 +01:00
Alberto Miedes Garcés
83267330a7 Group methods related to text generation for GraphQL documentation into a module 2017-01-26 10:47:12 +01:00