Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-models_connect

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-models_connect

  • 1.0.0
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

GraphQL Models Connect

A way to directly link GraphQL types with their underlying models.

Installation

Add this line to your application's Gemfile:

gem 'graphql-models_connect', '~> 1.0'

And then execute:

$ bundle

Usage

GraphQL Models Connect associates every GraphQL type with a model. By default, the model is assumed to have the same name as the type minus the Type suffix, and to be nested under the same module. For a single exception you can explicitly declare the model inside your object type:

module Types
  class PokemonType < BaseObject
    model_class Pokemon
    ...
  end
end

To change the default behavior of the gem, override the default_model_class class method in your base object class:

module Types
  class BaseObject < GraphQL::Schema::Object
    def self.default_model_class
      model_name = name
                     .delete_prefix('Types::')
                     .delete_suffix('Type')

      const_get model_name
    end
  end
end

Version numbers

GraphQL Models Connect loosely follows Semantic Versioning, with a hard guarantee that breaking changes to the public API will always coincide with an increase to the MAJOR number.

Version numbers are in three parts: MAJOR.MINOR.PATCH.

  • Breaking changes to the public API increment the MAJOR. There may also be changes that would otherwise increase the MINOR or the PATCH.
  • Additions, deprecations, and "big" non breaking changes to the public API increment the MINOR. There may also be changes that would otherwise increase the PATCH.
  • Bug fixes and "small" non breaking changes to the public API increment the PATCH.

Notice that any feature deprecated by a minor release can be expected to be removed by the next major release.

Changelog

Full list of changes in CHANGELOG.md

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/moku-io/graphql-filters.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 09 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc