glideapps / glideapps/quicktype

When converting from typescript to a target language, how can I declare a class as public?

Open
#2,012 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
13.9k
Forks
1.2k
Avg merge
8h 53m
Merged PRs (30d)
369

Description

When running this command `quicktype ESLModels.ts -o CodeGenOutput.swift`, I want the outputted file to contain public access modifiers. The output is technically correct, but if a project uses multiple packages, then we need these classes to have a public designation. In other words, `enum ProcedureStateEnum` needs to be `public enum ProcedureStateEnum`

`ESLModels.ts`
```
export enum ProcedureStateEnum {
draft = 'draft',
review = 'review',
pending_approval = 'pending_approval',
effective = 'effective',
inactive = 'inactive',
approved = 'approved',
retired = 'retired',

archived = 'archived',
}
```
outputs:
```
enum ProcedureStateEnum: String, Codable {
case approved = "approved"
case archived = "archived"
case draft = "draft"
case effective = "effective"
case inactive = "inactive"
case pendingApproval = "pending_approval"
case retired = "retired"
case review = "review"
}

// MARK: - Helper functions for creating encoders and decoders

func newJSONDecoder() -> JSONDecoder {
let decoder = JSONDecoder()
if #available(iOS 10.0, OSX 10.12, tvOS 10.0, watchOS 3.0, *) {
decoder.dateDecodingStrategy = .iso8601
}
return decoder
}

func newJSONEncoder() -> JSONEncoder {
let encoder = JSONEncoder()
if #available(iOS 10.0, OSX 10.12, tvOS 10.0, watchOS 3.0, *) {
encoder.dateEncodingStrategy = .iso8601
}
return encoder
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.