Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: pacedotdev/oto
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.10.3
Choose a base ref
...
head repository: pacedotdev/oto
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.10.4
Choose a head ref
  • 11 commits
  • 4 files changed
  • 4 contributors

Commits on Aug 31, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    343c8f7 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    efd392a View commit details

Commits on Sep 1, 2020

  1. Copy the full SHA
    7a28f2f View commit details

Commits on Sep 2, 2020

  1. added example to Error

    matryer committed Sep 2, 2020
    Copy the full SHA
    6574ab7 View commit details
  2. Copy the full SHA
    3d4d19d View commit details
  3. fixed Example

    matryer committed Sep 2, 2020
    Copy the full SHA
    df5a36e View commit details

Commits on Sep 21, 2020

  1. Copy the full SHA
    31092cc View commit details
  2. Copy the full SHA
    faf6e45 View commit details

Commits on Sep 22, 2020

  1. Copy the full SHA
    17b1cc6 View commit details

Commits on Sep 23, 2020

  1. Merge pull request #22 from jhuggart/patch-1

    Fix typo in code gen step of Tutorial
    dahernan authored Sep 23, 2020
    Copy the full SHA
    86823ca View commit details
  2. Copy the full SHA
    eb64133 View commit details
Showing with 9 additions and 12 deletions.
  1. +4 −4 README.md
  2. +0 −7 otohttp/templates/client.go.plush
  3. +1 −1 otohttp/templates/client.ts.plush
  4. +4 −0 parser/parser.go
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -63,15 +63,15 @@ Use the `oto` tool to generate a client and server:
```bash
mkdir generated
oto -template ./templates/server.go.plush \
-out ./oto.gen.go \
-out ./generated/oto.gen.go \
-ignore Ignorer \
-pkg generated \
./definition
./definitions
gofmt -w ./oto.gen.go ./oto.gen.go
oto -template ./templates/client.js.plush \
-out ./oto.gen.js \
-out ./generated/oto.gen.js \
-ignore Ignorer \
./definition
./definitions
```

- Run `oto -help` for more information about these flags
7 changes: 0 additions & 7 deletions otohttp/templates/client.go.plush
Original file line number Diff line number Diff line change
@@ -6,9 +6,6 @@ import (
"bytes"
"compress/gzip"
"context"
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"encoding/json"
"io"
"io/ioutil"
@@ -61,10 +58,6 @@ func New<%= service.Name %>(client *Client) *<%= service.Name %> {
if err != nil {
return nil, errors.Wrap(err, "<%= service.Name %>.<%= method.Name %>: marshal <%= method.InputObject.TypeName %>")
}
signature, err := generateSignature(requestBodyBytes, s.client.secret)
if err != nil {
return nil, errors.Wrap(err, "<%= service.Name %>.<%= method.Name %>: generate signature <%= method.InputObject.TypeName %>")
}
url := s.client.RemoteHost + "<%= service.Name %>.<%= method.Name %>"
s.client.Debug(fmt.Sprintf("POST %s", url))
s.client.Debug(fmt.Sprintf(">> %s", string(requestBodyBytes)))
2 changes: 1 addition & 1 deletion otohttp/templates/client.ts.plush
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ export class Client {
public basepath: String = '/oto/'
// headers allows calling code to mutate the HTTP
// headers of the underlying HTTP requests.
public headers: HeadersFunc
public headers?: HeadersFunc
}

<%= for (service) in def.Services { %>
4 changes: 4 additions & 0 deletions parser/parser.go
Original file line number Diff line number Diff line change
@@ -287,6 +287,7 @@ func (p *Parser) parseObject(pkg *packages.Package, o types.Object, v *types.Str
return p.wrapErr(errors.New(obj.Name+" must be a struct"), pkg, o.Pos())
}
obj.TypeID = o.Pkg().Path() + "." + obj.Name
obj.Fields = []Field{}
for i := 0; i < st.NumFields(); i++ {
field, err := p.parseField(pkg, obj.Name, st.Field(i))
if err != nil {
@@ -324,6 +325,7 @@ func (p *Parser) parseField(pkg *packages.Package, objectName string, v *types.V
f.Name = v.Name()
f.NameLowerCamel = camelizeDown(f.Name)
f.Comment = p.commentForField(objectName, f.Name)
f.Metadata = map[string]interface{}{}
if !v.Exported() {
return f, p.wrapErr(errors.New(f.Name+" must be exported"), pkg, v.Pos())
}
@@ -408,6 +410,8 @@ func (p *Parser) addOutputFields() error {
TypeName: "string",
JSType: "string",
},
Metadata: map[string]interface{}{},
Example: "something went wrong",
}
for typeName := range p.outputObjects {
obj, err := p.def.Object(typeName)