FasterXML/jackson-module-jsonSchema — pull request #42 by balthorium (2014-06-10 07:50:05+00:00)
Title: Possible fix for issue 4 plus description

Two things being addressed in this pull request:

(1) An alternate strategy for getting "description" into the serialization.
(2) A proposed solution for resolving issue #4.

For (1), I have take a different approach from my other pull request, and have instead just moved the "description" field up to the JsonSchema class. This avoids having to change the return type for SchemaFactoryWrapper.finalSchema, which I think we were in agreement was a little risky.

For (2), I've introduced a "ReferenceSchema" that derives from SimpleTypeSchema, and (should) contain only the $ref attribute from the spec. For bean-derived objects, I also set the "id" field based on the class's canonical name, and refer to that when contained classes use the same class (and in those cases employ the ReferenceSchema). I'm still wondering if there are cases where this won't work, so please suggest tests for me to write. At the very least, though, TestCyclic now passes. A major issue that remains with this solution is cleanup of the cache of "seen schemas".

Also, do let me know if you'd like me to separate (1) and (2) into two separate change-sets. It was convenient for me to have them together as I obviously need both of these for my work :), but I can submit these separately if you prefer.