Diizzayy / nuxt-graphql-client

⚡️ Minimal GraphQL Client + Code Generation for Nuxt3
https://nuxt-graphql-client.web.app
MIT License
366 stars 44 forks source link

How to disable generating #215

Closed mercs600 closed 2 years ago

mercs600 commented 2 years ago

Hi, our graphql API does not provide introspection on the main endpoint of graphql host. Is there possibility to disable generating or setup different url to get introspection ?

kihayu commented 2 years ago

We have a similar situation at our company. It would be great to have the option to disable the type generation

Diizzayy commented 2 years ago

@mercs600 @kihayu I've just released an experimental version that should enable this, I'd be happy to have the both of you onboard to assist in testing it if you're willing

The edge version can be installed via: yarn add nuxt-graphql-client@edge

Codegen can be disabled via: 'graphql-client'.codegen: false

kihayu commented 2 years ago

Thanks for the quick response. Will test it as soon as I have time

kihayu commented 2 years ago

When I start the dev-server and visit the page, I get the following error:

[nuxt] [request error] [unhandled] [500] request to http://[::]:3000/__nuxt_vite_node__/manifest failed, reason: connect EADDRNOTAVAIL :::3000 - Local (:::0) ()
  at async $fetchRaw2 (./node_modules/ohmyfetch/dist/shared/ohmyfetch.c2a48baf.mjs:132:20)  
  at async ./.nuxt/dev/index.mjs:457:20  
  at async ./.nuxt/dev/index.mjs:526:64  
  at async ./.nuxt/dev/index.mjs:106:22  
  at async ./node_modules/h3/dist/index.mjs:592:19  
  at async nodeHandler (./node_modules/h3/dist/index.mjs:538:7)  
  at async ufetch (./node_modules/unenv/runtime/fetch/index.mjs:9:17)  
  at async $fetchRaw2 (./node_modules/ohmyfetch/dist/shared/ohmyfetch.c2a48baf.mjs:132:20)  
  at async Object.errorhandler [as onError] (./.nuxt/dev/index.mjs:354:29)  
  at async Server.nodeHandler (./node_modules/h3/dist/index.mjs:545:9)

GraphQL server is available for sure.

mercs600 commented 2 years ago

@Diizzayy thank you for quick response. It works for me @kihayu

mercs600 commented 2 years ago

@Diizzayy will it be possible to provide different URL to get introspection ?

Diizzayy commented 2 years ago

will it be possible to provide different URL to get introspection ?

@mercs600 Certainly, It will be included in the next edge release.

Diizzayy commented 2 years ago

@mercs600 @Drillan767 Codegen can be disabled as of v0.2.0, by setting the codegen property of the graphql-client configuration to false.

export default defineNuxtConfig({
    modules: ['nuxt-graphql-client'],

    runtimeConfig: {
        public: {
            'graphql-client': {
              codegen: false,
                clients: {
                    spacex: 'https://api.spacex.land/graphql',
                }
            }
        }
    }
})