[swift-server-dev] JSON APIs

Swizzlr me at swizzlr.co
Thu Mar 2 10:09:13 CST 2017


You're right - we probably have bigger fish to fry?

Sent from my iPhone

> On 2 Mar 2017, at 16:56, Logan Wright via swift-server-dev <swift-server-dev at swift.org> wrote:
> 
> I think this is an interesting proposal, and I'm not opposed to including more type safe json, but as of now, community solutions are perfectly fine and I'd rather see us focus on getting the basic building blocks first before moving on to more of the "nice to haves" like JSON here.
> 
> Not sure how others feel about it, but that's where I'm landing.
> 
> - Logan
> 
>> On Thu, Mar 2, 2017 at 11:49 AM Helge Heß via swift-server-dev <swift-server-dev at swift.org> wrote:
>> Hi,
>> 
>> I think it should probably replace JSON deserialisation stuff, maybe the whole plist stuff, in Foundation. IMO it is common enough to actually live in Foundation.
>> 
>> Do we need a Swift Extended Library? I’m pretty sure we don’t. There are plenty of ‘Swift Extended Libraries’ already and users can pick the ones they like just fine. Isn’t Zewo supposed to be such a "community supported package”?
>> 
>> If your concern is Foundation bloat, I think the solution to this is splitting Foundation into individual submodules (like Foundation.io, Foundation.http, Foundation.json, Foundation.security, etc).
>> Everything which should be ‘standard Swift’ and applies to both client&server should just live in Foundation. IMO.
>> 
>> hh
>> 
>> P.S.: I’d hope that such a JSON library will properly support push-parsing/streaming, both when constructing JSON types (feed from NIO byte stream) as well as during generation of JSON (say when you fetch objects from a DB and then deliver them to a JSON client, you wouldn’t want to fetch all objects into memory to be able to generate JSON from them in a ’type-safe’ way). I don’t think this is particularly hard, but it needs to be considered, especially if the API would be sealed.
>> 
>> > On 2 Mar 2017, at 09:27, Swizzlr via swift-server-dev <swift-server-dev at swift.org> wrote:
>> >
>> > Tl;dr: I believe Swift's core libraries should include typesafe JSON handling.
>> >
>> > Preamble: Foundation's JSON serialisation is remarkably (and known to be) finicky, since it's mostly looking NS* objects. While this is a bug that could be rectified, the recursive JSON enum pattern has proven quite popular in recent months and I think something of this sort should be added to support typesafe JSON (de)structuring. This is a separate concern to writing a UTF-8 string; we already have parsers and writers in Swift that are pretty good.
>> >
>> > API design: we can go over this in a swift evolution proposal, we need to address another problem first:
>> >
>> > Where do we put it?!:
>> >
>> > The standard library is probably not the right place for a JSON type. With that out of the way, the Foundation library is overly constrained by its portability requirement with the unfortunately closed source implementation of Foundation on Apple platforms.
>> >
>> > Do we need a Swift Extended Library? Perhaps as a community supported package?
>> >
>> > Eager to hear the thoughts of all on this list.
>> >
>> > Tom
>> >
>> > Sent from my iPhone
>> > _______________________________________________
>> > swift-server-dev mailing list
>> > swift-server-dev at swift.org
>> > https://lists.swift.org/mailman/listinfo/swift-server-dev
>> 
>> _______________________________________________
>> swift-server-dev mailing list
>> swift-server-dev at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-server-dev
> _______________________________________________
> swift-server-dev mailing list
> swift-server-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-server-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-server-dev/attachments/20170302/690dda02/attachment.html>


More information about the swift-server-dev mailing list