mattpolzin / mattpolzin/JSONAPI

Redesign Attributes/Relationships around property wrappers

オープン
#38 コメント 5 件 リアクション 4 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

enhancement
主要言語
Swift
スター
81
フォーク
21
PR マージ指標
30日以内にマージされた PR はありません

説明

Exploration started here: https://github.com/mattpolzin/JSONAPI/tree/feature/transformed-property

This project is on hold until property wrapper chaining (or nesting) is supported (likely Swift 5.2).

The idea I am pursuing is to replace Attribute/TransformedAttribute with an @Attribute attribute and use an @Omittable attribute to represent when attributes can be omitted (i.e. the key is not required). I am a little less solid on relationships, but they would get similar treatment. Then, I additionally would like to flatten things so that attributes and relationships are defined in the same structure with their property attributes being the thing that differentiates them. Definitely have not worked out all of the details yet, but I hope that in addition to being a breaking change this will bring some concision and reduce the overall number of types needed a bit.

Something like

PersonProperties {
  // takes the place of current `Attribute`
  @Attribute
  var name: String

  // where age is stored as a `String` for some reason but we expect it to always be an `Int`
  // takes the place of current `TransformedAttribute`
  @Attribute(deserialize: StringToInt.self)
  var age: Int

  // takes the place of current `ToOneRelationship`
  @Relationship(to: City?.self)
  var hometown: Id?

  // takes the place of current `ToManyRelationship`
  @Relationship(to: [Person].self)
  var friends: [Id]
}

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

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

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、リンク先の transformed-property ブランチでの検討内容と、既存の Attribute、TransformedAttribute、relationship の型を確認します。breaking change の完了基準を定義する前に、property-wrapper と relationship の設計を明確にし、チェーンやネストのサポートを含めて検討します。

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

評価

技術スタック
swift
領域
api
issue の種類
リファクタリング
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
15/100

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

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