Another 4 months and another goa release! goa v1.3.0
is out! This version includes new features and a slew of bug fixes. Thank you to all the contributors that spent a lot of time writing (and sometimes re-writing) the code, the tests and the docs. The list below highlights the main contributions.
New Features
10x Code generation speed improvement on Windows
Klaus Post identified an issue where goagen was re-opening the generated files too often. Opening the files only once during code generation resulted in a 10x speed increase on Windows!
#1330 — Klaus Post + Raphael Simon
Custom error merge algorithm
Bryce Reitano introduced a new interface that error structs returned by error classes may implement to control how errors are merged before being rendered into HTTP responses. This makes it possible to control the error response bodies more effectively.
#1321 — Bryce Reitano
Hash key and value validations
@ikawaha added support for Hash key and value validations to the DSL. Example usage:
var _ = Resource("resource", func() {
Action("action", func() {
Routing(POST(""))
Payload(func() {
Member("hash", HashOf(String, Integer,
func() { Pattern("[a-zA-Z]+") }, // Validates keys
func() { Enum(12, 3, 4, 5, 6) }, // Validates values
))
})
})
})
#1298 — @ikawaha
Support for http.FileSystem in file servers
Taichi Sasaki added the ability to use http.FileSystem when defining file servers. This makes it possible to use assetfs
to serve data defined in memory, for example:
ctrl.FileSystem = func(dir string) http.FileSystem {
return &assetfs.AssetFS{
Asset: Asset,
AssetDir: AssetDir,
AssetInfo: AssetInfo,
Prefix: dir,
}
}
#1297 — Taichi Sasaki
New –regen flag for bootstrap and main command
Ian McCracken added the ability to re-generate the code for controllers and the main file taking advantage of the fence comments to capture user code and write it back. See the Scaffolding section of the website for more information.
#1246 — Ian McCracken
RFC1123 time format support
Taichi Sasaki also added support for the RFC1123 time format when defining validations. This makes it possible to automatically validate the format of If-Modified-Since
and other standard headers with date time values.
#1248 — Taichi Sasaki
Collection Media Type Identifier
Another contribution from Taichi Sasaki makes it possible to specify the media type identifier for collection media types overriding the default computed by goa.
#1232 — Taichi Sasaki
Bug Fixes
As noted in the introduction this release comes with many bug fixes as well:
- The Swagger “Produces” section order is now consistent across re-generations. #1239 — Jim Slattery
- Header values are now retrieved properly in generated test helpers. #1244 — Brian Lockwood + Raphael Simon
- Fix use of
Reference
for object types. #1257 - Alex Brausewetter + Raphael Simon - Path parameters using
Array
data types are now parsed correctly. #1262 - @kmacmcfarlane + Raphael Simon - Multiple required header validations can now be correctly specified. #1258 — @AmandaLou + Raphael Simon
- The connection to the AWS X-Ray daemon is periodically retried in case of problem. #1265 — Jim Slattery
- Fix handling of parent resources during code generation. #1282 — Stefan Fuchs
- Trailing slashes in routes are now preserved correctly. #1292 — Michael Bohn
- Query string parameters defined using
Array
data types are now parsed correctly. #1295 - @kmacmcfarlane + Raphael Simon - Fix handling of flags in various goagen commands. #1311 — Lawrence Horwitz
- Examples for UUID data types are now properly generated. #1314 — @dtrehas + Raphael Simon
- Swagger examples for collection media types with custom views are now generated using the correct view. #1316 — Martin Kováčik + Raphael Simon
- The generated methods for responses defined in parent resources is now correct. #1318 — Stefan Fuchs + Raphael Simon
- The logging and capture of the default response status code (200) is now done correctly. #1326 — Juraj Sottnik
- Large integers in validations are now rendered correctly in the validation code. #1336 — Klaus Post + Raphael Simon
- Default values for Numbers that are integers are now rendered correctly in the generated code. #1344 — Klaus Post + Raphael Simon
- Fix potential infinite recursion with Inherit. #1346 — Klaus Post + Raphael Simon
- The client for X-Ray tracing now correctly reports segments and sub-segments. #1350 #1354 — Jim Slattery
- Updated goa to the latest go-metrics. — Raphael Simon
Update: goa v2 coming soon!
The initial development for goa v2 is nearing completion. If you are interested in trying out the latest and greatest then install it with:
go get goa.design/goa/...
and give it a shot:
# Generate code for goa v2 "cellar" example
cd $GOPATH/src
mkdir cellar; cd cellar
goa gen goa.design/goa/examples/cellar/design# Generate default server and client tool main
goa example goa.design/goa/examples/cellar/design# Build and run default server
cd cmd/cellarsvc; go build; ./cellarsvc
in a different terminal:
# Build and use default client tool
cd $GOPATH/src/cellar/cmd/cellarcli
go build; ./cellarcli --help
./cellarcli -verbose storage list
Consult the README for more information and join the slack channel (sign up) to ask questions and provide feedback!