Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions .github/workflows/create-releases.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/handle-release-pr-title-edit.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.0.1-alpha.0"
".": "0.1.0-alpha.1"
}
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Changelog

## 0.1.0-alpha.1 (2024-11-12)

Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/brevdev/nvcf-go/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)

### Features

* **api:** api update ([c1759d5](https://github.com/brevdev/nvcf-go/commit/c1759d5dbeecd97f1899f7db70dd1371caf27478))


### Chores

* rebuild project due to codegen change ([#6](https://github.com/brevdev/nvcf-go/issues/6)) ([0d526fb](https://github.com/brevdev/nvcf-go/commit/0d526fb56665783025c14ea0a21a4e461fdf379c))
* rebuild project due to codegen change ([#7](https://github.com/brevdev/nvcf-go/issues/7)) ([b1eb526](https://github.com/brevdev/nvcf-go/commit/b1eb526234b098ea6633874aa8a12a05d46bfeab))
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/brevdev/nvcf-go@v0.0.1-alpha.0'
go get -u 'github.com/brevdev/nvcf-go@v0.1.0-alpha.1'
```

<!-- x-release-please-end -->
Expand Down
13 changes: 10 additions & 3 deletions internal/apijson/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"reflect"
"sort"
"strconv"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -342,16 +343,18 @@ func (e *encoder) encodeMapEntries(json []byte, v reflect.Value) ([]byte, error)

iter := v.MapRange()
for iter.Next() {
var encodedKey []byte
var encodedKeyString string
if iter.Key().Type().Kind() == reflect.String {
encodedKey = []byte(iter.Key().String())
encodedKeyString = iter.Key().String()
} else {
var err error
encodedKey, err = keyEncoder(iter.Key())
encodedKeyBytes, err := keyEncoder(iter.Key())
if err != nil {
return nil, err
}
encodedKeyString = string(encodedKeyBytes)
}
encodedKey := []byte(sjsonReplacer.Replace(encodedKeyString))
pairs = append(pairs, mapPair{key: encodedKey, value: iter.Value()})
}

Expand Down Expand Up @@ -389,3 +392,7 @@ func (e *encoder) newMapEncoder(t reflect.Type) encoderFunc {
return json, nil
}
}

// If we want to set a literal key value into JSON using sjson, we need to make sure it doesn't have
// special characters that sjson interprets as a path.
var sjsonReplacer *strings.Replacer = strings.NewReplacer(".", "\\.", ":", "\\:", "*", "\\*")
5 changes: 3 additions & 2 deletions internal/apijson/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,9 @@ var tests = map[string]struct {
"date_time_missing_timezone_colon_coerce": {`"2007-03-01T13:03:05-1200"`, time.Date(2007, time.March, 1, 13, 3, 5, 0, time.FixedZone("", -12*60*60))},
"date_time_nano_missing_t_coerce": {`"2007-03-01 13:03:05.123456789Z"`, time.Date(2007, time.March, 1, 13, 3, 5, 123456789, time.UTC)},

"map_string": {`{"foo":"bar"}`, map[string]string{"foo": "bar"}},
"map_interface": {`{"a":1,"b":"str","c":false}`, map[string]interface{}{"a": float64(1), "b": "str", "c": false}},
"map_string": {`{"foo":"bar"}`, map[string]string{"foo": "bar"}},
"map_string_with_sjson_path_chars": {`{":a.b.c*:d*-1e.f":"bar"}`, map[string]string{":a.b.c*:d*-1e.f": "bar"}},
"map_interface": {`{"a":1,"b":"str","c":false}`, map[string]interface{}{"a": float64(1), "b": "str", "c": false}},

"primitive_struct": {
`{"a":false,"b":237628372683,"c":654,"d":9999.43,"e":43.76,"f":[1,2,3,4]}`,
Expand Down
4 changes: 4 additions & 0 deletions internal/requestconfig/requestconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,10 @@ func retryDelay(res *http.Response, retryCount int) time.Duration {
}

func (cfg *RequestConfig) Execute() (err error) {
if cfg.BaseURL == nil {
return fmt.Errorf("requestconfig: base url is not set")
}

cfg.Request.URL, err = cfg.BaseURL.Parse(strings.TrimLeft(cfg.Request.URL.String(), "/"))
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion internal/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

package internal

const PackageVersion = "0.0.1-alpha.0" // x-release-please-version
const PackageVersion = "0.1.0-alpha.1" // x-release-please-version