Skip to content

Commit

Permalink
[Cleanup] Make Config's namingStrategy and accessModifier params cons…
Browse files Browse the repository at this point in the history
…istent
  • Loading branch information
czechboy0 committed Jan 6, 2025
1 parent f3c32cc commit 8f6c405
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Sources/_OpenAPIGeneratorCore/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public struct Config: Sendable {
access: AccessModifier,
additionalImports: [String] = [],
filter: DocumentFilter? = nil,
namingStrategy: NamingStrategy = Config.defaultNamingStrategy,
namingStrategy: NamingStrategy,
nameOverrides: [String: String] = [:],
featureFlags: FeatureFlags = []
) {
Expand Down
4 changes: 2 additions & 2 deletions Tests/OpenAPIGeneratorReferenceTests/CompatabilityTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ fileprivate extension CompatibilityTest {
for mode in GeneratorMode.allCases {
group.addTask {
let generator = makeGeneratorPipeline(
config: Config(mode: mode, access: .public),
config: Config(mode: mode, access: .public, namingStrategy: .defensive),
diagnostics: diagnosticsCollector
)
return try assertNoThrowWithValue(generator.run(input))
Expand All @@ -265,7 +265,7 @@ fileprivate extension CompatibilityTest {
} else {
outputs = try GeneratorMode.allCases.map { mode in
let generator = makeGeneratorPipeline(
config: Config(mode: mode, access: .public),
config: Config(mode: mode, access: .public, namingStrategy: .defensive),
diagnostics: diagnosticsCollector
)
return try assertNoThrowWithValue(generator.run(input))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5868,7 +5868,7 @@ extension SnippetBasedReferenceTests {
func makeTypesTranslator(openAPIDocumentYAML: String) throws -> TypesFileTranslator {
let document = try YAMLDecoder().decode(OpenAPI.Document.self, from: openAPIDocumentYAML)
return TypesFileTranslator(
config: Config(mode: .types, access: .public),
config: Config(mode: .types, access: .public, namingStrategy: .defensive),
diagnostics: XCTestDiagnosticCollector(test: self),
components: document.components
)
Expand Down Expand Up @@ -5901,7 +5901,12 @@ extension SnippetBasedReferenceTests {
components: OpenAPI.Components = .noComponents
) throws -> TypesFileTranslator {
TypesFileTranslator(
config: Config(mode: .types, access: accessModifier, featureFlags: featureFlags),
config: Config(
mode: .types,
access: accessModifier,
namingStrategy: .defensive,
featureFlags: featureFlags
),
diagnostics: XCTestDiagnosticCollector(test: self, ignoredDiagnosticMessages: ignoredDiagnosticMessages),
components: components
)
Expand All @@ -5915,17 +5920,17 @@ extension SnippetBasedReferenceTests {
let collector = XCTestDiagnosticCollector(test: self, ignoredDiagnosticMessages: ignoredDiagnosticMessages)
return (
TypesFileTranslator(
config: Config(mode: .types, access: .public, featureFlags: featureFlags),
config: Config(mode: .types, access: .public, namingStrategy: .defensive, featureFlags: featureFlags),
diagnostics: collector,
components: components
),
ClientFileTranslator(
config: Config(mode: .client, access: .public, featureFlags: featureFlags),
config: Config(mode: .client, access: .public, namingStrategy: .defensive, featureFlags: featureFlags),
diagnostics: collector,
components: components
),
ServerFileTranslator(
config: Config(mode: .server, access: .public, featureFlags: featureFlags),
config: Config(mode: .server, access: .public, namingStrategy: .defensive, featureFlags: featureFlags),
diagnostics: collector,
components: components
)
Expand Down

0 comments on commit 8f6c405

Please sign in to comment.