Open jmbarroso opened 3 years ago
Was there a guide or blog post you followed to create the project?
No, I set up IDEA with the AWS Toolkit plugin following instructions, then followed the simple examples for the AWS amplify framework using Amplify CLI docs.
Steps I followed:
Thanks!
Do you have a Gradle file already? If so, you should be able to right click it and select Import Gradle Project.
The Gradle file is the one generated by the amplify command. I did that, and it solved the problem. My question was to understand how the AWS Toolkit handles the IntelliJ config for Amplify projects.
So, I understand that as I generate functions and other artifacts with Amplify CLI, I have to import those manually into IDEA. Let me know if it is not correct.
Some specific questions:
Thanks!
We have not looked into integrating Amplify into the AWS Toolkit yet so it is still a manual process.
Ok thanks.
Any manual way to fix the errors with the GraphQL annotations and debug mock API ?
Sent from my iPhone
On Feb 9, 2021, at 6:38 PM, Austin Brooks notifications@github.com wrote:
We have not looked into integrating Amplify into the AWS Toolkit yet so it is still a manual process.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
@abrooksv is there any way to manually fix the errors in IDEA coming from annotations?
I am not sure, I have never used the feature myself
Is there an update on this? I would love to be able to use Webstorm or IntelliJ over VSCode for my Amplify projects
For a manual fix, try adding file with the contents below to your project. Then add a reference to it in the graphql.config.yml file.
For example if you save it as _aws.graphql, update the graqhql.config.yml file with a second schema. ex: schema:
_aws.graphql
# @model directive - Defines top level object types in your API that are backed by Amazon DynamoDB
directive @model on OBJECT
# @primaryKey directive - Configures custom primary key for @model types
directive @primaryKey(fields: [String!]!) on OBJECT | FIELD_DEFINITION
# @index directive - Configures custom secondary index structures for @model types
directive @index(name: String, sortKeyFields: [String!]) on OBJECT | FIELD_DEFINITION
# @auth directive - Defines authorization rules for your @model types and fields
directive @auth(rules: [AuthRule!]) on OBJECT | FIELD_DEFINITION
input AuthRule {
allow: AuthStrategy!
provider: AuthProvider
ownerField: String
identityClaim: String
groupClaim: String
groups: [String]
groupsField: String
operations: [ModelOperation]
}
enum AuthStrategy {
owner
groups
private
public
}
enum AuthProvider {
apiKey
iam
oidc
userPools
}
enum ModelOperation {
create
update
delete
read
}
# @hasOne directive - Create a one-directional one-to-one relationship between two models
directive @hasOne(fields: [String!]) on FIELD_DEFINITION
# @hasMany directive - Create a one-directional one-to-many relationship between two models
directive @hasMany(indexName: String, fields: [String!]) on FIELD_DEFINITION
# @belongsTo directive - Use a "belongs to" relationship to make a "has one" or "has many" relationship bi-directional
directive @belongsTo(fields: [String!]) on FIELD_DEFINITION
# @manyToMany directive - Configures a "join table" between two models to facilitate a many-to-many relationship
directive @manyToMany(relationName: String) on FIELD_DEFINITION
# @function directive - Configures a Lambda function resolvers for a field
directive @function(name: String!) on FIELD_DEFINITION
# @http directive - Configures an HTTP resolver for a field
directive @http(url: String!, method: HttpMethod) on FIELD_DEFINITION
enum HttpMethod {
GET
POST
PUT
DELETE
PATCH
}
# @predictions directive - Queries an orchestration of AI/ML services such as Amazon Rekognition, Amazon Translate, and/or Amazon Polly
directive @predictions(actions: [PredictionsActions!]!) on FIELD_DEFINITION
enum PredictionsActions {
identifyText
identifyLabels
translateText
convertTextToSpeech
convertSpeechToText
}
# @searchable directive - Makes your data searchable by streaming it to Amazon OpenSearch
directive @searchable on OBJECT
# @mapsTo directive - Specifies the original name of a table that contains production data that cannot be deleted
directive @mapsTo(name: String!) on FIELD_DEFINITION
Your Environment
Question
I have an AWS Amplify project; I started creating the backend based on graphQL and Lambda (Java Runtime). I found that the IDEA project is not set up to load Source folders or Gradle config. E.g., Java Lambda Src folders are not detected as Source; if the src folder is flagged as Source manually, the import fails because classes are not found, so new functions have to be imported manually as modules, @model or @auth annotations from AWS Amplify are not detected by IDEA and are shown as errors.
The question is, how should I set up IDEA to run an AWS Amplify project with Java runtime for Lambdas so it automatically picks up new lambdas and understands Amplify GraphQL annotations?