ref generated with complete heirarchy even with schema-without-package option
Closed this issue · 0 comments
ehrktia commented
issue reported in #6
the option to hide schema is available in schema-without-package
go-swagger3 --module-path . --main-file-path ./cmd/xxx/main.go --output oas.json --schema-without-pkg true
above command is provided to generate ref components with no schema or package names.
unfortunately for nested response types this is not working
example:
folder/file structure
---go.mod
----internal/
------server/
-------server.go
------entity/
-------entity.go
example entity
// SearchResponse info
// @Description SearchResponse info
// @Description SearchResponse info
type SearchResponse struct {
Data *DataLevel1 `json:"dataLevel1,omitempty"`
}
type DataLevel2List []*DataLevel2
// DataLevel1 info
// @Description DataLevel1 info
// @Description DataLevel1 info
type DataLevel1 struct {
Id *int64 `json:"id,omitempty"`
Level2 DataLevel2 `json:"dataLevel2,omitempty"`
}
// DataLevel2
// @Description DataLevel2
// @Description DataLevel2
type DataLevel2 struct {
Id *int64 `json:"id,omitempty"`
RowVersion *int32 `json:"rowVersion,omitempty"`
}
generated output contains refnames with complete schema and path
i.e -
/api/reports/data/search:
get:
responses:
'200':
description: SearchResponse JSON
content:
application/json:
schema:
$ref: '#/components/schemas/gitlab.com.company-domain.module-name.internal.entity.SearchResponse'
please let me know if you require more info