qingstor / snips Goto Github PK
View Code? Open in Web Editor NEWA code generator for RESTful APIs.
License: Apache License 2.0
A code generator for RESTful APIs.
License: Apache License 2.0
/home/xuanwo/Code/go/src/github.com/yunify/qingcloud-sdk-go/service/types.go:410:2: struct field GlobalUuid should be GlobalUUID
Could you please help update readme accordingly?
a few parameters are deprecated. e.g. --service
But I still found these params in sample section
Thanks!
snips version 0.2.3
之前的 qingcloud-sdk-go 是基于 snips 0.0.9 版本生成.
snips 0.2 之后模板的结构有发生变化.
针对生成代码时产生的问题, 对 qingcloud-sdk-go 的模板文件做了更新.
qingcloud-sdk-go/template/shared.tmpl 的更新 (137-248行):
type {{$opID}}Output struct {
Message *string `json:"message" name:"message"`
- {{- if $operation.Response.Elements.Properties | len -}}
- {{$data := $operation.Response.Elements}}
- {{template "RenderProperties" passThrough $data `location:"elements"`}}
+ {{- range $keyStatus, $valueStatus := $operation.Responses -}}
+ {{- if $valueStatus.Elements.Properties | len -}}
+ {{$data := $valueStatus.Elements}}
+ {{template "RenderProperties" passThrough $data `location:"elements"`}}
+ {{- end -}}
+
{{- end -}}
}
{{end}}
上面的修改修复了 snips 生成代码时的错误提升.
导致输出的文件发生变化. 下面是 service/cache.go 发生的变化的片段(74-82行):
type AddCacheNodesInput struct {
- Cache *string `json:"cache" name:"cache" location:"params"` // Required
- NodeCount *int `json:"node_count" name:"node_count" location:"params"` // Required
- PrivateIPs []*CachePrivateIP `json:"private_ips" name:"private_ips" location:"params"`
+ Cache *string `json:"cache" name:"cache" location:"params"` // Required
+ NodeCount *int `json:"node_count" name:"node_count" location:"params"` // Required
+ PrivateIPs []interface{} `json:"private_ips" name:"private_ips" location:"params"`
}
其中 PrivateIPs 的类型退化为 []interface{}
命令参数:
snips -f /Users/chai/go/src/github.com/yunify/qingcloud-api-specs/2013-08-30/swagger/api_v2.0.json -t /Users/chai/go/src/github.com/yunify/qingcloud-sdk-go/template -o ./qingcloud-sdk-go
Loaded templates from /Users/chai/go/src/github.com/yunify/qingcloud-sdk-go/template
4 template(s) detected.
Loaded specification file /Users/chai/go/src/github.com/yunify/qingcloud-api-specs/2013-08-30/swagger/api_v2.0.json (Swagger-v2.0)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.