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
Just came across a small sharp edge in the API for codegen – specifying the OutputFormat has no effect, and the output format (single vs multiple files) is only a property of the URL passed in.
This is noted in a comment in the source code, so seems to already be acknowledged as an issue. Given that the API provided affords that this would work in a particular way, and that it doesn't in fact do this, I think it would be good to fix it.
I can see why it would be nice to be able to express the choice in a way that isn't just part of the URL passed in, but the inconsistency means that the documentation aspect can be incorrect, which I think is worse than not having it.
Suggestions
I'd suggest one of two fixes:
Drop the OutputFormat and take a URL, documenting the behaviour given different properties of the URL.
Keep the OutputFormat and raise an exception if the URL passed in doesn't conform to expectations.
I think it's nice to have the documentation in the API, and maintaining backwards compatibility is always good, so I'd have a preference for option 2. This exception would also not technically break backwards compatibility as I think the compatibility is framed in terms of documentation rather than behaviour, but please do correct me on this if I'm wrong!
Contributions
Would you accept a PR for this? Can we treat this issue as a design discussion for that contribution?
Versions
apollo-ios SDK version: 0.34.1
Xcode version: 12.3
Swift version: 5.3
Package manager: SPM
The text was updated successfully, but these errors were encountered:
Option 2 would definitely be better, IMO. I considered option 1 but I felt like it didn't capture intent clearly enough - throwing an error if a folder URL is passed in for singleFile or if a file URL is passed in for multipleFiles seems like a totally reasonable way of enforcing that.
@designatednerd thanks! Sorry for not getting around to doing a PR for this at the time, I have been off for a while. Thanks for going ahead with it though.
Bug report
Just came across a small sharp edge in the API for codegen – specifying the
OutputFormat
has no effect, and the output format (single vs multiple files) is only a property of theURL
passed in.This is noted in a comment in the source code, so seems to already be acknowledged as an issue. Given that the API provided affords that this would work in a particular way, and that it doesn't in fact do this, I think it would be good to fix it.
I can see why it would be nice to be able to express the choice in a way that isn't just part of the URL passed in, but the inconsistency means that the documentation aspect can be incorrect, which I think is worse than not having it.
Suggestions
I'd suggest one of two fixes:
OutputFormat
and take aURL
, documenting the behaviour given different properties of theURL
.OutputFormat
and raise an exception if theURL
passed in doesn't conform to expectations.I think it's nice to have the documentation in the API, and maintaining backwards compatibility is always good, so I'd have a preference for option 2. This exception would also not technically break backwards compatibility as I think the compatibility is framed in terms of documentation rather than behaviour, but please do correct me on this if I'm wrong!
Contributions
Would you accept a PR for this? Can we treat this issue as a design discussion for that contribution?
Versions
apollo-ios
SDK version: 0.34.1The text was updated successfully, but these errors were encountered: