-
Notifications
You must be signed in to change notification settings - Fork 731
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
Generate Operation Variables & Field Arguments #2163
Generate Operation Variables & Field Arguments #2163
Conversation
Finished implementation of operation variable generation
d3dd12e
to
f9dcc92
Compare
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.
Glad we talked about the default value stuff, feels like we got it right in that conversation.
…it object default values directly
@trevorblades Not sure why Netlify deploy preview is failing. Can you look at this? Netlify logs are showing
|
Not sure why this happened, but I just re-ran the deploy and it seems to be working properly now. In the future, this kind of thing will be avoided since we'll only build docs deploy previews for PRs that change docs content. |
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.
Nice work here, going to be great to get this out in the next alpha!
@@ -34,6 +34,10 @@ public enum GraphQLEnum<T: EnumType>: CaseIterable, Equatable, RawRepresentable | |||
self = .case(caseValue) | |||
} | |||
|
|||
public init(_ rawValue: String) { |
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.
Should we just make this the designated initializer signature instead of having two public methods that do the same thing?
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 might be misunderstanding you, but RawRepresentable
requires you to have a public init(rawValue: String)
initializer, so we can't do that.
@@ -75,7 +75,7 @@ public class GraphQLInputField: JavaScriptObject { | |||
|
|||
private(set) lazy var description: String? = self["description"] | |||
|
|||
lazy var defaultValue: Any? = self["defaultValue"] | |||
lazy var defaultValue: GraphQLValue? = (self["astNode"] as JavaScriptObject)["defaultValue"] |
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.
🥇
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.
Haha thank you. This was painful to figure out... The other solution was going to require a lot of additional code in the TypeScript library that was going to further slow down the compilation of the AST. This is a little hacky, but definitely a better solution.
Long term, I'd really like us to re-write the JavascriptFrontend
in Swift and just access the cold hard JavaScript objects in Swift directly from the start. It will be ugly and unsafe code, casting the JS objects directly without the TypeScript compiler checking and converting types for us, but it should improve performance further. Not urgent at all, but possibly a cool intern project or something haha. :)
No description provided.