Comments (2)
I had a quick chat with @phiesel about this topic.
Patrick was mentioned in the ESC minutes to be the person to look at the topic.
He said (quote):
we won't move to Swagger etc. any time soon because it fails the const/benefit tradeoff. Gerrit as you might know allows plugins to also expose REST APIs and it's not trivial to support this in exactly the same way with Swagger.
We will likely move our entity definitions to Protobuf so that callers can reuse the object definitions. All that's left to do then is use a proto2json mapper (those are widely available) and call the URLs. Surely, service definitions would be way nice than calling URLs with an HTTP framework, but it's hard to make the Gerrit server work with Swagger, etc.
[...]
Proto files will be open-source, so you can compile them into your binary in your language of choice.
What does this mean for us + this project right now?
I suggest we document the current status in the README + that we keep an eye on future Gerrit versions to add support for Protobuf.
from go-gerrit.
A quick/dirty idea:
Gerrits documentation is written in asciidoc: https://gerrit.googlesource.com/gerrit/+/refs/heads/master/Documentation/
The endpoints and content types are (more or less)unified.
Similar to go-github (https://github.com/google/go-github/blob/master/github/gen-accessors.go), we can create a go generate
script that
- Checks if we have implemented all endpoints
- Verified we have all fields inside the Content-type structs
It won't be a good generate script, but more a "there is something missing" script.
Additionally, the documentation don't cover the types of the struct members.
github.com/bytesparadise/libasciidoc could be a library to parse the asciidoc on this.
Maybe the whole thing is a bit over-engineered.
However, it would keep us up to date with changes in gerrit as well (as long as they are documented in asciidoc).
Just posting this piece of code here for the future me to not start 100% from scratch:
package main
import (
"fmt"
"os"
"github.com/bytesparadise/libasciidoc/pkg/configuration"
"github.com/bytesparadise/libasciidoc/pkg/parser"
"github.com/bytesparadise/libasciidoc/pkg/types"
)
func main() {
filePath := "/Users/agrunwald/Development/gerrit/Documentation/rest-api-groups.txt"
file, err := os.Open(filePath)
if err != nil {
panic(err)
}
defer file.Close()
config := configuration.Configuration{}
doc, err := parser.ParseDocument(file, config)
if err != nil {
panic(err)
}
for _, v := range doc.Elements {
t := v.(types.Section)
for _, sect := range t.Title {
fmt.Print("%+v", sect)
}
}
}
from go-gerrit.
Related Issues (20)
- Update CHANGELOG.md
- Craft a new release HOT 2
- Where to get the revisionID for the GetComment API ? HOT 2
- Projects.SetConfig endpoint fails with 400 Bad Request due to ConfigInput.MaxObjectSizeLimit zero value not being omitted HOT 5
- Contexts HOT 1
- Can't get the library working for repo names containing slashes HOT 1
- `ProjectBaseOptions` improper uri tag for `Skip` field
- API-Methods: Return map/slice directly, rather than a pointer to one
- Proposal: Use Timestamp type for all time fields. HOT 3
- Simpler fix for credentials with characters such as '/'. HOT 2
- Optimize Error-Handling-Code of read body
- Only 500 changes are being pulled HOT 8
- labels should not be pre-escaped HOT 3
- All DELETE api calls returns error 400 (Bad request) HOT 5
- Function DeleteDraftChange should be renamed as DeleteChange HOT 1
- Hello? <crickets> HOT 6
- SetReview support for --project option HOT 2
- Error in Projects.CreateProject: PUT a/projects/{name} invalid JSON in request HOT 6
- Add support for context package HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-gerrit.