mirror of
https://github.com/davidebianchi/gswagger.git
synced 2025-12-23 23:38:43 -05:00
Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef1ac5fd7e | ||
|
|
fc597bec00 | ||
|
|
eb3c4d9c98 | ||
|
|
3563d41c0f | ||
|
|
1802f29ad3 | ||
|
|
56651d1029 | ||
|
|
91f50dd0e4 | ||
|
|
a98a205453 | ||
|
|
3720da7606 | ||
|
|
fb94293412 | ||
|
|
d1f6294d95 | ||
|
|
a828758065 | ||
|
|
09e3bd484e | ||
|
|
617c44900c | ||
|
|
1cd88c70bb | ||
|
|
d3bbc528ac | ||
|
|
91c15b79b1 | ||
|
|
bd884cb1de | ||
|
|
b776ccf233 | ||
|
|
0d75c2cb5e | ||
|
|
2354daa4a9 | ||
|
|
8d05c61745 | ||
|
|
9a6b0b9b16 | ||
|
|
dd94c5cd25 | ||
|
|
8047e54eac | ||
|
|
e6adc34cee | ||
|
|
2b87521135 | ||
|
|
d095403a23 | ||
|
|
526265eda9 | ||
|
|
88bbf2f41c | ||
|
|
6a1bd1cd19 | ||
|
|
c44efeed6e | ||
|
|
4b06c26421 | ||
|
|
7a48480545 | ||
|
|
bbc469d26d | ||
|
|
be8a1de244 | ||
|
|
39f8f916d1 | ||
|
|
9fac1c3a4f | ||
|
|
d5e740ecac | ||
|
|
5f24f99c89 | ||
|
|
19e6e6e888 | ||
|
|
449ee873f8 | ||
|
|
8d08ab4e88 | ||
|
|
e4154d1870 |
15
.github/workflows/test-builds.yml
vendored
15
.github/workflows/test-builds.yml
vendored
@@ -9,10 +9,10 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go_version: [1.18, 1.19]
|
||||
go_version: ['1.24', '1.25']
|
||||
os: [ubuntu-latest]
|
||||
include:
|
||||
- go_version: 1.19
|
||||
- go_version: '1.25'
|
||||
os: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
@@ -37,3 +37,14 @@ jobs:
|
||||
uses: shogo82148/actions-goveralls@v1
|
||||
with:
|
||||
path-to-profile: cover.out
|
||||
flag-name: Go-${{ matrix.go_version }}
|
||||
parallel: true
|
||||
|
||||
post-tests:
|
||||
runs-on: ubuntu-latest
|
||||
needs: tests
|
||||
steps:
|
||||
- name: Close coverage report
|
||||
uses: shogo82148/actions-goveralls@v1
|
||||
with:
|
||||
parallel-finished: true
|
||||
|
||||
16
CHANGELOG.md
16
CHANGELOG.md
@@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## Unreleased
|
||||
|
||||
## 0.10.1 - 06-10-2025
|
||||
|
||||
### Refactor
|
||||
|
||||
- renamed swagger to openapi in error messages
|
||||
|
||||
## 0.10.0 - 28-02-2024
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
- remove support to golang 1.19
|
||||
|
||||
### Updated
|
||||
|
||||
- change jsonschema lib to use again `invopop/jsonschema` one, since now it support additionalProperties instead of patternProperties
|
||||
|
||||
## 0.9.0 - 17-04-2023
|
||||
|
||||
### Added
|
||||
|
||||
@@ -25,6 +25,14 @@ To convert struct to schemas, we use [jsonschema] library.
|
||||
The struct must contains the appropriate struct tags to be inserted in json schema to generate the schema dynamically.
|
||||
It is always possible to add a totally custom swagger schema using [kin-openapi].
|
||||
|
||||
## Install
|
||||
|
||||
To use it, install with
|
||||
|
||||
```sh
|
||||
go get github.com/davidebianchi/gswagger
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
An example usage of this lib with gorilla mux:
|
||||
|
||||
54
go.mod
54
go.mod
@@ -1,49 +1,47 @@
|
||||
module github.com/davidebianchi/gswagger
|
||||
|
||||
go 1.19
|
||||
go 1.24
|
||||
|
||||
require (
|
||||
github.com/getkin/kin-openapi v0.115.0
|
||||
github.com/getkin/kin-openapi v0.131.0
|
||||
github.com/ghodss/yaml v1.0.0
|
||||
github.com/go-openapi/swag v0.21.1 // indirect
|
||||
github.com/gorilla/mux v1.8.0
|
||||
github.com/iancoleman/orderedmap v0.2.0 // indirect
|
||||
github.com/labstack/echo/v4 v4.10.2
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mia-platform/jsonschema v0.1.0
|
||||
github.com/stretchr/testify v1.8.2
|
||||
github.com/gofiber/fiber/v2 v2.52.5
|
||||
github.com/gorilla/mux v1.8.1
|
||||
github.com/invopop/jsonschema v0.12.0
|
||||
github.com/labstack/echo/v4 v4.12.0
|
||||
github.com/stretchr/testify v1.9.0
|
||||
)
|
||||
|
||||
require github.com/gofiber/fiber/v2 v2.44.0
|
||||
|
||||
require (
|
||||
github.com/andybalholm/brotli v1.0.5 // indirect
|
||||
github.com/bahlo/generic-list-go v0.2.0 // indirect
|
||||
github.com/buger/jsonparser v1.1.1 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/invopop/yaml v0.2.0 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/google/uuid v1.5.0 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/klauspost/compress v1.16.3 // indirect
|
||||
github.com/labstack/gommon v0.4.0 // indirect
|
||||
github.com/klauspost/compress v1.17.0 // indirect
|
||||
github.com/labstack/gommon v0.4.2 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.18 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.15 // indirect
|
||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
|
||||
github.com/perimeterx/marshmallow v1.1.4 // indirect
|
||||
github.com/philhofer/fwd v1.1.2 // indirect
|
||||
github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 // indirect
|
||||
github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 // indirect
|
||||
github.com/perimeterx/marshmallow v1.1.5 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/rivo/uniseg v0.2.0 // indirect
|
||||
github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94 // indirect
|
||||
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee // indirect
|
||||
github.com/tinylib/msgp v1.1.8 // indirect
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
github.com/valyala/fasthttp v1.45.0 // indirect
|
||||
github.com/valyala/fasthttp v1.51.0 // indirect
|
||||
github.com/valyala/fasttemplate v1.2.2 // indirect
|
||||
github.com/valyala/tcplisten v1.0.0 // indirect
|
||||
golang.org/x/crypto v0.7.0 // indirect
|
||||
golang.org/x/net v0.8.0 // indirect
|
||||
golang.org/x/sys v0.7.0 // indirect
|
||||
golang.org/x/text v0.8.0 // indirect
|
||||
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
|
||||
golang.org/x/crypto v0.22.0 // indirect
|
||||
golang.org/x/net v0.24.0 // indirect
|
||||
golang.org/x/sys v0.19.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
188
go.sum
188
go.sum
@@ -1,172 +1,92 @@
|
||||
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
|
||||
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
|
||||
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
|
||||
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
|
||||
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/getkin/kin-openapi v0.115.0 h1:c8WHRLVY3G8m9jQTy0/DnIuljgRwTCB5twZytQS4JyU=
|
||||
github.com/getkin/kin-openapi v0.115.0/go.mod h1:l5e9PaFUo9fyLJCPGQeXI2ML8c3P8BHOEV2VaAVf/pc=
|
||||
github.com/getkin/kin-openapi v0.131.0 h1:NO2UeHnFKRYhZ8wg6Nyh5Cq7dHk4suQQr72a4pMrDxE=
|
||||
github.com/getkin/kin-openapi v0.131.0/go.mod h1:3OlG51PCYNsPByuiMB0t4fjnNlIDnaEDsjiKUV8nL58=
|
||||
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY=
|
||||
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
||||
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
||||
github.com/go-openapi/swag v0.21.1 h1:wm0rhTb5z7qpJRHBdPOMuY4QjVUMbF6/kwoYeRAOrKU=
|
||||
github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
|
||||
github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ=
|
||||
github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY=
|
||||
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
|
||||
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
|
||||
github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM=
|
||||
github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
|
||||
github.com/gofiber/fiber/v2 v2.44.0 h1:Z90bEvPcJM5GFJnu1py0E1ojoerkyew3iiNJ78MQCM8=
|
||||
github.com/gofiber/fiber/v2 v2.44.0/go.mod h1:VTMtb/au8g01iqvHyaCzftuM/xmZgKOZCtFzz6CdV9w=
|
||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
|
||||
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
|
||||
github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0/go.mod h1:N0Wam8K1arqPXNWjMo21EXnBPOPp36vB07FNRdD2geA=
|
||||
github.com/iancoleman/orderedmap v0.2.0 h1:sq1N/TFpYH++aViPcaKjys3bDClUEU7s5B+z6jq8pNA=
|
||||
github.com/iancoleman/orderedmap v0.2.0/go.mod h1:N0Wam8K1arqPXNWjMo21EXnBPOPp36vB07FNRdD2geA=
|
||||
github.com/invopop/yaml v0.1.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q=
|
||||
github.com/invopop/yaml v0.2.0 h1:7zky/qH+O0DwAyoobXUqvVBwgBFRxKoQ/3FjcVpjTMY=
|
||||
github.com/invopop/yaml v0.2.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q=
|
||||
github.com/gofiber/fiber/v2 v2.52.5 h1:tWoP1MJQjGEe4GB5TUGOi7P2E0ZMMRx5ZTG4rT+yGMo=
|
||||
github.com/gofiber/fiber/v2 v2.52.5/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ=
|
||||
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
|
||||
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
||||
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
|
||||
github.com/invopop/jsonschema v0.12.0 h1:6ovsNSuvn9wEQVOyc72aycBMVQFKz7cPdMJn10CvzRI=
|
||||
github.com/invopop/jsonschema v0.12.0/go.mod h1:ffZ5Km5SWWRAIN6wbDXItl95euhFz2uON45H2qjYt+0=
|
||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
||||
github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY=
|
||||
github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM=
|
||||
github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/labstack/echo/v4 v4.10.2 h1:n1jAhnq/elIFTHr1EYpiYtyKgx4RW9ccVgkqByZaN2M=
|
||||
github.com/labstack/echo/v4 v4.10.2/go.mod h1:OEyqf2//K1DFdE57vw2DRgWY0M7s65IVQO2FzvI4J5k=
|
||||
github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8=
|
||||
github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM=
|
||||
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
||||
github.com/labstack/echo/v4 v4.12.0 h1:IKpw49IMryVB2p1a4dzwlhP1O2Tf2E0Ir/450lH+kI0=
|
||||
github.com/labstack/echo/v4 v4.12.0/go.mod h1:UP9Cr2DJXbOK3Kr9ONYzNowSh7HP0aG0ShAyycHSJvM=
|
||||
github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
|
||||
github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
|
||||
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
|
||||
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
||||
github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98=
|
||||
github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
|
||||
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/mia-platform/jsonschema v0.1.0 h1:tjQf7TaYROsAqk7SXTL+44TrfKk3bSEvhRGPS51IA5Y=
|
||||
github.com/mia-platform/jsonschema v0.1.0/go.mod h1:r2DJjPA/+6S+WPnXZt1xONMvO2b4hlhfXfUYV0po/Dk=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
|
||||
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
|
||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/perimeterx/marshmallow v1.1.4 h1:pZLDH9RjlLGGorbXhcaQLhfuV0pFMNfPO55FuFkxqLw=
|
||||
github.com/perimeterx/marshmallow v1.1.4/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw=
|
||||
github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
|
||||
github.com/philhofer/fwd v1.1.2 h1:bnDivRJ1EWPjUIRXV5KfORO897HTbpFAQddBdE8t7Gw=
|
||||
github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2tUTP0=
|
||||
github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 h1:G7ERwszslrBzRxj//JalHPu/3yz+De2J+4aLtSRlHiY=
|
||||
github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037/go.mod h1:2bpvgLBZEtENV5scfDFEtB/5+1M4hkQhDQrccEJ/qGw=
|
||||
github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 h1:bQx3WeLcUWy+RletIKwUIt4x3t8n2SxavmoclizMb8c=
|
||||
github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90/go.mod h1:y5+oSEHCPT/DGrS++Wc/479ERge0zTFxaF8PbGKcg2o=
|
||||
github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s=
|
||||
github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94 h1:rmMl4fXJhKMNWl+K+r/fq4FbbKI+Ia2m9hYBLm2h4G4=
|
||||
github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94/go.mod h1:90zrgN3D/WJsDd1iXHT96alCoN2KJo6/4x1DZC3wZs8=
|
||||
github.com/savsgio/gotils v0.0.0-20220530130905-52f3993e8d6d/go.mod h1:Gy+0tqhJvgGlqnTF8CVGP0AaGRjwBtXs/a5PA0Y3+A4=
|
||||
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee h1:8Iv5m6xEo1NR1AvpV+7XmhI4r39LGNzwUL4YpMuL5vk=
|
||||
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee/go.mod h1:qwtSXrKuJh/zsFQ12yEE89xfCrGKK63Rr7ctU/uCo4g=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.3.1-0.20190311161405-34c6fa2dc709/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
|
||||
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/tinylib/msgp v1.1.6/go.mod h1:75BAfg2hauQhs3qedfdDZmWAPcFMAvJE5b9rGOMufyw=
|
||||
github.com/tinylib/msgp v1.1.8 h1:FCXC1xanKO4I8plpHGH2P7koL/RzZs12l/+r7vakfm0=
|
||||
github.com/tinylib/msgp v1.1.8/go.mod h1:qkpG+2ldGg4xRFmx+jfTvZPxfGFhi64BcnL9vkCm/Tw=
|
||||
github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo=
|
||||
github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M=
|
||||
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
|
||||
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0=
|
||||
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
|
||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||
github.com/valyala/fasthttp v1.45.0 h1:zPkkzpIn8tdHZUrVa6PzYd0i5verqiPSkgTd3bSUcpA=
|
||||
github.com/valyala/fasthttp v1.45.0/go.mod h1:k2zXd82h/7UZc3VOdJ2WaUqt1uZ/XpXAfE9i+HBC3lA=
|
||||
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
||||
github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA=
|
||||
github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g=
|
||||
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
|
||||
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
||||
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
|
||||
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
|
||||
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
|
||||
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
|
||||
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
|
||||
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
|
||||
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
|
||||
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
|
||||
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
|
||||
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
|
||||
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
|
||||
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
|
||||
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
||||
61
main.go
61
main.go
@@ -13,21 +13,26 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrGenerateSwagger throws when fails the marshalling of the swagger struct.
|
||||
ErrGenerateSwagger = errors.New("fail to generate swagger")
|
||||
// ErrValidatingSwagger throws when given swagger params are not correct.
|
||||
ErrValidatingSwagger = errors.New("fails to validate swagger")
|
||||
// ErrGenerateOAS throws when fails the marshalling of the swagger struct.
|
||||
ErrGenerateOAS = errors.New("fail to generate openapi")
|
||||
// ErrValidatingOAS throws when given openapi params are not correct.
|
||||
ErrValidatingOAS = errors.New("fails to validate openapi")
|
||||
|
||||
// Deprecated: ErrGenerateSwagger has been deprecated, use ErrGenerateOAS instead.
|
||||
ErrGenerateSwagger = ErrGenerateOAS
|
||||
// Deprecated: ErrValidatingSwagger has been deprecated, use ErrValidatingOAS instead.
|
||||
ErrValidatingSwagger = ErrValidatingOAS
|
||||
)
|
||||
|
||||
const (
|
||||
// DefaultJSONDocumentationPath is the path of the swagger documentation in json format.
|
||||
// DefaultJSONDocumentationPath is the path of the openapi documentation in json format.
|
||||
DefaultJSONDocumentationPath = "/documentation/json"
|
||||
// DefaultYAMLDocumentationPath is the path of the swagger documentation in yaml format.
|
||||
// DefaultYAMLDocumentationPath is the path of the openapi documentation in yaml format.
|
||||
DefaultYAMLDocumentationPath = "/documentation/yaml"
|
||||
defaultOpenapiVersion = "3.0.0"
|
||||
)
|
||||
|
||||
// Router handle the api router and the swagger schema.
|
||||
// Router handle the api router and the openapi schema.
|
||||
// api router supported out of the box are:
|
||||
// - gorilla mux
|
||||
type Router[HandlerFunc, Route any] struct {
|
||||
@@ -51,11 +56,11 @@ type Options struct {
|
||||
PathPrefix string
|
||||
}
|
||||
|
||||
// NewRouter generate new router with swagger. Default to OpenAPI 3.0.0
|
||||
// NewRouter generate new router with openapi. Default to OpenAPI 3.0.0
|
||||
func NewRouter[HandlerFunc, Route any](router apirouter.Router[HandlerFunc, Route], options Options) (*Router[HandlerFunc, Route], error) {
|
||||
swagger, err := generateNewValidOpenapi(options.Openapi)
|
||||
openapi, err := generateNewValidOpenapi(options.Openapi)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%w: %s", ErrValidatingSwagger, err)
|
||||
return nil, fmt.Errorf("%w: %s", ErrValidatingOAS, err)
|
||||
}
|
||||
|
||||
var ctx = options.Context
|
||||
@@ -81,7 +86,7 @@ func NewRouter[HandlerFunc, Route any](router apirouter.Router[HandlerFunc, Rout
|
||||
|
||||
return &Router[HandlerFunc, Route]{
|
||||
router: router,
|
||||
swaggerSchema: swagger,
|
||||
swaggerSchema: openapi,
|
||||
context: ctx,
|
||||
yamlDocumentationPath: yamlDocumentationPath,
|
||||
jsonDocumentationPath: jsonDocumentationPath,
|
||||
@@ -104,46 +109,46 @@ func (r Router[HandlerFunc, Route]) SubRouter(router apirouter.Router[HandlerFun
|
||||
}, nil
|
||||
}
|
||||
|
||||
func generateNewValidOpenapi(swagger *openapi3.T) (*openapi3.T, error) {
|
||||
if swagger == nil {
|
||||
return nil, fmt.Errorf("swagger is required")
|
||||
func generateNewValidOpenapi(openapi *openapi3.T) (*openapi3.T, error) {
|
||||
if openapi == nil {
|
||||
return nil, fmt.Errorf("openapi is required")
|
||||
}
|
||||
if swagger.OpenAPI == "" {
|
||||
swagger.OpenAPI = defaultOpenapiVersion
|
||||
if openapi.OpenAPI == "" {
|
||||
openapi.OpenAPI = defaultOpenapiVersion
|
||||
}
|
||||
if swagger.Paths == nil {
|
||||
swagger.Paths = openapi3.Paths{}
|
||||
if openapi.Paths == nil {
|
||||
openapi.Paths = &openapi3.Paths{}
|
||||
}
|
||||
|
||||
if swagger.Info == nil {
|
||||
return nil, fmt.Errorf("swagger info is required")
|
||||
if openapi.Info == nil {
|
||||
return nil, fmt.Errorf("openapi info is required")
|
||||
}
|
||||
if swagger.Info.Title == "" {
|
||||
return nil, fmt.Errorf("swagger info title is required")
|
||||
if openapi.Info.Title == "" {
|
||||
return nil, fmt.Errorf("openapi info title is required")
|
||||
}
|
||||
if swagger.Info.Version == "" {
|
||||
return nil, fmt.Errorf("swagger info version is required")
|
||||
if openapi.Info.Version == "" {
|
||||
return nil, fmt.Errorf("openapi info version is required")
|
||||
}
|
||||
|
||||
return swagger, nil
|
||||
return openapi, nil
|
||||
}
|
||||
|
||||
// GenerateAndExposeOpenapi creates a /documentation/json route on router and
|
||||
// expose the generated swagger
|
||||
func (r Router[_, _]) GenerateAndExposeOpenapi() error {
|
||||
if err := r.swaggerSchema.Validate(r.context); err != nil {
|
||||
return fmt.Errorf("%w: %s", ErrValidatingSwagger, err)
|
||||
return fmt.Errorf("%w: %s", ErrValidatingOAS, err)
|
||||
}
|
||||
|
||||
jsonSwagger, err := r.swaggerSchema.MarshalJSON()
|
||||
if err != nil {
|
||||
return fmt.Errorf("%w json marshal: %s", ErrGenerateSwagger, err)
|
||||
return fmt.Errorf("%w json marshal: %s", ErrGenerateOAS, err)
|
||||
}
|
||||
r.router.AddRoute(http.MethodGet, r.jsonDocumentationPath, r.router.SwaggerHandler("application/json", jsonSwagger))
|
||||
|
||||
yamlSwagger, err := yaml.JSONToYAML(jsonSwagger)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%w yaml marshal: %s", ErrGenerateSwagger, err)
|
||||
return fmt.Errorf("%w yaml marshal: %s", ErrGenerateOAS, err)
|
||||
}
|
||||
r.router.AddRoute(http.MethodGet, r.yamlDocumentationPath, r.router.SwaggerHandler("text/plain", yamlSwagger))
|
||||
|
||||
|
||||
92
main_test.go
92
main_test.go
@@ -26,14 +26,14 @@ func TestNewRouter(t *testing.T) {
|
||||
}
|
||||
openapi := &openapi3.T{
|
||||
Info: info,
|
||||
Paths: openapi3.Paths{},
|
||||
Paths: &openapi3.Paths{},
|
||||
}
|
||||
|
||||
t.Run("not ok - invalid Openapi option", func(t *testing.T) {
|
||||
r, err := NewRouter(mAPIRouter, Options{})
|
||||
|
||||
require.Nil(t, r)
|
||||
require.EqualError(t, err, fmt.Sprintf("%s: swagger is required", ErrValidatingSwagger))
|
||||
require.EqualError(t, err, fmt.Sprintf("%s: openapi is required", ErrValidatingOAS))
|
||||
})
|
||||
|
||||
t.Run("ok - with default context", func(t *testing.T) {
|
||||
@@ -119,50 +119,50 @@ func TestNewRouter(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGenerateValidSwagger(t *testing.T) {
|
||||
t.Run("not ok - empty swagger info", func(t *testing.T) {
|
||||
swagger := &openapi3.T{}
|
||||
t.Run("not ok - empty openapi info", func(t *testing.T) {
|
||||
openapi := &openapi3.T{}
|
||||
|
||||
swagger, err := generateNewValidOpenapi(swagger)
|
||||
require.Nil(t, swagger)
|
||||
require.EqualError(t, err, "swagger info is required")
|
||||
openapi, err := generateNewValidOpenapi(openapi)
|
||||
require.Nil(t, openapi)
|
||||
require.EqualError(t, err, "openapi info is required")
|
||||
})
|
||||
|
||||
t.Run("not ok - empty info title", func(t *testing.T) {
|
||||
swagger := &openapi3.T{
|
||||
openapi := &openapi3.T{
|
||||
Info: &openapi3.Info{},
|
||||
}
|
||||
|
||||
swagger, err := generateNewValidOpenapi(swagger)
|
||||
require.Nil(t, swagger)
|
||||
require.EqualError(t, err, "swagger info title is required")
|
||||
openapi, err := generateNewValidOpenapi(openapi)
|
||||
require.Nil(t, openapi)
|
||||
require.EqualError(t, err, "openapi info title is required")
|
||||
})
|
||||
|
||||
t.Run("not ok - empty info version", func(t *testing.T) {
|
||||
swagger := &openapi3.T{
|
||||
openapi := &openapi3.T{
|
||||
Info: &openapi3.Info{
|
||||
Title: "title",
|
||||
},
|
||||
}
|
||||
|
||||
swagger, err := generateNewValidOpenapi(swagger)
|
||||
require.Nil(t, swagger)
|
||||
require.EqualError(t, err, "swagger info version is required")
|
||||
openapi, err := generateNewValidOpenapi(openapi)
|
||||
require.Nil(t, openapi)
|
||||
require.EqualError(t, err, "openapi info version is required")
|
||||
})
|
||||
|
||||
t.Run("ok - custom swagger", func(t *testing.T) {
|
||||
swagger := &openapi3.T{
|
||||
t.Run("ok - custom openapi", func(t *testing.T) {
|
||||
openapi := &openapi3.T{
|
||||
Info: &openapi3.Info{},
|
||||
}
|
||||
|
||||
swagger, err := generateNewValidOpenapi(swagger)
|
||||
require.Nil(t, swagger)
|
||||
require.EqualError(t, err, "swagger info title is required")
|
||||
openapi, err := generateNewValidOpenapi(openapi)
|
||||
require.Nil(t, openapi)
|
||||
require.EqualError(t, err, "openapi info title is required")
|
||||
})
|
||||
|
||||
t.Run("not ok - swagger is required", func(t *testing.T) {
|
||||
swagger, err := generateNewValidOpenapi(nil)
|
||||
require.Nil(t, swagger)
|
||||
require.EqualError(t, err, "swagger is required")
|
||||
t.Run("not ok - openapi is required", func(t *testing.T) {
|
||||
openapi, err := generateNewValidOpenapi(nil)
|
||||
require.Nil(t, openapi)
|
||||
require.EqualError(t, err, "openapi is required")
|
||||
})
|
||||
|
||||
t.Run("ok", func(t *testing.T) {
|
||||
@@ -170,22 +170,22 @@ func TestGenerateValidSwagger(t *testing.T) {
|
||||
Title: "my title",
|
||||
Version: "my version",
|
||||
}
|
||||
swagger := &openapi3.T{
|
||||
openapi := &openapi3.T{
|
||||
Info: info,
|
||||
}
|
||||
|
||||
swagger, err := generateNewValidOpenapi(swagger)
|
||||
openapi, err := generateNewValidOpenapi(openapi)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &openapi3.T{
|
||||
OpenAPI: defaultOpenapiVersion,
|
||||
Info: info,
|
||||
Paths: openapi3.Paths{},
|
||||
}, swagger)
|
||||
Paths: &openapi3.Paths{},
|
||||
}, openapi)
|
||||
})
|
||||
}
|
||||
|
||||
func TestGenerateAndExposeSwagger(t *testing.T) {
|
||||
t.Run("fails swagger validation", func(t *testing.T) {
|
||||
t.Run("fails openapi validation", func(t *testing.T) {
|
||||
mRouter := mux.NewRouter()
|
||||
router, err := NewRouter(gorilla.NewRouter(mRouter), Options{
|
||||
Openapi: &openapi3.T{
|
||||
@@ -204,17 +204,17 @@ func TestGenerateAndExposeSwagger(t *testing.T) {
|
||||
|
||||
err = router.GenerateAndExposeOpenapi()
|
||||
require.Error(t, err)
|
||||
require.True(t, strings.HasPrefix(err.Error(), fmt.Sprintf("%s:", ErrValidatingSwagger)))
|
||||
require.True(t, strings.HasPrefix(err.Error(), fmt.Sprintf("%s:", ErrValidatingOAS)))
|
||||
})
|
||||
|
||||
t.Run("correctly expose json documentation from loaded swagger file", func(t *testing.T) {
|
||||
t.Run("correctly expose json documentation from loaded openapi file", func(t *testing.T) {
|
||||
mRouter := mux.NewRouter()
|
||||
|
||||
swagger, err := openapi3.NewLoader().LoadFromFile("testdata/users_employees.json")
|
||||
openapi, err := openapi3.NewLoader().LoadFromFile("testdata/users_employees.json")
|
||||
require.NoError(t, err)
|
||||
|
||||
router, err := NewRouter(gorilla.NewRouter(mRouter), Options{
|
||||
Openapi: swagger,
|
||||
Openapi: openapi,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -234,14 +234,14 @@ func TestGenerateAndExposeSwagger(t *testing.T) {
|
||||
require.JSONEq(t, string(actual), body)
|
||||
})
|
||||
|
||||
t.Run("correctly expose json documentation from loaded swagger file - custom path", func(t *testing.T) {
|
||||
t.Run("correctly expose json documentation from loaded openapi file - custom path", func(t *testing.T) {
|
||||
mRouter := mux.NewRouter()
|
||||
|
||||
swagger, err := openapi3.NewLoader().LoadFromFile("testdata/users_employees.json")
|
||||
openapi, err := openapi3.NewLoader().LoadFromFile("testdata/users_employees.json")
|
||||
require.NoError(t, err)
|
||||
|
||||
router, err := NewRouter(gorilla.NewRouter(mRouter), Options{
|
||||
Openapi: swagger,
|
||||
Openapi: openapi,
|
||||
JSONDocumentationPath: "/custom/path",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
@@ -262,14 +262,14 @@ func TestGenerateAndExposeSwagger(t *testing.T) {
|
||||
require.JSONEq(t, string(actual), body)
|
||||
})
|
||||
|
||||
t.Run("correctly expose yaml documentation from loaded swagger file", func(t *testing.T) {
|
||||
t.Run("correctly expose yaml documentation from loaded openapi file", func(t *testing.T) {
|
||||
mRouter := mux.NewRouter()
|
||||
|
||||
swagger, err := openapi3.NewLoader().LoadFromFile("testdata/users_employees.json")
|
||||
openapi, err := openapi3.NewLoader().LoadFromFile("testdata/users_employees.json")
|
||||
require.NoError(t, err)
|
||||
|
||||
router, err := NewRouter(gorilla.NewRouter(mRouter), Options{
|
||||
Openapi: swagger,
|
||||
Openapi: openapi,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -289,14 +289,14 @@ func TestGenerateAndExposeSwagger(t *testing.T) {
|
||||
require.YAMLEq(t, string(expected), body, string(body))
|
||||
})
|
||||
|
||||
t.Run("correctly expose yaml documentation from loaded swagger file - custom path", func(t *testing.T) {
|
||||
t.Run("correctly expose yaml documentation from loaded openapi file - custom path", func(t *testing.T) {
|
||||
mRouter := mux.NewRouter()
|
||||
|
||||
swagger, err := openapi3.NewLoader().LoadFromFile("testdata/users_employees.json")
|
||||
openapi, err := openapi3.NewLoader().LoadFromFile("testdata/users_employees.json")
|
||||
require.NoError(t, err)
|
||||
|
||||
router, err := NewRouter(gorilla.NewRouter(mRouter), Options{
|
||||
Openapi: swagger,
|
||||
Openapi: openapi,
|
||||
YAMLDocumentationPath: "/custom/path",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
@@ -323,8 +323,8 @@ func TestGenerateAndExposeSwagger(t *testing.T) {
|
||||
router, err := NewRouter(gorilla.NewRouter(mRouter), Options{
|
||||
Openapi: &openapi3.T{
|
||||
Info: &openapi3.Info{
|
||||
Title: "test swagger title",
|
||||
Version: "test swagger version",
|
||||
Title: "test openapi title",
|
||||
Version: "test openapi version",
|
||||
},
|
||||
},
|
||||
JSONDocumentationPath: "/custom/path",
|
||||
@@ -402,8 +402,8 @@ func TestGenerateAndExposeSwagger(t *testing.T) {
|
||||
router, err := NewRouter(gorilla.NewRouter(mRouter), Options{
|
||||
Openapi: &openapi3.T{
|
||||
Info: &openapi3.Info{
|
||||
Title: "test swagger title",
|
||||
Version: "test swagger version",
|
||||
Title: "test openapi title",
|
||||
Version: "test openapi version",
|
||||
},
|
||||
},
|
||||
JSONDocumentationPath: "/custom/path",
|
||||
|
||||
@@ -28,7 +28,7 @@ func (o *Operation) AddRequestBody(requestBody *openapi3.RequestBody) {
|
||||
// but it is always possible to add it manually.
|
||||
func (o *Operation) AddResponse(status int, response *openapi3.Response) {
|
||||
if o.Responses == nil {
|
||||
o.Responses = make(openapi3.Responses)
|
||||
o.Responses = &openapi3.Responses{}
|
||||
}
|
||||
if response.Description == nil {
|
||||
// a description is required by kin openapi, so we set an empty description
|
||||
|
||||
@@ -27,7 +27,7 @@ func TestNewOperation(t *testing.T) {
|
||||
operation.Responses = openapi3.NewResponses()
|
||||
return operation
|
||||
},
|
||||
expectedJSON: `{"info":{"title":"test swagger title","version":"test swagger version"},"openapi":"3.0.0","paths":{"/":{"post":{"requestBody":{"content":{"application/json":{"schema":{"properties":{"bar":{"maximum":15,"minimum":5,"type":"integer"},"foo":{"type":"string"}},"type":"object"}}}},"responses":{"default":{"description":""}}}}}}`,
|
||||
expectedJSON: `{"info":{"title":"test openapi title","version":"test openapi version"},"openapi":"3.0.0","paths":{"/":{"post":{"requestBody":{"content":{"application/json":{"schema":{"properties":{"bar":{"maximum":15,"minimum":5,"type":"integer"},"foo":{"type":"string"}},"type":"object"}}}},"responses":{"default":{"description":""}}}}}}`,
|
||||
},
|
||||
{
|
||||
name: "add response",
|
||||
@@ -36,19 +36,19 @@ func TestNewOperation(t *testing.T) {
|
||||
operation.AddResponse(200, response)
|
||||
return operation
|
||||
},
|
||||
expectedJSON: `{"info":{"title":"test swagger title","version":"test swagger version"},"openapi":"3.0.0","paths":{"/":{"post":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"bar":{"maximum":15,"minimum":5,"type":"integer"},"foo":{"type":"string"}},"type":"object"}}},"description":""}}}}}}`,
|
||||
expectedJSON: `{"info":{"title":"test openapi title","version":"test openapi version"},"openapi":"3.0.0","paths":{"/":{"post":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"bar":{"maximum":15,"minimum":5,"type":"integer"},"foo":{"type":"string"}},"type":"object"}}},"description":""}}}}}}`,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
swagger := getBaseSwagger(t)
|
||||
swagger.OpenAPI = "3.0.0"
|
||||
openapi := getBaseSwagger(t)
|
||||
openapi.OpenAPI = "3.0.0"
|
||||
operation := test.getOperation(t, NewOperation())
|
||||
|
||||
swagger.AddOperation("/", http.MethodPost, operation.Operation)
|
||||
openapi.AddOperation("/", http.MethodPost, operation.Operation)
|
||||
|
||||
data, _ := swagger.MarshalJSON()
|
||||
data, _ := openapi.MarshalJSON()
|
||||
jsonData := string(data)
|
||||
require.JSONEq(t, test.expectedJSON, jsonData, "actual json data: %s", jsonData)
|
||||
})
|
||||
|
||||
28
route.go
28
route.go
@@ -4,11 +4,12 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"path"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/getkin/kin-openapi/openapi3"
|
||||
"github.com/mia-platform/jsonschema"
|
||||
"github.com/invopop/jsonschema"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -23,7 +24,7 @@ var (
|
||||
)
|
||||
|
||||
// AddRawRoute add route to router with specific method, path and handler. Add the
|
||||
// router also to the swagger schema, after validating it
|
||||
// router also to the openapi schema, after validating it
|
||||
func (r Router[HandlerFunc, Route]) AddRawRoute(method string, routePath string, handler HandlerFunc, operation Operation) (Route, error) {
|
||||
op := operation.Operation
|
||||
if op != nil {
|
||||
@@ -98,7 +99,7 @@ type Definitions struct {
|
||||
|
||||
func newOperationFromDefinition(schema Definitions) Operation {
|
||||
operation := NewOperation()
|
||||
operation.Responses = make(openapi3.Responses)
|
||||
operation.Responses = &openapi3.Responses{}
|
||||
operation.Tags = schema.Tags
|
||||
operation.Extensions = schema.Extensions
|
||||
operation.addSecurityRequirements(schema.Security)
|
||||
@@ -289,15 +290,18 @@ func (r Router[_, _]) addContentToOASSchema(content Content) (openapi3.Content,
|
||||
|
||||
func getPathParamsAutoComplete(schema Definitions, path string) ParameterValue {
|
||||
if schema.PathParams == nil {
|
||||
pathParams := strings.Split(path, "/")
|
||||
for _, param := range pathParams {
|
||||
if strings.HasPrefix(param, "{") && strings.HasSuffix(param, "}") {
|
||||
if schema.PathParams == nil {
|
||||
schema.PathParams = make(ParameterValue)
|
||||
}
|
||||
param = strings.Replace(param, "{", "", 1)
|
||||
param = strings.Replace(param, "}", "", 1)
|
||||
schema.PathParams[param] = Parameter{
|
||||
re := regexp.MustCompile(`\{([^}]+)\}`)
|
||||
segments := strings.Split(path, "/")
|
||||
for _, segment := range segments {
|
||||
params := re.FindAllStringSubmatch(segment, -1)
|
||||
if len(params) == 0 {
|
||||
continue
|
||||
}
|
||||
if schema.PathParams == nil {
|
||||
schema.PathParams = make(ParameterValue)
|
||||
}
|
||||
for _, param := range params {
|
||||
schema.PathParams[param[1]] = Parameter{
|
||||
Schema: &Schema{Value: ""},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ func TestAddRoutes(t *testing.T) {
|
||||
FirstName string `json:"firstName" jsonschema:"title=user first name"`
|
||||
LastName string `json:"lastName" jsonschema:"title=user last name"`
|
||||
Metadata interface{} `json:"metadata,omitempty" jsonschema:"title=custom properties,oneof_type=string;number"`
|
||||
UserType string `json:"userType,omitempty" jsonschema:"title=type of user,enum=simple,enum=advanced"`
|
||||
}
|
||||
|
||||
okHandler := func(w http.ResponseWriter, req *http.Request) {
|
||||
@@ -186,7 +187,7 @@ func TestAddRoutes(t *testing.T) {
|
||||
fixturesPath: "testdata/params.json",
|
||||
},
|
||||
{
|
||||
name: "schema without params autofilled",
|
||||
name: "schema without explicit params autofill them",
|
||||
routes: func(t *testing.T, router *TestRouter) {
|
||||
_, err := router.AddRoute(http.MethodGet, "/users/{userId}", okHandler, Definitions{
|
||||
Querystring: ParameterValue{
|
||||
@@ -199,8 +200,11 @@ func TestAddRoutes(t *testing.T) {
|
||||
|
||||
_, err = router.AddRoute(http.MethodGet, "/cars/{carId}/drivers/{driverId}", okHandler, Definitions{})
|
||||
require.NoError(t, err)
|
||||
|
||||
_, err = router.AddRoute(http.MethodGet, "/files/{name}.{extension}", okHandler, Definitions{})
|
||||
require.NoError(t, err)
|
||||
},
|
||||
testPath: "/users/12",
|
||||
testPath: "/files/myid.yaml",
|
||||
fixturesPath: "testdata/params-autofill.json",
|
||||
},
|
||||
{
|
||||
@@ -376,7 +380,7 @@ func TestAddRoutes(t *testing.T) {
|
||||
fixturesPath: "testdata/anyof.json",
|
||||
},
|
||||
{
|
||||
name: "oneOf support on properties",
|
||||
name: "oneOf and enum are supported on properties",
|
||||
routes: func(t *testing.T, router *TestRouter) {
|
||||
_, err := router.AddRoute(http.MethodPost, "/user-profile", okHandler, Definitions{
|
||||
RequestBody: &ContentValue{
|
||||
@@ -529,7 +533,7 @@ func TestAddRoutes(t *testing.T) {
|
||||
require.Equal(t, "OK", body)
|
||||
}
|
||||
|
||||
t.Run("and generate swagger documentation in json", func(t *testing.T) {
|
||||
t.Run("and generate openapi documentation in json", func(t *testing.T) {
|
||||
w := httptest.NewRecorder()
|
||||
req := httptest.NewRequest(http.MethodGet, DefaultJSONDocumentationPath, nil)
|
||||
|
||||
@@ -923,7 +927,7 @@ func TestResolveResponsesSchema(t *testing.T) {
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
operation := NewOperation()
|
||||
operation.Responses = make(openapi3.Responses)
|
||||
operation.Responses = &openapi3.Responses{}
|
||||
|
||||
err := router.resolveResponsesSchema(test.responsesSchema, operation)
|
||||
|
||||
@@ -1112,8 +1116,66 @@ func getBaseSwagger(t *testing.T) *openapi3.T {
|
||||
|
||||
return &openapi3.T{
|
||||
Info: &openapi3.Info{
|
||||
Title: "test swagger title",
|
||||
Version: "test swagger version",
|
||||
Title: "test openapi title",
|
||||
Version: "test openapi version",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetPathParamsAutoComplete(t *testing.T) {
|
||||
testCases := map[string]struct {
|
||||
schemaDefinition Definitions
|
||||
path string
|
||||
expected ParameterValue
|
||||
}{
|
||||
"no path params": {
|
||||
schemaDefinition: Definitions{},
|
||||
path: "/users",
|
||||
expected: nil,
|
||||
},
|
||||
"with path params": {
|
||||
schemaDefinition: Definitions{},
|
||||
path: "/users/{userId}",
|
||||
expected: ParameterValue{
|
||||
"userId": {
|
||||
Schema: &Schema{Value: ""},
|
||||
},
|
||||
},
|
||||
},
|
||||
"with multiple path params": {
|
||||
schemaDefinition: Definitions{},
|
||||
path: "/foo/{bar}.{taz}",
|
||||
expected: ParameterValue{
|
||||
"bar": {
|
||||
Schema: &Schema{Value: ""},
|
||||
},
|
||||
"taz": {
|
||||
Schema: &Schema{Value: ""},
|
||||
},
|
||||
},
|
||||
},
|
||||
"with nested multiple path params": {
|
||||
schemaDefinition: Definitions{},
|
||||
path: "/foo/{bar}.{taz}/{baz}/ok",
|
||||
expected: ParameterValue{
|
||||
"bar": {
|
||||
Schema: &Schema{Value: ""},
|
||||
},
|
||||
"taz": {
|
||||
Schema: &Schema{Value: ""},
|
||||
},
|
||||
"baz": {
|
||||
Schema: &Schema{Value: ""},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for name, test := range testCases {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
actual := getPathParamsAutoComplete(test.schemaDefinition, test.path)
|
||||
|
||||
require.Equal(t, test.expected, actual)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
swaggerOpenapiTitle = "test swagger title"
|
||||
swaggerOpenapiVersion = "test swagger version"
|
||||
swaggerOpenapiTitle = "test openapi title"
|
||||
swaggerOpenapiVersion = "test openapi version"
|
||||
)
|
||||
|
||||
type echoSwaggerRouter = swagger.Router[echo.HandlerFunc, *echo.Route]
|
||||
|
||||
@@ -19,8 +19,8 @@ import (
|
||||
type SwaggerRouter = swagger.Router[oasFiber.HandlerFunc, oasFiber.Route]
|
||||
|
||||
const (
|
||||
swaggerOpenapiTitle = "test swagger title"
|
||||
swaggerOpenapiVersion = "test swagger version"
|
||||
swaggerOpenapiTitle = "test openapi title"
|
||||
swaggerOpenapiVersion = "test openapi version"
|
||||
)
|
||||
|
||||
func TestFiberIntegration(t *testing.T) {
|
||||
|
||||
@@ -16,8 +16,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
swaggerOpenapiTitle = "test swagger title"
|
||||
swaggerOpenapiVersion = "test swagger version"
|
||||
swaggerOpenapiTitle = "test openapi title"
|
||||
swaggerOpenapiVersion = "test openapi version"
|
||||
)
|
||||
|
||||
type SwaggerRouter = swagger.Router[gorilla.HandlerFunc, gorilla.Route]
|
||||
|
||||
4
support/testdata/integration.json
vendored
4
support/testdata/integration.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"info": {
|
||||
"title": "test swagger title",
|
||||
"version": "test swagger version"
|
||||
"title": "test openapi title",
|
||||
"version": "test openapi version"
|
||||
},
|
||||
"openapi": "3.0.0",
|
||||
"paths": {
|
||||
|
||||
4
support/testdata/intergation-subrouter.json
vendored
4
support/testdata/intergation-subrouter.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"info": {
|
||||
"title": "test swagger title",
|
||||
"version": "test swagger version"
|
||||
"title": "test openapi title",
|
||||
"version": "test openapi version"
|
||||
},
|
||||
"openapi": "3.0.0",
|
||||
"paths": {
|
||||
|
||||
4
testdata/allof.json
vendored
4
testdata/allof.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"info": {
|
||||
"title": "test swagger title",
|
||||
"version": "test swagger version"
|
||||
"title": "test openapi title",
|
||||
"version": "test openapi version"
|
||||
},
|
||||
"openapi": "3.0.0",
|
||||
"paths": {
|
||||
|
||||
4
testdata/anyof.json
vendored
4
testdata/anyof.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"info": {
|
||||
"title": "test swagger title",
|
||||
"version": "test swagger version"
|
||||
"title": "test openapi title",
|
||||
"version": "test openapi version"
|
||||
},
|
||||
"openapi": "3.0.0",
|
||||
"paths": {
|
||||
|
||||
4
testdata/cookies.json
vendored
4
testdata/cookies.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"info": {
|
||||
"title": "test swagger title",
|
||||
"version": "test swagger version"
|
||||
"title": "test openapi title",
|
||||
"version": "test openapi version"
|
||||
},
|
||||
"openapi": "3.0.0",
|
||||
"paths": {
|
||||
|
||||
4
testdata/empty-route-schema.json
vendored
4
testdata/empty-route-schema.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"info": {
|
||||
"title": "test swagger title",
|
||||
"version": "test swagger version"
|
||||
"title": "test openapi title",
|
||||
"version": "test openapi version"
|
||||
},
|
||||
"openapi": "3.0.0",
|
||||
"paths": {
|
||||
|
||||
4
testdata/empty.json
vendored
4
testdata/empty.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"info": {
|
||||
"title": "test swagger title",
|
||||
"version": "test swagger version"
|
||||
"title": "test openapi title",
|
||||
"version": "test openapi version"
|
||||
},
|
||||
"openapi": "3.0.0",
|
||||
"paths": {}
|
||||
|
||||
4
testdata/extension.json
vendored
4
testdata/extension.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"info": {
|
||||
"title": "test swagger title",
|
||||
"version": "test swagger version"
|
||||
"title": "test openapi title",
|
||||
"version": "test openapi version"
|
||||
},
|
||||
"openapi": "3.0.0",
|
||||
"paths": {
|
||||
|
||||
4
testdata/headers.json
vendored
4
testdata/headers.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"info": {
|
||||
"title": "test swagger title",
|
||||
"version": "test swagger version"
|
||||
"title": "test openapi title",
|
||||
"version": "test openapi version"
|
||||
},
|
||||
"openapi": "3.0.0",
|
||||
"paths": {
|
||||
|
||||
4
testdata/multipart-requestbody.json
vendored
4
testdata/multipart-requestbody.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"info": {
|
||||
"title": "test swagger title",
|
||||
"version": "test swagger version"
|
||||
"title": "test openapi title",
|
||||
"version": "test openapi version"
|
||||
},
|
||||
"openapi": "3.0.0",
|
||||
"paths": {
|
||||
|
||||
9
testdata/oneOf.json
vendored
9
testdata/oneOf.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"info": {
|
||||
"title": "test swagger title",
|
||||
"version": "test swagger version"
|
||||
"title": "test openapi title",
|
||||
"version": "test openapi version"
|
||||
},
|
||||
"openapi": "3.0.0",
|
||||
"paths": {
|
||||
@@ -78,6 +78,11 @@
|
||||
}
|
||||
],
|
||||
"title": "custom properties"
|
||||
},
|
||||
"userType": {
|
||||
"title": "type of user",
|
||||
"type": "string",
|
||||
"enum": ["simple", "advanced"]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
||||
31
testdata/params-autofill.json
vendored
31
testdata/params-autofill.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"info": {
|
||||
"title": "test swagger title",
|
||||
"version": "test swagger version"
|
||||
"title": "test openapi title",
|
||||
"version": "test openapi version"
|
||||
},
|
||||
"openapi": "3.0.0",
|
||||
"paths": {
|
||||
@@ -57,6 +57,33 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/files/{name}.{extension}": {
|
||||
"get": {
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "extension",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"in": "path",
|
||||
"name": "name",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
4
testdata/params.json
vendored
4
testdata/params.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"info": {
|
||||
"title": "test swagger title",
|
||||
"version": "test swagger version"
|
||||
"title": "test openapi title",
|
||||
"version": "test openapi version"
|
||||
},
|
||||
"openapi": "3.0.0",
|
||||
"paths": {
|
||||
|
||||
4
testdata/query.json
vendored
4
testdata/query.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"info": {
|
||||
"title": "test swagger title",
|
||||
"version": "test swagger version"
|
||||
"title": "test openapi title",
|
||||
"version": "test openapi version"
|
||||
},
|
||||
"openapi": "3.0.0",
|
||||
"paths": {
|
||||
|
||||
4
testdata/router_with_prefix.json
vendored
4
testdata/router_with_prefix.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"info": {
|
||||
"title": "test swagger title",
|
||||
"version": "test swagger version"
|
||||
"title": "test openapi title",
|
||||
"version": "test openapi version"
|
||||
},
|
||||
"openapi": "3.0.0",
|
||||
"paths": {
|
||||
|
||||
4
testdata/schema-no-content.json
vendored
4
testdata/schema-no-content.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"info": {
|
||||
"title": "test swagger title",
|
||||
"version": "test swagger version"
|
||||
"title": "test openapi title",
|
||||
"version": "test openapi version"
|
||||
},
|
||||
"openapi": "3.0.0",
|
||||
"paths": {
|
||||
|
||||
4
testdata/security.json
vendored
4
testdata/security.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"info": {
|
||||
"title": "test swagger title",
|
||||
"version": "test swagger version"
|
||||
"title": "test openapi title",
|
||||
"version": "test openapi version"
|
||||
},
|
||||
"openapi": "3.0.0",
|
||||
"paths": {
|
||||
|
||||
4
testdata/subrouter.json
vendored
4
testdata/subrouter.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"info": {
|
||||
"title": "test swagger title",
|
||||
"version": "test swagger version"
|
||||
"title": "test openapi title",
|
||||
"version": "test openapi version"
|
||||
},
|
||||
"openapi": "3.0.0",
|
||||
"paths": {
|
||||
|
||||
4
testdata/tags.json
vendored
4
testdata/tags.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"info": {
|
||||
"title": "test swagger title",
|
||||
"version": "test swagger version"
|
||||
"title": "test openapi title",
|
||||
"version": "test openapi version"
|
||||
},
|
||||
"openapi": "3.0.0",
|
||||
"paths": {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"info": {
|
||||
"title": "test swagger title",
|
||||
"version": "test swagger version"
|
||||
"title": "test openapi title",
|
||||
"version": "test openapi version"
|
||||
},
|
||||
"openapi": "3.0.0",
|
||||
"paths": {
|
||||
|
||||
4
testdata/users_employees.json
vendored
4
testdata/users_employees.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"info": {
|
||||
"title": "test swagger title",
|
||||
"version": "test swagger version"
|
||||
"title": "test openapi title",
|
||||
"version": "test openapi version"
|
||||
},
|
||||
"openapi": "3.0.0",
|
||||
"paths": {
|
||||
|
||||
4
testdata/users_employees.yaml
vendored
4
testdata/users_employees.yaml
vendored
@@ -1,6 +1,6 @@
|
||||
info:
|
||||
title: test swagger title
|
||||
version: test swagger version
|
||||
title: test openapi title
|
||||
version: test openapi version
|
||||
openapi: 3.0.0
|
||||
paths:
|
||||
/employees:
|
||||
|
||||
Reference in New Issue
Block a user