Server side schema:
type MyModel {
id: String
imageURL: String
}
iOS - generated class:
public final class MyQuery: GraphQLQuery {
[ ....... ]
public struct MyModel: GraphQLMappable {
public let id: String?
public let imageUrl: String? // <----------- imageUrl != imageURL
}
}
Could it be possible in future versions to try and have the exact same property names in the generated classes and in the schema ? Thanks
Yes, we have to find a better way to deal with this. Not converting names at all means models may end up containing field names with underscores or other conventions if that is what the schema uses.
There is something to be said for just passing those names through, but using underscored properties in Swift just feels wrong :)
For that reason, I think I prefer making the conversion smarter to keep the original casing in these situations. What do you think?
@martijnwalraven : TBH, IMHO, you shouldn't worry/burden yourself with this: just pass everything as is and let the developer be responsible for making sure his/her naming scheme works. Guideline/best practices plus warnings about edges cases in documentation should be fine. I'd rather you guys focus on improving core functionalities instead of second-guessing/cleaning after developers 馃槃
Yeah, you're probably right. The schema isn't always under the mobile developer's control however, so I wanted to make it convenient to still get a nice API by default.
I have the same issue!!
maybe you need to add an option for generated code to respect or not the way pramas are written in the schema.json
Most helpful comment
@martijnwalraven : TBH, IMHO, you shouldn't worry/burden yourself with this: just pass everything as is and let the developer be responsible for making sure his/her naming scheme works. Guideline/best practices plus warnings about edges cases in documentation should be fine. I'd rather you guys focus on improving core functionalities instead of second-guessing/cleaning after developers 馃槃