-
Notifications
You must be signed in to change notification settings - Fork 730
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
feat: Codegen config access modifier #2917
Conversation
✅ Deploy Preview for apollo-ios-docs canceled.
|
@@ -250,7 +255,7 @@ public struct ApolloCodegenConfiguration: Codable, Equatable { | |||
/// - Note: Generated files must be manually added to your application target. The generated | |||
/// schema types files will be namespaced with the value of your configuration's | |||
/// `schemaNamespace` to prevent naming conflicts. | |||
case embeddedInTarget(name: String) | |||
case embeddedInTarget(name: String, accessModifier: AccessModifier = .internal) |
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.
It might seem odd that the default is .internal
but if you look at the tests that have changed there were tests that named xyz_withPublicModifier
and xyz_noPublicModifier
. withPublicModifier
was used for the tests related to a .swiftPackageManager
module type and noPublicModifier
was used for tests related to .embeddedInTarget
module type. Since we weren't specifying any access modifier all the generated code would have implicitly had internal
access level.
The caveat to this is the namespace enum, which we used to always generate as public
- that was an error though and not aligned with the rest of the generated code for a .embeddedInTarget
module type.
@@ -744,4 +746,57 @@ class ApolloCodegenConfigurationCodableTests: XCTestCase { | |||
try JSONDecoder().decode(ApolloCodegenConfiguration.APQConfig.self, from: subject) | |||
).to(throwError()) | |||
} | |||
|
|||
// MARK: - Optional Tests |
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 would like to add more tests for optional properties of the JSON decoding - will do in a follow-up PR. Unrelated to this work.
Tests/ApolloCodegenTests/CodeGeneration/Templates/InterfaceTemplateTests.swift
Show resolved
Hide resolved
e9e3a75
to
152236e
Compare
Fixing the inner access control modifiers was brutal. |
Putting this back into draft because there is a regression re. #2302. |
539512e
to
b11ae45
Compare
Tests/TestCodeGenConfigurations/EmbeddedInTarget-RelativeAbsolute/PackageTwo/Package.swift
Show resolved
Hide resolved
Please see #3066 for a regression likely related to this change. |
Closes #2630
Introduces an
accessModifier
associated value toApolloCodegenConfiguration
properties where the generated Swift code can have the access level specified by the user.