go-swagger: Models do not show fields from the struct.
Problem statement
calling swagger generate spec -o ./swagger.yaml -m in the go-swagger/fixtures/goparsing/petstore directory produces the following definitions for the models that do not contain the members of the struct.
definitions:
order:
title: An Order for one or more pets by a user.
x-go-name: Order
x-go-package: github.com/go-swagger/go-swagger/fixtures/goparsing/petstore/models
pet:
description: It is used to describe the animals available in the store.
title: A Pet is the main product in the store.
x-go-name: Pet
x-go-package: github.com/go-swagger/go-swagger/fixtures/goparsing/petstore/models
tag:
description: It is used to describe the animals available in the store.
title: A Tag is an extra piece of data to provide more information about a pet.
x-go-name: Tag
x-go-package: github.com/go-swagger/go-swagger/fixtures/goparsing/petstore/models
user:
description: A User can purchase pets
x-go-name: User
x-go-package: github.com/go-swagger/go-swagger/fixtures/goparsing/petstore/models
I would expect that the definition for Order would show the fields and the required ones
// An Order for one or more pets by a user.
// swagger:model order
type Order struct {
// the ID of the order
//
// required: true
ID int64 `json:"id"`
// the id of the user who placed the order.
//
// required: true
UserID int64 `json:"userId"`
// the time at which this order was made.
//
// required: true
OrderedAt strfmt.DateTime `json:"orderedAt"`
// the items for this order
// mininum items: 1
Items []struct {
// the id of the pet to order
//
// required: true
PetID int64 `json:"petId"`
// the quantity of this pet to order
//
// required: true
// minimum: 1
Quantity int32 `json:"qty"`
} `json:"items"`
}
Am I calling the generation here incorrectly?
Environment
petstore % swagger version version: v0.30.3 commit: ecf6f05b6ecc1b1725c8569534f133fa27e9de6bgo go version go1.19.3 darwin/arm64 OS: macOS
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 9
- Comments: 15
I’m also having same issue on Linux with 0.30.4, binary from release
All works fine with go install