Giter Club home page Giter Club logo

Comments (10)

rktoomey avatar rktoomey commented on June 27, 2024

Yes: sorry, options containing collections are not supported at present. They will be at some point in time, but....

Also, collections that contain options will be flattened when persisted.

from salat.

rktoomey avatar rktoomey commented on June 27, 2024

Thanks for the spec; I will try to look at it this weekend.

from salat.

varju avatar varju commented on June 27, 2024

Thanks, I appreciate it. I can certainly work around this, but figured it was worth reporting anyways.

from salat.

dat-vikash avatar dat-vikash commented on June 27, 2024

any update on this? It would be nice to have Optional collections as some fields may be optional for JSON.

from salat.

NickCody avatar NickCody commented on June 27, 2024

+1

from salat.

emanresusername avatar emanresusername commented on June 27, 2024

+1

from salat.

noahlz avatar noahlz commented on June 27, 2024

It seems unlikely that we are going to add support for optional collections Option[List[_]] (why not just use an empty list)?

If you really need this, and replacing your optional collection Option[List[_]] with just a List[_] that is sometimes Nil (or Map.empty...or equivalent) - please take a crack at a pull request.

Also, I don't quite understand the case for Option[List[_]] - can someone please elaborate why that type is necessary and just a List isn't sufficient?

from salat.

emanresusername avatar emanresusername commented on June 27, 2024

Not that this can't be worked around, but a couple scenarios where Option[List[_]] might be expected/preferred over List[_] = Nil

if you had a field that was being populated upstream by something like

Option(sourceDoc.fieldThatMightBeThere).map(extractValues)

to distinguish between cases where fieldThatMightBeThere was/wasn't there, vs. cases where you might need to tweak your extractValues functions or reevaluate assumptions about the content of the fieldThatMightBeThere when it is there

or

if you have a big document with a ton of fields, but often only need a subset, say

case class Dictionary(
name: String,
author: String,
language: String,
everyWordInTheLanguage: Option[List[String]]
)

maybe i'm doing some aggregation on the authors of all my dictionaries, i'd project out the everyWordInTheLanguage field, so the None value there could be a signal of this field was projected out as opposed to this field was asked for and was empty

I know these aren't insurmountable, but would be nice to have the . . .
(••)
( •
•)>⌐■-■
(⌐■_■)
Option

P.S. Excited to see this project coming back to life!!

from salat.

NickCody avatar NickCody commented on June 27, 2024

I think empty list is the way to go. Thanks for the detailed explanation. You can close this if no-one objects.

from salat.

emanresusername avatar emanresusername commented on June 27, 2024

No hard objection, but i'd vote for keeping it around as a "nice to have"

from salat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.