aws-appsync-codegen
aws-appsync-codegen copied to clipboard
Removed generation of double Optionals for properties of Input type
For objects of type Input, the Swift code generation is creating unnecessary layers of Optionality for all Optional properties.
Given this GraphQL input type
input ReviewInput {
stars: Int!
commentary: String
favoriteColor: ColorInput
}
The code generated has two layers of Optionality. eg: Optional<String?>
public struct ReviewInput: GraphQLMapConvertible {
public init(stars: Int,
commentary: Optional<String?> = nil,
favoriteColor: Optional<ColorInput?> = nil) {
...
}
}
This PR replaces to a single Optionality level, aligning with all other generated types.
public struct ReviewInput: GraphQLMapConvertible {
public init(stars: Int,
commentary: String? = nil,
favoriteColor: ColorInput? = nil) {
...
}
}
Thanks @MarioBajr ,
I will discuss with the team about the change and update you with the decision.
Hello @MarioBajr
We will be retiring this repo soon as the new [AWS Amplify CLI](url https://github.com/aws-amplify/amplify-cli) has the codegen features, improvements, and more, including automatic graphql generation as well as a GraphQL transformer: https://github.com/aws-amplify/amplify-cli/blob/master/native_guide.md
Could you look to see if the new AWS Amplify CLI flow resolves your issue and if not open something in that repo?
Hi @muellerfr,
thanks for the updates, while evaluating amplify-cli, I found that this project (aws-appsync-codegen) is imported as a dependency, being the responsible for the Swift code generation.
https://github.com/aws-amplify/amplify-cli/blob/master/packages/amplify-codegen/package.json#L17
https://github.com/aws-amplify/amplify-cli/blob/master/packages/amplify-codegen/src/commands/types.js#L39
Is the new codegen feature that you guys are planning to use available anywhere else? Cheers
Hi @MarioBajr, we will merge this change into the https://github.com/aws-amplify/amplify-cli repo, where this code now lives.