• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

jsonschema2dataclass/js2d-gradle: Extended Jsonschema2Pojo gradle plugin

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

jsonschema2dataclass/js2d-gradle

开源软件地址(OpenSource Url):

https://github.com/jsonschema2dataclass/js2d-gradle

开源编程语言(OpenSource Language):

Kotlin 100.0%

开源软件介绍(OpenSource Introduction):

GitHub release (latest by date)

Extended jsonschema2pojo Gradle plugin

Introduction

This plugin is aiming to take raw JSON or YAML raw files or schemas and convert to Java or Scala POJOs (Plain Old Java Object).

Currently it suppots features like generating using Jackson, GSON and Mocha1 annotations and JSR305.

Please note, that JSR305 is purely supported, and present only if you don’t want to use a proper JSON validation for some reasons.

Adding a plugin to your build.gradle

plugins {
  id "org.jsonschema2dataclass" version "$latestRelease"
}

Please refer Gradle Plugins page for further details.

Usage Example

Usage for Android and for Java is basically the same. You need to declare plugin usage and configure plugin parameters if needed.

To execute just a java classes generation you need to run generateJsonSchema2DataClass gradle task. Otherwise, compileJava and appropriate android tasks are already dependent to this plugin.

To start using a plugin you need follow this recipe:

Minimal java example how to use the plugin
plugins{
    id "org.jsonschema2dataclass" version "$latestRelease"
}

jsonSchema2Pojo {
    targetPackage = 'org.example.api' // specify package for your needs

    source.setFrom files("${project.rootDir}/src/main/resources/json")

    // ... — add other supported options as you need
}

Additionally you can copy one of sample Java (Kotlin and Groovy DSL) and Android (AGP 3, AGP 4 and AGP 7) projects you can find in demo folder

Accepted parameters documentation

Note

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap