Jackson: generate schemas with references

前端 未结 3 1026
忘掉有多难
忘掉有多难 2021-01-18 01:20

When using Jackson\'s JSON schema module, instead of serializing the complete graph I\'d like to stop whenever one of my model classes is encountered, and use the class nam

3条回答
  •  半阙折子戏
    2021-01-18 01:45

    Here's a custom SchemaFactoryWrapper that solves the problem. No guarantees, but it seems to work pretty well with Jackson 2.4.3.

    UPDATE: With Jackson 2.5 onward it's a lot easier. Now you can specify a custom VisitorContext.

提交回复
热议问题