-
Notifications
You must be signed in to change notification settings - Fork 27
InputValue [4 of 4] #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- add InputValue type and extensions - modify generation to use InputValue enums in serialize() - declare all optional values in Input objects at InputValue<T>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am starting to feel that the PR should be split up slightly. The explicit nulls are controversial enough to be their own PR. Also we shouldn't try to template swift code outside an erb
, that feels wrong.
input_fields.each do |field| | ||
text << escape_reserved_word(field.camelize_name) | ||
text << ": " | ||
text << swift_input_type(field.type, wrapped: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a painful way to generate code 😕 I think graphql_swift_gen.rb
is more of a place to do some calculated logic rather then template the entire init
. Having a function that is constantly appening to a string isn't nearly as readable or friendly as using embedded ruby. This should be in type.swift.erb
.
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than adding this license to all generated files why not pass in any licence you want based on the use case? Like if this is part of Buy SDK the pass in the buy SDK license.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea 👍
|
||
public var orUndefined: InputValue<Wrapped> { | ||
return InputValue(orUndefined: self) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These optional extensions feel redundant to me. Not everyone will want to use them. These could be removed from the generator. Consumers that want this extension can always build it themselves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. Agreed.
What this does
null
values viaInputType<T>
Relies on #19