Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown directive "@namespace" error #6913

Closed
4 tasks done
185driver opened this issue Sep 19, 2020 · 6 comments
Closed
4 tasks done

Unknown directive "@namespace" error #6913

185driver opened this issue Sep 19, 2020 · 6 comments
Labels
type:question Support or code-level question

Comments

@185driver
Copy link

New Issue Checklist

Issue Description

An error is thrown on build if I use the @namespace directive in custom schema.

Steps to reproduce

const parseGraphQLServer = new ParseGraphQLServer(
  parseServer,
  {
    graphQLPath: '/graphql',
    graphQLCustomTypeDefs: gql`
    extend type Query {
      custom: Custom @namespace
    }
    type Custom {
      hello: String @resolve
    }
  `,
    playgroundPath: '/playground',
  },
);
  1. Initialize a ParseServer using the code found in @davimacedo 's PR found at GraphQL Custom Schema #5821 (comment)
  2. Open the GraphQL API console. The error will be logged in the dev console.

Actual Outcome

An Unknown directive "@namespace" error in the console.

Expected Outcome

I thought it would not error out.

Environment

Server

  • Parse Server version: 4.30
  • Operating system: Win 10
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): localhost

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 4.2.8
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): MongoDB Atlas

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): JS
  • SDK version: Cloud Code

Logs

error: Error: Unknown directive "@namespace".
    at assertValidSDLExtension (C:\Mypath\node_modules\graphql\validation\validate.js:124:11)
    at Object.extendSchema (C:\Mypath\node_modules\graphql\utilities\extendSchema.js:77:43)
    at extensions.forEach.extension (C:\Mypath\node_modules\@graphql-tools\stitch\index.cjs.js:862:28)   
    at Array.forEach (<anonymous>)
    at stitchSchemas (C:\Mypath\node_modules\@graphql-tools\stitch\index.cjs.js:861:16)
    at ParseGraphQLSchema.load (C:\Mypath\node_modules\parse-server\lib\GraphQL\ParseGraphQLSchema.js:212:56)
    at process._tickCallback (internal/process/next_tick.js:68:7)
@mtrezza
Copy link
Member

mtrezza commented Sep 21, 2020

Thanks for reporting.

@Moumouls Since you are a GraphQL expert, do you have any comment on this?

@davimacedo
Copy link
Member

@185driver There is no @namespace directive implemented by default in Parse Server GraphQL. Could you please explain what's your goal with this directive? Maybe it's something that can be added to the project.

@Moumouls
Copy link
Member

@davimacedo, you are right, @185driver , directives were designed to customize and enhance a GraphQL Schema.
Some default directives exists like: @deprecated , @skip. In case of parse server we added @resolve (designed to call a Parse Cloud function as a resolver) and @mock to allow developers to mock a response when they need the API Schema but do not have the resolver/clound function ready.

@namespace seems to be a custom directive, may be you see this directive into a GraphQL example ?

@Moumouls Moumouls added the type:question Support or code-level question label Sep 22, 2020
@Moumouls
Copy link
Member

Ohhhh i see @185driver , @namespace was removed from API it's just a resolve that return an empty object () => ({}). After namespace i suggested to implement @mock that replace @namespace you can find some example on the PR from @davimacedo : #5836

@Moumouls
Copy link
Member

@185driver If everything is ok for you, i let you close this issue

@185driver
Copy link
Author

Oh, copy that. That would explain the error, ha. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question Support or code-level question
Projects
None yet
Development

No branches or pull requests

4 participants