Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Graphql Admin client should not require a session argument

Abierto
#1,352 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
ruby
Área
api

Línea de trabajo

Empieza por lib/shopify_api/clients/graphql/admin.rb y compara su initializer con el comportamiento de REST Admin Client. Revisa docs/usage/custom_apps.md para comprobar la construcción documentada y haz que la implementación y la documentación coincidan sobre si el argumento session es opcional; se considera terminado cuando la inicialización documentada ya no produce un error de argumentos.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

The documentation at custom_apps.md indicates that you do not need to pass in a session argument when initializing a ShopifyAPI::Clients::Graphql::Admin client because it will use the active session (if it exists):

Image

However, this example would raise an exception because the session argument is required:

# lib/shopify_api/clients/graphql/admin.rb
module ShopifyAPI
  module Clients
    module Graphql
      class Admin < Client
        sig { params(session: T.nilable(Auth::Session), api_version: T.nilable(String)).void }
        def initialize(session:, api_version: nil) # session argument does not have a default value
          super(session: session, base_path: "/admin/api", api_version: api_version)
        end
      end
    end
  end
end

Therefore if you want to use the active session, you have to pass in session: nil:

graphql_client = ShopifyAPI::Clients::Graphql::Admin.new(session: nil, api_version: "2024-07")

This seems counter-intuitive to me, as it makes it look like the code is deliberately saying it doesn't want to use a session. I think that what is shown in the documentation is how it should work, that you can omit the argument in order to use the active session. The REST Admin Client behaves this way, so I think it only makes sense that the Graphql Admin Client does too.

I can submit a PR to make this change if you'd like. Or if you disagree and want to keep the existing behavior, then I can submit a PR to fix the documentation.

Lenguaje dominante
Ruby
Estrellas
1.1k
Forks
484
Merge medio
4 h 38 min
PR fusionados (30 d)
1

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Shopify/shopify-api-ruby

Todos los issues de Shopify/shopify-api-ruby

Issues similares

Más issues de Ruby

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.