Skip to content

[Bug - Swift] segment file does not observe access-level: public specified in typewriter.yml #316

@daveneff

Description

@daveneff

Bug report 🐞

Issue and steps to reproduce.

typewriter.yml file contains a parameter access-level, which allows users to specify which access level generated code should have. However, the generated file segment does not observe the provided access level - it always applies the internal access level.

This is problematic in cases where generated code is contained in a separate Package, as consumers are unable to access any of the generated functions on the extension of Analytics, since the access control cannot be made public.

Repro steps

  1. Set the access-level: public in typewriter.yml:
    client:
      language: swift
      sdk: swift
      languageOptions:
        access-level: public
    
  2. Run the codegen using npx typewriter
  3. Observe that the file segment does not observe the specified public access level

Expected

In the generated file segment, extension Analytics should have the access level specified in typewriter.yml (in this case, public):

public extension Analytics {  
    // generated event functions
}

Actual

In the generated file segment, extension Analytics has an internal access level:

extension Analytics {
    // generated event functions
 }

Versions. (Typewriter, OS, language, etc.)

  • Typewriter version: typewriter/9.1.0 darwin-arm64 node-v19.5.0
  • Language: Swift

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions