You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We want to remove this dependency by default, while still providing support to users who want to use easyjson.
* fixes#68
This PR introduces an adapter to use ReadJSON and WriteJSON with
different supporting libraries. By default only the standard library
is enabled. A simple runtime registration allows the adapter to
support easyjson.
When import swag or swag/jsonutils or swag/yamlutils, easyjson is no longer a dependency:
JSON serialization only requires the standard library.
Supporting easyjson interfaces (e.g. for faster serialization) remains possible, by calling an independent module: swag/jsonutils/adapters/easyjson/json.Register().
1. ordered map w/stdlib
2. registry with stdlib as default
3. fixed int vs float64 rendering
4. beefed up tests, including integration tests
5. honed doc
6. more tests
TODO:
* [x] hone test coverage
* benchmarks
* profiling
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Copy file name to clipboardExpand all lines: README.md
+78-70Lines changed: 78 additions & 70 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,91 +9,93 @@ Package `swag` contains a bunch of helper functions for go-openapi and go-swagge
9
9
10
10
You may also use it standalone for your projects.
11
11
12
+
> **NOTE**
12
13
> `swag` is one of the foundational building blocks of the go-openapi initiative.
13
-
>
14
14
> Most repositories in `github.com/go-openapi/...` depend on it in some way.
15
-
> So does the CLI tool `github.com/go-swagger/go-swagger`,
16
-
> and the code generated by this tool.
17
-
18
-
## Contents
19
-
20
-
`go-openapi/swag` now exposes a collection of relatively independent modules.
21
-
22
-
Here is what is inside:
23
-
24
-
* Module `cmdutils`
25
-
26
-
*[x] utilities to work with CLIs
27
-
28
-
* Module `conv`
15
+
> And so does our CLI tool `github.com/go-swagger/go-swagger`,
16
+
> as well as the code generated by this tool.
29
17
30
-
*[x] convert between values and pointers for any types
31
-
*[x] convert from string to builtin types (wraps `strconv`)
32
-
*[x] require `./typeutils` (test dependency)
18
+
*[Contents](#contents)
19
+
*[Dependencies](#dependencies)
20
+
*[Release Notes](#release-notes)
21
+
*[Note to contributors](#note-to-contributors)
22
+
*[TODOs, suggestions and plans](#todos-suggestions-and-plans)
33
23
34
-
* Module `fileutils`
35
-
36
-
*[x] file upload type
37
-
*[x] search in path (deprecated)
38
-
39
-
* Module `jsonname`
40
-
41
-
*[x] infer JSON names from go properties
42
-
43
-
* Module `jsonutils`
24
+
## Contents
44
25
45
-
*[x] fast json concatenation
46
-
*[x] read and write JSON from and to dynamic go data structures
47
-
*[x] require `github.com/mailru/easyjson`
26
+
`go-openapi/swag` exposes a collection of relatively independent modules.
48
27
49
-
* Module `loading`
28
+
Moving forward, no additional feature will be added to the `swag` API directly at the root package level,
29
+
which remains there for backward-compatibility purposes. All exported top-level features are now deprecated.
50
30
51
-
*[x] load from file or http
52
-
*[x] require `./yamlutils`
31
+
Child modules will continue to evolve or some new ones may be added in the future.
53
32
54
-
* Module `mangling`
33
+
| Module | Content | Main features |
34
+
|---------------|---------|---------------|
35
+
|`cmdutils`| utilities to work with CLIs ||
36
+
|`conv`| type conversion utilities | convert between values and pointers for any types<br />convert from string to builtin types (wraps `strconv`)<br />require `./typeutils` (test dependency)<br /> |
|`jsonutils`| JSON utilities | fast json concatenation<br />read and write JSON from and to dynamic `go` data structures<br />~require `github.com/mailru/easyjson`~<br /> |
40
+
|`loading`| file loading | load from file or http<br />require `./yamlutils`<br /> |
41
+
|`mangling`| safe name generation | name mangling for `go`<br /> |
42
+
|`netutils`| networking utilities | host, port from address<br /> |
43
+
|`stringutils`|`string` utilities | search in slice (with case-insensitive)<br />split/join query parameters as arrays<br /> |
44
+
|`typeutils`|`go` types utilities | check the zero value for any type<br />safe check for a nil value<br /> |
45
+
|`yamlutils`| YAML utilities | converting YAML to JSON<br />loading YAML into a dynamic YAML document<br />maintaining the original order of keys in YAML objects<br />require `./jsonutils`<br />~require `github.com/mailru/easyjson`~<br />require `gopkg.in/yaml.v3`<br /> |
55
46
56
-
*[x] name mangling for go
47
+
---
57
48
58
-
* Module `netutils`
49
+
## Dependencies
59
50
60
-
*[x] host, port from address
51
+
The root module `github.com/go-openapi/swag` at the repo level maintains a few
52
+
dependencies outside of the standard library.
61
53
62
-
* Module `stringutils`
54
+
* YAML utilities depend on `gopkg.in/yaml.v3`
55
+
* JSON utilities depend on their registered adapter module:
56
+
* by default, only the standard library is used
57
+
*`github.com/mailru/easyjson` is now only a dependency for module
0 commit comments