Potential breaking change: MappedField.name, affects Mapper <> JSON

4 views
Skip to first unread message

Jeppe Nejsum Madsen

unread,
Feb 18, 2010, 6:22:43 AM2/18/10
to lif...@googlegroups.com
Hi,

As part of fixing
https://www.assembla.com/spaces/liftweb/tickets/155-lift-mapper-%28record%29-camelcase-to-snake_case-for-case-insensitive-databases
, I would like to change the semantics of MappedField.name slightly:

Currently, the name is always lowercased, ie:

class SampleModel extends KeyedMapper[Long, SampleModel] {
object id extends MappedLongIndex(this)
object firstName extends MappedString(this, 32)
object moose extends MappedNullableLong(this)
object notNull extends MappedString(this, 32)
}

firstName.name == "firstname" && notNull.name == "notnull" && id.name=="id"

I would like to have name preserve the case of the field such that:

firstName.name == "firstName" && notNull.name == "notNull" && id.name=="id"

Reasons:

1) More consistent. css styles, default column headers etc based on name now follows the actual
field name
2) Easier to implement #155 :-)

name is used when serializing a Mapped object as JSON. So the JSON
representation will be changed (unless we lowercase the name only when
creating JSON, but this goes against 1)

Now:
{
"$persisted":true,
"id":1,
"firstname":"Elwood",
"moose":null,
"notnull":""
}

After proposed change:
{
"$persisted":true,
"id":1,
"firstName":"Elwood",
"moose":null,
"notNull":""
}

I would like to get a feel for the pain this will cause people....

/Jeppe

harryh

unread,
Feb 18, 2010, 7:56:25 AM2/18/10
to Lift
If this does happen please take care to include this information in
the release notes for M3 (or whatever milestone first has this change)
as people using json serialization for caching purposes will need to
invalidate their caches.

Putting the note in BIG CAPITAL LETTERS might be a good idea.

-harryh

On Feb 18, 6:22 am, Jeppe Nejsum Madsen <je...@ingolfs.dk> wrote:
> Hi,
>
> As part of fixinghttps://www.assembla.com/spaces/liftweb/tickets/155-lift-mapper-%28re...

Indrajit Raychaudhuri

unread,
Feb 18, 2010, 8:22:48 AM2/18/10
to lif...@googlegroups.com

On 18/02/10 6:26 PM, harryh wrote:
> If this does happen please take care to include this information in
> the release notes for M3 (or whatever milestone first has this change)
> as people using json serialization for caching purposes will need to
> invalidate their caches.
>
> Putting the note in BIG CAPITAL LETTERS might be a good idea.

Indeed! Note to Jeppe/Chas/IRC we need to add this in the release notes
email that goes to lift-announce and liftweb.

- Indrajit

Reply all
Reply to author
Forward
0 new messages