question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to recognize directives input types

See original GitHub issue

image

schema.gql

type User
@model(mutations: { create: "createUser", update: "updateUser" })
@auth(rules: [{
  allow: owner,
  provider: userPools,
  ownerField: "id",
  identityClaim: "sub",
  operations: [update]
}])
{
  id: ID! @Check(values: ["$ctx.identity.sub"])
  firstName: String!
  lastName: String!
  avatar: File
  address: Address # @FilterOut(cond: { op: NOT_EQUAL, values: ["$ctx.identity.sub"] })
  phoneNumber: String # @FilterOut(cond: { op: NOT_EQUAL, values: ["$ctx.identity.sub"] })
  currentOrganisationID: ID # @ReadOnly # set by a lambda
}

awsDirectives.graphql

scalar AWSDate
scalar AWSTime
scalar AWSDateTime
scalar AWSTimestamp
scalar AWSEmail
scalar AWSJSON
scalar AWSURL
scalar AWSPhone
scalar AWSIPAddress

##########################################################
##          Model
##########################################################
directive @model(
  queries: ModelQueryMap
  mutations: ModelMutationMap
  subscriptions: ModelSubscriptionMap
  timestamps: TimestampConfiguration
) on OBJECT
input ModelMutationMap {
  create: String
  update: String
  delete: String
}
input ModelQueryMap {
  get: String
  list: String
}
input ModelSubscriptionMap {
  onCreate: [String]
  onUpdate: [String]
  onDelete: [String]
  level: ModelSubscriptionLevel
}
enum ModelSubscriptionLevel {
  off
  public
  on
}
input TimestampConfiguration {
  createdAt: String
  updatedAt: String
}

##########################################################
##          Auth
##########################################################
directive @auth(rules: [AuthRule!]!) on OBJECT | FIELD_DEFINITION
input AuthRule {
  allow: AuthStrategy!
  provider: AuthProvider
  ownerField: String # defaults to "owner" when using owner auth
  identityClaim: String # defaults to "username" when using owner auth
  groupClaim: String # defaults to "cognito:groups" when using Group auth
  groups: [String]  # Required when using Static Group auth
  groupsField: String # defaults to "groups" when using Dynamic Group auth
  operations: [ModelOperation] # Required for finer control

  # The following arguments are deprecated. It is encouraged to use the 'operations' argument.
  queries: [ModelQuery]
  mutations: [ModelMutation]
}
enum AuthStrategy { owner groups private public }
enum AuthProvider { apiKey iam oidc userPools }
enum ModelOperation { create update delete read }

# The following objects are deprecated. It is encouraged to use ModelOperations.
enum ModelQuery { get list }
enum ModelMutation { create update delete }

##########################################################
##          Key
##########################################################
directive @key(fields: [String!]!, name: String, queryField: String) on OBJECT

##########################################################
##          Connextion
##########################################################
directive @connection(keyName: String, fields: [String!]) on FIELD_DEFINITION

##########################################################
##          Function / Lambda
##########################################################
directive @function(name: String!, region: String) on FIELD_DEFINITION

##########################################################
##          Searchable / Elasticsearch
##########################################################
# Streams data from DynamoDB to Elasticsearch and exposes search capabilities.
directive @searchable(queries: SearchableQueryMap) on OBJECT
input SearchableQueryMap { search: String }

##########################################################
##          HTTP / Slack for ex
##########################################################
directive @http(method: HttpMethod, url: String!, headers: [HttpHeader]) on FIELD_DEFINITION
enum HttpMethod { PUT POST GET DELETE PATCH }
input HttpHeader {
  key: String
  value: String
}

The directives file is correctly included in .graphqlconfig and the directives don’t have any issues. The issues come on the arguments of these directives and it looks like the plugin failed to find the input types. Can be related to https://github.com/jimkyndemeyer/js-graphql-intellij-plugin/issues/348

I’am using the latest WebStorm with the latest plugin version (2.6.0)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:6

github_iconTop GitHub Comments

2reactions
dhyeyshahcommented, Feb 12, 2021

Any updates on this front? This is still happening in the @auth directive of amplify. Even when we use this defination

type Note
  @model
  @auth(rules: [{ allow: owner }])
{
  id: ID!
  title: String
  content: String
}

directive @auth(
  rules: [AuthRule!]!
) on OBJECT

input AuthRule {
  allow: AuthStrategy!
  ownerField: String
  groups: [String]
  operations: [ModelOperation]
}

enum AuthStrategy { owner groups private public }

enum ModelOperation { create update delete read }

It will recognise “rules”, but It will not recognise “allow” field within “rules”. When can we expect this to be fixed?

0reactions
vepanimascommented, Sep 5, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to recognize directives input types · Issue #388 - GitHub
I was having the same problem and in my testing it seems that as soon as any of the defined directives are invalid...
Read more >
Failed to recognize directives input types - Bountysource
Failed to recognize directives input types.
Read more >
Directive restricting input is not working with type=number
1 Answer 1 ... There are two issues here. First, the maxlength attribute doesn't work with input type number . See e.g. maxlength...
Read more >
NG8002: Unknown attribute or input - Angular
An @Input() property of a component or directive applied to the element. The runtime error for this is NG0304: '${tagName}' is not a...
Read more >
Directives | RedwoodJS Docs
We call those types of directives Transformers. You'll recognize a directive as being 1) preceded by @ (e.g. @myDirective ) and 2) declared...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found