You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v16.1.0
Amplify CLI Version
5.3.0
What operating system are you using?
Mac OS
Amplify Codegen Command
codegen models
Describe the bug
My repo has only a simple schema.graphql file
After generate java file for Reference and ReferenceIdTypeEnum class, the Reference.java is not compilable.
Expected behavior
The generated code should compilable
Reproduction steps
Run amplify codegen models in the same directory as schema.graphql
Check the output directory
Verify the class CopyOfBuilder is calling super.id() but there is no id() method in class.
GraphQL schema(s)
# Put schemas below this lineenumReferenceIdTypeEnum {
ASIN OBJECT_ID
}
typeReference {
id: String!idType: ReferenceIdTypeEnum!
}
Log output
GraphQL schema compiled successfully.
Edit your schema at /Users/dantrong/workspace/src/androidMain/amplify/backend/api/cloudqueue/schema.graphql or place .graphql files in a directory at /Users/dantrong/workspace/src/androidMain/amplify/backend/api/cloudqueue/schema
App not deployed yet.
Successfully generated models. Generated models can be found in /Users/dantrong/workspace/src/androidMain/amplify/backend/api/cloudqueue/app/src/main/java
Additional information
Here is the generated java file for Reference.java
package com.amplifyframework.datastore.generated.model;
import androidx.core.util.ObjectsCompat;
import java.util.Objects;
import java.util.List;
/** This is an auto generated class representing the Reference type in your schema. */
public final class Reference {
private final String id;
private final ReferenceIdTypeEnum idType;
public String getId() {
return id;
}
public ReferenceIdTypeEnum getIdType() {
return idType;
}
private Reference(String id, ReferenceIdTypeEnum idType) {
this.id = id;
this.idType = idType;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
} else if(obj == null || getClass() != obj.getClass()) {
return false;
} else {
Reference reference = (Reference) obj;
return ObjectsCompat.equals(getId(), reference.getId()) &&
ObjectsCompat.equals(getIdType(), reference.getIdType());
}
}
@Override
public int hashCode() {
return new StringBuilder()
.append(getId())
.append(getIdType())
.toString()
.hashCode();
}
public static IdTypeStep builder() {
return new Builder();
}
public CopyOfBuilder copyOfBuilder() {
return new CopyOfBuilder(id,
idType);
}
public interface IdTypeStep {
BuildStep idType(ReferenceIdTypeEnum idType);
}
public interface BuildStep {
Reference build();
}
public static class Builder implements IdTypeStep, BuildStep {
private String id;
private ReferenceIdTypeEnum idType;
@Override
public Reference build() {
return new Reference(
id,
idType);
}
@Override
public BuildStep idType(ReferenceIdTypeEnum idType) {
Objects.requireNonNull(idType);
this.idType = idType;
return this;
}
}
public final class CopyOfBuilder extends Builder {
private CopyOfBuilder(String id, ReferenceIdTypeEnum idType) {
super.id(id)
.idType(idType);
}
@Override
public CopyOfBuilder id(String id) {
return (CopyOfBuilder) super.id(id);
}
@Override
public CopyOfBuilder idType(ReferenceIdTypeEnum idType) {
return (CopyOfBuilder) super.idType(idType);
}
}
}
The text was updated successfully, but these errors were encountered:
The issue still exists. When running with the latest awsamplify-cli (npm i -g @aws-amplify/cli at 8.0.0), there is no IdStep interface in the generated file.
Before opening, please confirm:
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v16.1.0
Amplify CLI Version
5.3.0
What operating system are you using?
Mac OS
Amplify Codegen Command
codegen models
Describe the bug
My repo has only a simple schema.graphql file
After generate java file for Reference and ReferenceIdTypeEnum class, the Reference.java is not compilable.
Expected behavior
The generated code should compilable
Reproduction steps
GraphQL schema(s)
Log output
Additional information
Here is the generated java file for Reference.java
The text was updated successfully, but these errors were encountered: