Skip to content

Commit

Permalink
Merge pull request #44 from siemens/test_json_1
Browse files Browse the repository at this point in the history
feat(external_references): Integrated external references in db schem…

Reviewed-by: [email protected]
  • Loading branch information
GMishx authored Feb 26, 2024
2 parents c116900 + e21c1aa commit 6152d25
Show file tree
Hide file tree
Showing 12 changed files with 391 additions and 193 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/api-swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Build Swagger documents
run: |
swag init --generalInfo api.go --dir ./pkg/api,./pkg/auth,./pkg/db,./pkg/models,./pkg/utils --output ./swag/docs
swag init --parseDependency --generalInfo api.go --dir ./pkg/api,./pkg/auth,./pkg/db,./pkg/models,./pkg/utils --output ./swag/docs
- name: Check doc diff
run: |
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ INSERT INTO users (username, userpassword, userlevel) VALUES ('<username>', '<pa
go install github.com/swaggo/swag/cmd/swag@latest
```
2. Run the following command to generate swagger documentation.
<!-- https://github.com/swaggo/swag/issues/817#issuecomment-730895033 -->
```bash
swag init --generalInfo api.go --dir ./pkg/api,./pkg/auth,./pkg/db,./pkg/models,./pkg/utils --output ./cmd/laas/docs
swag init --parseDependency --generalInfo api.go --dir ./pkg/api,./pkg/auth,./pkg/db,./pkg/models,./pkg/utils --output ./cmd/laas/docs
```
3. Swagger documentation will be generated in `./cmd/laas/docs` folder.
4. Run the project and navigate to `http://localhost:8080/swagger/index.html` to view the documentation.
Expand Down
15 changes: 15 additions & 0 deletions cmd/laas/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,12 @@ const docTemplate = `{
"description": "Limit of responses per page",
"name": "limit",
"in": "query"
},
{
"type": "string",
"description": "External reference parameters",
"name": "externalRef",
"in": "query"
}
],
"responses": {
Expand Down Expand Up @@ -1261,6 +1267,9 @@ const docTemplate = `{
}
},
"definitions": {
"datatypes.JSONType-models_LicenseDBSchemaExtension": {
"type": "object"
},
"models.Audit": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1353,6 +1362,9 @@ const docTemplate = `{
"rf_shortname"
],
"properties": {
"external_ref": {
"$ref": "#/definitions/datatypes.JSONType-models_LicenseDBSchemaExtension"
},
"marydone": {
"type": "boolean"
},
Expand Down Expand Up @@ -1456,6 +1468,9 @@ const docTemplate = `{
"models.LicenseInput": {
"type": "object",
"properties": {
"external_ref": {
"$ref": "#/definitions/datatypes.JSONType-models_LicenseDBSchemaExtension"
},
"marydone": {
"type": "boolean"
},
Expand Down
15 changes: 15 additions & 0 deletions cmd/laas/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,12 @@
"description": "Limit of responses per page",
"name": "limit",
"in": "query"
},
{
"type": "string",
"description": "External reference parameters",
"name": "externalRef",
"in": "query"
}
],
"responses": {
Expand Down Expand Up @@ -1255,6 +1261,9 @@
}
},
"definitions": {
"datatypes.JSONType-models_LicenseDBSchemaExtension": {
"type": "object"
},
"models.Audit": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1347,6 +1356,9 @@
"rf_shortname"
],
"properties": {
"external_ref": {
"$ref": "#/definitions/datatypes.JSONType-models_LicenseDBSchemaExtension"
},
"marydone": {
"type": "boolean"
},
Expand Down Expand Up @@ -1450,6 +1462,9 @@
"models.LicenseInput": {
"type": "object",
"properties": {
"external_ref": {
"$ref": "#/definitions/datatypes.JSONType-models_LicenseDBSchemaExtension"
},
"marydone": {
"type": "boolean"
},
Expand Down
10 changes: 10 additions & 0 deletions cmd/laas/docs/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
basePath: /api/v1
definitions:
datatypes.JSONType-models_LicenseDBSchemaExtension:
type: object
models.Audit:
properties:
id:
Expand Down Expand Up @@ -62,6 +64,8 @@ definitions:
type: object
models.LicenseDB:
properties:
external_ref:
$ref: '#/definitions/datatypes.JSONType-models_LicenseDBSchemaExtension'
marydone:
type: boolean
rf_FSFfree:
Expand Down Expand Up @@ -137,6 +141,8 @@ definitions:
type: object
models.LicenseInput:
properties:
external_ref:
$ref: '#/definitions/datatypes.JSONType-models_LicenseDBSchemaExtension'
marydone:
type: boolean
rf_FSFfree:
Expand Down Expand Up @@ -741,6 +747,10 @@ paths:
in: query
name: limit
type: integer
- description: External reference parameters
in: query
name: externalRef
type: string
produces:
- application/json
responses:
Expand Down
6 changes: 6 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ require (
gorm.io/gorm v1.25.1
)

require (
github.com/go-sql-driver/mysql v1.7.0 // indirect
gorm.io/driver/mysql v1.4.7 // indirect
)

require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
Expand Down Expand Up @@ -59,4 +64,5 @@ require (
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gorm.io/datatypes v1.2.0
)
8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js=
github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
Expand All @@ -54,6 +56,7 @@ github.com/jackc/pgx/v5 v5.4.3 h1:cxFyXhxlvAifxnkKKdlxv8XqUf59tDlYjnV5YYfsJJY=
github.com/jackc/pgx/v5 v5.4.3/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
Expand Down Expand Up @@ -176,8 +179,13 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/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=
gorm.io/datatypes v1.2.0 h1:5YT+eokWdIxhJgWHdrb2zYUimyk0+TaFth+7a0ybzco=
gorm.io/datatypes v1.2.0/go.mod h1:o1dh0ZvjIjhH/bngTpypG6lVRJ5chTBxE09FH/71k04=
gorm.io/driver/mysql v1.4.7 h1:rY46lkCspzGHn7+IYsNpSfEv9tA+SU4SkkB+GFX125Y=
gorm.io/driver/mysql v1.4.7/go.mod h1:SxzItlnT1cb6e1e4ZRpgJN2VYtcqJgqnHxWr4wsP8oc=
gorm.io/driver/postgres v1.5.2 h1:ytTDxxEv+MplXOfFe3Lzm7SjG09fcdb3Z/c056DTBx0=
gorm.io/driver/postgres v1.5.2/go.mod h1:fmpX0m2I1PKuR7mKZiEluwrP3hbs+ps7JIGMUBpCgl8=
gorm.io/gorm v1.23.8/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk=
gorm.io/gorm v1.25.1 h1:nsSALe5Pr+cM3V1qwwQ7rOkw+6UeLrX5O4v3llhHa64=
gorm.io/gorm v1.25.1/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
Loading

0 comments on commit 6152d25

Please sign in to comment.