Skip to content

peterfication/peak-tracker-ruby-graphql-codegen

Repository files navigation

PeakTracker Ruby codegen

Example project to demonstrate GraphQL codegen in a Ruby project.

Commands

Commands are defined in the Justfile and can be listed with just.

just graphql

What it does

The first step retrieves the GraphQL schema from the Peak Tracker backend and saves it in graphql.schema.json.

The main magic happens in graphql-codegen-peak-tracker.js which generates graphql_peak_tracker.rb. The generated Ruby classes are then used in the graphql folder for the GraphQL schema.

The Ruby query class of this project just defines one field:

field(
  :peaks,
  PeakTracker::Types::PeakConnection,
  null: false,
  description: PeakTracker::Types::PeakConnection.description
) do
  PeakTracker::Types::Arguments.define_arguments(self, :ROOT_QUERY_TYPE, :peaks, %i[filter scaled_by_actor sort])
end

But the resulting GraphQL schema contains all arguments and sub-fields from the original schema.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published