Problem
Swift output generated with --initializers contains module-level newJSONDecoder() and newJSONEncoder() helpers. When multiple schemas are generated separately and added to the same Swift target, each file defines the same functions and compilation fails with Invalid redeclaration.
The original fix in #1168 made these helpers fileprivate. They were later moved to JSONSchemaSupport.swift in commit ff61903, where they were changed back to internal visibility so model files could call the shared support file.
Expected behavior
- Standalone/single-file output: helpers should be
fileprivate, allowing multiple generated files in one module.
--multi-file-output: helpers in JSONSchemaSupport.swift must remain module-visible because model files call them.
Proposed fix
Emit fileprivate when multiFileOutput is disabled, and keep the current internal visibility when it is enabled. Add regression coverage for both modes.
Related: #1166, #1168.
Problem
Swift output generated with
--initializerscontains module-levelnewJSONDecoder()andnewJSONEncoder()helpers. When multiple schemas are generated separately and added to the same Swift target, each file defines the same functions and compilation fails withInvalid redeclaration.The original fix in #1168 made these helpers
fileprivate. They were later moved toJSONSchemaSupport.swiftin commit ff61903, where they were changed back to internal visibility so model files could call the shared support file.Expected behavior
fileprivate, allowing multiple generated files in one module.--multi-file-output: helpers inJSONSchemaSupport.swiftmust remain module-visible because model files call them.Proposed fix
Emit
fileprivatewhenmultiFileOutputis disabled, and keep the current internal visibility when it is enabled. Add regression coverage for both modes.Related: #1166, #1168.