glideapps / glideapps/quicktype

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

オープン
#2,012 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
13.9k
フォーク
1.2k
平均マージ
8時間 53分
マージ済み PR(30日)
369

説明

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
}
```

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、コマンド `quicktype ESLModels.ts -o CodeGenOutput.swift` を再現し、issue に示されている生成された Swift の宣言とヘルパー関数を調べます。Swift の出力オプションがどのように処理されるかを確認し、要求されたアクセス修飾子が生成されたファイル内で一貫して現れることを検証します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
swift, typescript
領域
tooling
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。