openmetadata 的client 生成代码处理

openmetadata 的client 是基于swagger maven 代码生成扩展生成的,client 层核心是包装了一些认证处理的

插件配置

<plugin>
    <groupId>io.swagger.codegen.v3</groupId>
    <artifactId>swagger-codegen-maven-plugin</artifactId>
    <version>3.0.16</version>
    <dependencies>
        <dependency>
            <groupId>com.github.jknack</groupId>
            <artifactId>handlebars</artifactId>
            <version>4.3.0</version>
        </dependency>
    </dependencies>
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <inputSpec>/Users/dalong/mylearning/open-metadata/newop/openmetadata-service/target/classes/assets/swagger.yaml</inputSpec>
                <language>java</language>
                <library>feign</library>
                <generateApiTests>true</generateApiTests>
                <generateModelTests>true</generateModelTests>
                <apiPackage>org.openmetadata.client.api</apiPackage>
                <modelPackage>org.openmetadata.client.model</modelPackage>
                <configOptions>
                    <generateForOpenFeign>true</generateForOpenFeign>
                    <sourceFolder>src/main/java/</sourceFolder>
                </configOptions>
                <output>${project.build.directory}/generated-sources/swagger
                </output>
            </configuration>
        </execution>
    </executions>
</plugin>
生成的client 结构
  • 参考图

基本都是swagger 代码生成器的结构

 

 

不同client 的处理,每个rest api 接口会有不同的client 同时也是swagger api 的结构

 

 

说明

以上实际上有一些问题,就是官方的使用feign 版本有点地,同时时间处理上依赖了com.fasterxml.jackson.datatype.threetenbp

参考资料

https://github.com/OpenFeign/feign
https://github.com/swagger-api/swagger-codegen/tree/3.0.0/modules/swagger-codegen-maven-plugin
https://github.com/swagger-api/swagger-codegen/tree/3.0.0/modules/swagger-codegen-maven-plugin/examples
https://github.com/open-metadata/OpenMetadata/blob/main/openmetadata-clients/openmetadata-java-client/pom.xml

posted on   荣锋亮  阅读(188)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2020-10-05 drill 学习 九 drill性能优化-Metastore
2020-10-05 apache iceberg 用于分析庞大数据集的开放格式
2020-10-05 drill 学习 八 drill information schema
2020-10-05 drill 学习 五 配置说明- 多租户
2019-10-05 cloudevents 通用event 描述指南
2017-10-05 fn project 试用之后的几个问题的解答
2017-10-05 fn project 扩展

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示