You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-37Lines changed: 21 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ A Swift package for encoding to- and decoding from **JSON API** compliant reques
5
5
6
6
See the JSON API Spec here: https://jsonapi.org/format/
7
7
8
-
:warning:Although I find the type-safety of this framework appealing, the Swift compiler currently has enough trouble with it that it can become difficult to reason about errors produced by small typos. Similarly, auto-complete fails to provide reasonable suggestions much of the time. If you get the code right, everything compiles, otherwise it can suck to figure out what is wrong. This is mostly a concern when creating resource objects in-code (servers and test suites must do this). Writing a client that uses this framework to ingest JSON API Compliant API responses is much less painful. :warning:
8
+
:warning:This library provides well-tested typesafety when working with JSON:API 1.0, however the Swift compiler can sometimes have difficulty tracking down small typos when initializing `ResourceObjects`. Once the code is written correctly, it will compile, but tracking down the source of programmer errors can be an annoyance. This is mostly a concern when creating resource objects in-code (servers and test cases must do this). Writing a client that uses this framework to ingest JSON API Compliant API responses is much less painful. :warning:
@@ -109,52 +109,34 @@ Note that Playground support for importing non-system Frameworks is still a bit
109
109
110
110
### JSON:API
111
111
#### Document
112
-
-`data`
113
-
- [x] Encoding/Decoding
114
-
-`included`
115
-
- [x] Encoding/Decoding
116
-
-`errors`
117
-
- [x] Encoding/Decoding
118
-
-`meta`
119
-
- [x] Encoding/Decoding
120
-
-`jsonapi` (i.e. API Information)
121
-
- [x] Encoding/Decoding
122
-
-`links`
123
-
- [x] Encoding/Decoding
112
+
-[x]`data`
113
+
-[x]`included`
114
+
-[x]`errors`
115
+
-[x]`meta`
116
+
-[x]`jsonapi` (i.e. API Information)
117
+
-[x]`links`
124
118
125
119
#### Resource Object
126
-
-`id`
127
-
- [x] Encoding/Decoding
128
-
-`type`
129
-
- [x] Encoding/Decoding
130
-
-`attributes`
131
-
- [x] Encoding/Decoding
132
-
-`relationships`
133
-
- [x] Encoding/Decoding
134
-
-`links`
135
-
- [x] Encoding/Decoding
136
-
-`meta`
137
-
- [x] Encoding/Decoding
120
+
-[x]`id`
121
+
-[x]`type`
122
+
-[x]`attributes`
123
+
-[x]`relationships`
124
+
-[x]`links`
125
+
-[x]`meta`
138
126
139
127
#### Relationship Object
140
-
-`data`
141
-
- [x] Encoding/Decoding
142
-
-`links`
143
-
- [x] Encoding/Decoding
144
-
-`meta`
145
-
- [x] Encoding/Decoding
128
+
-[x]`data`
129
+
-[x]`links`
130
+
-[x]`meta`
146
131
147
132
#### Links Object
148
-
-`href`
149
-
- [x] Encoding/Decoding
150
-
-`meta`
151
-
- [x] Encoding/Decoding
133
+
-[x]`href`
134
+
-[x]`meta`
152
135
153
136
### Misc
154
137
-[x] Support transforms on `Attributes` values (e.g. to support different representations of `Date`)
155
138
-[x] Support validation on `Attributes`.
156
-
-[x] Support sparse fieldsets (encoding only). A client can likely just define a new model to represent a sparse population of another model in a very specific use case. On the server side, sparse fieldsets of Resource Objects can be encoded without creating one model for every possible sparse fieldset.
157
-
-[ ] Create more descriptive errors that are easier to use for troubleshooting.
139
+
-[x] Support sparse fieldsets (encoding only). A client can likely just define a new model to represent a sparse population of another model in a very specific use case for decoding purposes. On the server side, sparse fieldsets of Resource Objects can be encoded without creating one model for every possible sparse fieldset.
158
140
159
141
### Testing
160
142
#### Resource Object Validator
@@ -163,6 +145,8 @@ Note that Playground support for importing non-system Frameworks is still a bit
163
145
-[x] Only allow `ToManyRelationship` and `ToOneRelationship` within `Relationships` struct.
164
146
165
147
### Potential Improvements
148
+
These ideas could be implemented in future versions.
149
+
166
150
-[ ] (Maybe) Use `KeyPath` to specify `Includes` thus creating type safety around the relationship between a primary resource type and the types of included resources.
167
151
-[ ] (Maybe) Replace `SingleResourceBody` and `ManyResourceBody` with support at the `Document` level to just interpret `PrimaryResource`, `PrimaryResource?`, or `[PrimaryResource]` as the same decoding/encoding strategies.
168
152
-[ ] Support sideposting. JSONAPI spec might become opinionated in the future (https://github.com/json-api/json-api/pull/1197, https://github.com/json-api/json-api/issues/1215, https://github.com/json-api/json-api/issues/1216) but there is also an existing implementation to consider (https://jsonapi-suite.github.io/jsonapi_suite/ruby/writes/nested-writes). At this time, any sidepost implementation would be an awesome tertiary library to be used alongside the primary JSONAPI library. Maybe `JSONAPISideloading`.
0 commit comments