使用 openapi-generator-cli 生成代码,以 3GPP TS29518_Namf_Communication 为例

使用 openapi-generator-cli 生成代码,以 3GPP TS29518_Namf_Communication 为例

安装 openapi-generator-cli (前提有安装Java 11 以上)

# 使用阿里云镜像
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://maven.aliyun.com/repository/public/org/openapitools/openapi-generator-cli/7.9.0/openapi-generator-cli-7.9.0.jar

生成客户端代码

java -jar .\openapi-generator-cli.jar  generate --skip-validate-spec -g go  --config demo-client-config-29518.yaml  -i 5GC_APIs-Rel-18\5GC_APIs-Rel-18\TS29518_Namf_Communication.yaml -o  TS29518_Namf_Communication_Client
# demo-client-config-29518.yaml
disallowAdditionalPropertiesIfNotPresent: "true"
enumClassPrefix: "true"
generateInterfaces: "true"
generateMarshalJSON: "true"
hideGenerationTimestamp: "false"
isGoSubmodule: "true"
packageName: "XXXXXX"
packageVersion: "v10.0.0"
prependFormOrBodyParameters: "true"
structPrefix: "true"
useOneOfDiscriminatorLookup: "false"
withAWSV4Signature: "false"
withGoMod: "true"
withXml: "true"

生成服务端代码

java -jar .\openapi-generator-cli.jar  generate --skip-validate-spec -g go-gin-server  --config demo-server-config-29518.yml  -i 5GC_APIs-Rel-18\5GC_APIs-Rel-18\TS29518_Namf_Communication.yaml -o  TS29518_Namf_Communication_Server
# demo-server-config-29518.yml
apiPath : "XXXXXXX"
enumClassPrefix : false
hideGenerationTimestamp : false
packageName : "XXXXXX"
packageVersion : "v1.0.0"
serverPort : "8080"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值