-
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
fix: Schema/Target/Module name with spaces breaks generated code #2760
Conversation
✅ Deploy Preview for apollo-ios-docs canceled.
|
/// is only a static analysis of the configuration. | ||
/// | ||
/// - Parameter config: Code generation configuration settings. | ||
public static func _validate(config: ApolloCodegenConfiguration) throws { |
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.
The public method prefixed with _
to indicate that while it's public it is still considered private.
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.
Minor suggestion, but looks good to me!
@@ -76,14 +79,14 @@ public class ApolloCodegen { | |||
rootURL: rootURL | |||
) | |||
|
|||
try validate(config: configContext) | |||
try validate(context: configContext) |
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 two methods are validating different things I imagine, but it's unclear what those are (other than one uses the compilation result). Can we rename them to indicate what's going on here?
My assumption is that one is validating the context, the other is validating the compilationResult, and just needs info from the context.
If that's the case, I'd suggest
validate(_ context: ConfigurationContext)
and
validate(_ compilationResult: CompilationResult, with context: ConfigurationContext)
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.
How about this? - a492d54
- Takes the suggestion of the nameless parameter
- Keeps
compilationResult
as a second param but using the labelwith
because it's still validation of the configuration but dependent on the compilation results rather than validating the compilation results.
Fixes #2653
Related to #2664
This PR refactors the flow of configuration validation logic.
ApolloCodegen
._validation
that performs config-only validation, not dependent on the schema nor operations, that can be called from the CLI.