New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JField is no longer a JValue (shifted to master) #1584

Merged
merged 6 commits into from Jun 28, 2014

Conversation

Projects
None yet
2 participants
@Shadowfiend
Copy link
Member

Shadowfiend commented Jun 20, 2014

This is #1561 reopened with respect to master.

This means more type safety since it is no longer possible
to create invalid JSON where JFields are added directly into JArrays for
instance. Most noticeable consequence of this change is that map, transform, find and filter come in two versions:

    def map(f: JValue => JValue): JValue
    def mapField(f: JField => JField): JValue
    def transform(f: PartialFunction[JValue, JValue]): JValue
    def transformField(f: PartialFunction[JField, JField]): JValue
    def find(p: JValue => Boolean): Option[JValue]
    def findField(p: JField => Boolean): Option[JField]
    ...

Use *Field functions to traverse fields in the JSON, and use the functions
without Field in the name to traverse values in the JSON.


This isn't mergable yet; I'll reconcile with the latest lift_30 branch soon, just wanted to
get the PR open.

Closes #1300.

Joni Freeman and others added some commits Nov 24, 2011

Joni Freeman
JField is no longer a JValue
This means more type safety since it is no longer possible
to create invalid JSON where JFields are added directly into JArrays for
instance. Most noticeable consequence of this change is that map, transform, find and filter come in two versions:

    def map(f: JValue => JValue): JValue
    def mapField(f: JField => JField): JValue
    def transform(f: PartialFunction[JValue, JValue]): JValue
    def transformField(f: PartialFunction[JField, JField]): JValue
    def find(p: JValue => Boolean): Option[JValue]
    def findField(p: JField => Boolean): Option[JField]
    ...

Use *Field functions to traverse fields in the JSON, and use the functions
without 'Field' in the name to traverse values in the JSON.
Fix version reference for lift-json migration info.
We now know that 2.6 will be the last 2.x release, and that the
JField </: JValue change will be in 3.0.0.
Merge branch 'lift_30' into joni_scala_2.10
Conflicts:
	core/json/src/main/scala/net/liftweb/json/JsonAST.scala
	core/json/src/main/scala/net/liftweb/json/JsonParser.scala
	core/json/src/test/scala/net/liftweb/json/DiffExamples.scala
	core/json/src/test/scala/net/liftweb/json/Examples.scala
	core/json/src/test/scala/net/liftweb/json/JsonAstSpec.scala
	core/json/src/test/scala/net/liftweb/json/LottoExample.scala
	core/json/src/test/scala/net/liftweb/json/XmlExamples.scala
Make JField a proper case class again.
Notably it does NOT extend JValue, but it is not simply a
tuple either.

Also sundry compilation fixes to make everything work well
and proper.

@Shadowfiend Shadowfiend changed the title Joni scala 2.10 JField is no longer a JValue (shifted to master) Jun 20, 2014

@farmdawgnation

This comment has been minimized.

Copy link
Member

farmdawgnation commented Jun 27, 2014

👀

@farmdawgnation

This comment has been minimized.

Copy link
Member

farmdawgnation commented Jun 27, 2014

I see a few test failures but none of them seem related to these changes.

@farmdawgnation

This comment has been minimized.

Copy link
Member

farmdawgnation commented Jun 27, 2014

Things look pretty cool in here and the tests seem to be in ok shape. Gonna merge this tonight unless there are any objections.

@farmdawgnation farmdawgnation added the JSON label Jun 28, 2014

@farmdawgnation farmdawgnation added this to the 3.0-M2 milestone Jun 28, 2014

farmdawgnation added a commit that referenced this pull request Jun 28, 2014

Merge pull request #1584 from lift/joni_scala_2.10
JField is no longer a JValue. It is instead a free standing case class with a name and value. As a result, there now exist mapField, transformField, and findField for working with these new case classes.

@farmdawgnation farmdawgnation merged commit 16a8a22 into master Jun 28, 2014

@farmdawgnation farmdawgnation deleted the joni_scala_2.10 branch Jun 28, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment