Commit graph

49 commits

Author SHA1 Message Date
Zac Sweers
fead71bca0 Add support for default values in PolymorphicJsonAdapterFactory
Picking from #741
Resolves #739
2018-12-31 16:21:57 -08:00
Eric Cochran
5f0b2ee8e3 Allow Object base type for PolymorphicJsonAdapterFactory. (#744)
* Allow Object base type for PolymorphicJsonAdapterFactory

This works now.
Using general types like Object, Map, or List for the base type is error-prone, but the checks for these cases are not worth the code cost.

* Delete redundant test.

Let's not encourage users to use Object as a base type by showing it in a test.
2018-11-18 10:15:41 -05:00
Jesse Wilson
6b6c1af907 [maven-release-plugin] prepare for next development iteration 2018-11-09 10:04:52 +11:00
Jesse Wilson
eb7110bf59 [maven-release-plugin] prepare release moshi-parent-1.8.0 2018-11-09 10:04:36 +11:00
Jesse Wilson
89103b6d13 Rename RuntimeJsonAdapterFactory to PolymorphicJsonAdapterFactory
Also expand the documentation.
2018-10-20 00:47:48 -04:00
Jesse Wilson
1896e0f118
Merge pull request #697 from jocmp/master
Make RuntimeJsonAdapterFactory public
2018-10-19 23:33:06 -04:00
Jesse Wilson
6125d8c7b1 Don't decode into memory in RuntimeJsonAdapterFactory
Instead use our new flatten API to decode directly to the stream.
2018-10-19 12:07:58 -04:00
Jesse Wilson
f28bca609a JSON flattening.
This is a new API that makes it possible to do more interesting things
with composition. It's currently write-only; doing composition on reads
is much more difficult.
2018-10-19 10:59:19 -04:00
Jesse Wilson
24ac43a799 Change RuntimeJsonAdapterFactory to peek for type names.
This is a bit awkward because JsonReader.Options doesn't tell you
what its values are.

Also awkward because we don't yet have an equivalent to stream
the encode of the value.
2018-10-09 23:10:31 -04:00
Jesse Wilson
fe22970973 Document how to register JsonAdapters
Closes: https://github.com/square/moshi/issues/698
2018-10-08 11:14:57 -04:00
Josiah Campbell
80f651a3eb Make RuntimeJsonAdapterFactory public 2018-09-27 10:44:55 -05:00
Jesse Wilson
2cb81857ac [maven-release-plugin] prepare for next development iteration 2018-09-24 22:55:49 -04:00
Jesse Wilson
9a652f8788 [maven-release-plugin] prepare release moshi-parent-1.7.0 2018-09-24 22:55:35 -04:00
Jesse Wilson
11241a2b02 Hide RuntimeJsonAdapterFactory for the forthcoming release.
We don't yet have the behavior we want for looking ahead at the type label.
2018-09-24 21:03:20 -04:00
Eric Cochran
810199a442 Disallow Object for RuntimeJsonAdapterFactory's base type. 2018-09-18 17:57:11 -07:00
Eric Cochran
67d07eb450
Add copyright header to EnumJsonAdapterTest. 2018-09-10 15:33:39 -07:00
Jesse Wilson
29bb93bc29 Include labels when encoding with RuntimeJsonAdapterFactory.
Otherwise the adapter is not symmetric.
2018-09-09 17:43:42 -04:00
Eric Cochran
8a8cde0ce3 Allow null fallback enum value in EnumJsonAdapter. 2018-08-31 00:51:34 -07:00
Eric Cochran
29bdc0aa45
Add EnumJsonAdapter to adapters module. (#607) 2018-08-07 15:05:56 -07:00
Eric Cochran
0f1fa3d385 Add RuntimeJsonAdapterFactory to adapters module. (#606)
* Add RuntimeJsonAdapterFactory to adapters module.

* Make RuntimeJsonAdapterFactory create null-safe adapters.

* Add copyright headers.
2018-08-06 04:35:53 -04:00
Eric Cochran
ee873b64f6
Remove unused import. 2018-07-26 17:28:15 -07:00
Jesse Wilson
31ef245eeb [maven-release-plugin] prepare for next development iteration 2018-05-14 23:00:15 -04:00
Jesse Wilson
bf4d1f8693 [maven-release-plugin] prepare release moshi-parent-1.6.0 2018-05-14 23:00:02 -04:00
Jesse Wilson
986cc4c794 [maven-release-plugin] prepare for next development iteration 2018-05-06 21:50:45 -04:00
Jesse Wilson
c2f890879c [maven-release-plugin] prepare release moshi-parent-1.6.0-RC1 2018-05-06 21:50:39 -04:00
Eric Cochran
e5e4fde1dc
Use direct link to adapters snapshots. 2018-04-06 16:23:51 -07:00
Szymon Kozak
351bc57554 Change compile to implementation in README (#467) 2018-03-27 17:43:46 -07:00
Jesse Wilson
5ad9d31bd8 Move modules into their own packages.
This sets the Automatic-Module-Name for moshi, moshi-adapters, and moshi-kotlin.
It moves moshi-adapters into its own .adapters package and forwards the existing
adapter. It moves the moshi-kotlin into its own .kotlin package and forwards the
existing adapter.

I'm not certain this is necessary or sufficient, but I think it's the right idea
for JPMS compatibility.
2018-02-07 04:41:06 -05:00
Eric Cochran
9deeb62e77 Add permalink to ISO8601Utils.java. (#425)
This file was removed from master a few months ago.
2018-01-10 21:57:00 -05:00
Benoît Quenaudon
5125fc2f27 Fix builder calls to new API
Update the example with the right API https://github.com/square/moshi/blob/master/moshi/src/main/java/com/squareup/moshi/Moshi.java#L155
2017-08-01 12:58:20 +09:00
John Carlson
76df51bfde Correction to docs of Rfc3339DateJsonAdapter 2017-07-26 14:49:46 -05:00
John Carlson
54c026f5db Document moshi-adapters artifact 2017-07-26 14:35:38 -05:00
Eric Cochran
b7f771a70f Add cause to malformed date string exception. 2017-06-20 00:15:11 -07:00
jwilson
798f14bda5 [maven-release-plugin] prepare for next development iteration 2017-05-14 22:20:00 -04:00
jwilson
f42ae45f4c [maven-release-plugin] prepare release moshi-parent-1.5.0 2017-05-14 22:19:55 -04:00
Jesse Wilson
77a1f388db Fix Javadoc builds with the jsr305 dependency. (#306)
Because multiple modules share a package we need to share the dependency on
everything in package-info.java.
2017-05-14 22:18:35 -04:00
jwilson
49092ece96 [maven-release-plugin] prepare for next development iteration 2017-02-04 15:20:11 -05:00
jwilson
d075a3e56a [maven-release-plugin] prepare release moshi-parent-1.4.0 2017-02-04 15:20:05 -05:00
jwilson
e1809aa6f9 [maven-release-plugin] prepare for next development iteration 2016-10-21 09:35:13 -04:00
jwilson
6d623663cb [maven-release-plugin] prepare release moshi-parent-1.3.1 2016-10-21 09:35:10 -04:00
jwilson
4ff50c47ac [maven-release-plugin] prepare for next development iteration 2016-10-15 14:18:34 -04:00
jwilson
71ded8d091 [maven-release-plugin] prepare release moshi-parent-1.3.0 2016-10-15 14:18:31 -04:00
jwilson
23e6d36a8b [maven-release-plugin] prepare for next development iteration 2016-05-28 14:27:08 -04:00
jwilson
5f0e509b8d [maven-release-plugin] prepare release moshi-parent-1.2.0 2016-05-28 14:27:04 -04:00
jwilson
ad3506ffed [maven-release-plugin] prepare for next development iteration 2016-01-18 17:17:10 -05:00
jwilson
30a4c3c92e [maven-release-plugin] prepare release moshi-parent-1.1.0 2016-01-18 17:17:08 -05:00
jwilson
e6a77041a1 [maven-release-plugin] prepare for next development iteration 2015-09-27 13:25:21 -04:00
jwilson
e93e6574ca [maven-release-plugin] prepare release moshi-parent-1.0.0 2015-09-27 13:25:18 -04:00
jwilson
1c6bebac1d RFC3339 adapter.
Much thanks to Jackson for doing all the real work.
2015-09-26 18:51:50 -04:00