Skip to content

Commit

Permalink
Fix inner entity access control (FragmentTemplate)
Browse files Browse the repository at this point in the history
  • Loading branch information
calvincestari committed Apr 1, 2023
1 parent f9f69de commit 539512e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Sources/ApolloCodegenLib/Templates/FragmentTemplate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ struct FragmentTemplate: TemplateRenderer {
let target: TemplateTarget = .operationFile

var template: TemplateString {
TemplateString(
let accessControl = embeddedAccessControlModifier(target: target)

return TemplateString(
"""
\(embeddedAccessControlModifier(target: target))\
\(accessControl)\
struct \(fragment.name.firstUppercased): \(config.schemaNamespace.firstUppercased)\
.\(if: isMutable, "Mutable")SelectionSet, Fragment {
static var fragmentDefinition: StaticString { ""\"
\(accessControl)static var fragmentDefinition: StaticString { ""\"
\(fragment.definition.source)
""\" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ class FragmentTemplateTests: XCTestCase {

let expected = """
public struct TestFragment: TestSchema.SelectionSet, Fragment {
public static var fragmentDefinition: StaticString { ""\"
"""

// when
Expand All @@ -335,6 +336,7 @@ class FragmentTemplateTests: XCTestCase {

let expected = """
public struct TestFragment: TestSchema.SelectionSet, Fragment {
public static var fragmentDefinition: StaticString { ""\"
"""

// when
Expand All @@ -352,6 +354,7 @@ class FragmentTemplateTests: XCTestCase {

let expected = """
struct TestFragment: TestSchema.SelectionSet, Fragment {
static var fragmentDefinition: StaticString { ""\"
"""

// when
Expand All @@ -369,6 +372,7 @@ class FragmentTemplateTests: XCTestCase {

let expected = """
public struct TestFragment: TestSchema.SelectionSet, Fragment {
public static var fragmentDefinition: StaticString { ""\"
"""

// when
Expand Down

0 comments on commit 539512e

Please sign in to comment.