Comments (7)
The reason why everything inherits from XcodeServerEntity
is because its init(json: NSDictionary)
constructor parses out common fields like id
, rev
and tinyID
. Protocols wouldn't allow for that unfortunately, but overall I agree with you that we should be aiming for a protocol-based approach wherever possible.
from xcodeserversdk.
Old protocols wouldn't but the new ones? I mean, now we can create extensions
with default implementation - this should be a game changer.
from xcodeserversdk.
Sure, but the way the objects are now parsed is that the constructor takes a JSON object, pulls out the fields relevant to it and then calls super with the same objects, which does the same thing... until it reaches the XcodeServerEntity
, which pulls out the above mentioned fields.
Protocol extensions enable you to only provide a default implementation for all objects conforming to a certain protocol, but AFAIK they don't support inheritance, which is exactly this case.
from xcodeserversdk.
Sure, with the current architecture of project it's impossible but I was rather thinking about deeper refactoring and dropping this verbose XcodeServerEntity
inheritance thing. I'd probably do things similar to you but something (maybe a little Crusty in my head) is telling me that it can be resolved with different approach.
I will rethink this and If I come with any kind of solution or idea I will bring it to you!
from xcodeserversdk.
Yeah do, thanks!
from xcodeserversdk.
I've came to this little article today and I wonder maybe this will be a good approach?
from xcodeserversdk.
Interesting, Chris mentions the library called JSONCodable
, which I took a look at. Looks very useful for parsing and generating JSON into structs.
There is a couple of reasons why I don't think it would be of much benefit here, mostly because we give different names to properties and to the keys in the JSON. Plus the parsing pattern is very similar to what we're using already, with the exception that we use inheritance to parse the objects, because that's how they are treated by Xcode Server (everything has an _id
and a _rev
).
Let's open this if we come up with more actionable ideas.
from xcodeserversdk.
Related Issues (20)
- Provide RAC extensions (as a subspec) HOT 2
- Use Nimble for test matchers HOT 4
- Add support for live updates from XCS HOT 1
- Wait for integration results HOT 2
- Crash - no available platforms on Xcode Server HOT 6
- Add platforms for tvOS and tvOS simulator HOT 1
- Rename dictionarify to jsonify to be consistent with BuildaUtils
- Review & adapt to the new XCS API Docs HOT 2
- Release a spec with tvOS support HOT 1
- XcodeServerProxy (proxy, load balancer) HOT 4
- Has API changed with latest OS X Server update? HOT 8
- Call to server.getIntegrations fails with 400 Error HOT 4
- Incompatible with Xcode 7.3 beta HOT 4
- Build a API tester to run on every new release
- Cancel API not working HOT 3
- Not compiling in Swift 2.3 HOT 2
- bot creation HOT 1
- Include repository fingerprint to make adjusting bots easier
- Re-record test cassettes with Xcode 7 Beta 6 changes HOT 1
- Don't send `rev` when deleting a Bot
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xcodeserversdk.