Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions definition/definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ type Result struct {

// Definition defines an API handler.
type Definition struct {
// OperationID is Unique string used to identify the operation. The OperationID MUST be unique among all operations described in the API.
OperationID string
// Method is definition method.
Method Method
// Consumes indicates how many content types the handler can consume.
Expand Down
1 change: 1 addition & 0 deletions service/rest/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ func (b *builder) addDescriptor(prefix string, consumes []string, produces []str
func (b *builder) copyDefinition(d *definition.Definition, consumes []string, produces []string, tags []string) *definition.Definition {
newOne := &definition.Definition{
Method: d.Method,
OperationID: d.OperationID,
Summary: d.Summary,
Function: d.Function,
Description: d.Description,
Expand Down
3 changes: 3 additions & 0 deletions utils/api/definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ type Definition struct {
HTTPMethod string
// HTTPCode is http success code.
HTTPCode int
// OperationID is Unique string used to identify the operation. The OperationID MUST be unique among all operations described in the API.
OperationID string
// Summary is a brief of this definition.
Summary string
// Description describes the API handler.
Expand Down Expand Up @@ -99,6 +101,7 @@ func NewDefinition(tc *TypeContainer, d *definition.Definition, apiStyle service
Method: d.Method,
HTTPMethod: service.HTTPMethodFor(d.Method),
HTTPCode: code,
OperationID: d.OperationID,
Summary: d.Summary,
Description: d.Description,
Tags: d.Tags,
Expand Down
1 change: 1 addition & 0 deletions utils/generators/swagger/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ func (g *Generator) operationFor(def *api.Definition) *spec.Operation {
operation.Produces = append(operation.Produces, p)
}
}
operation.ID = def.OperationID
operation.Summary = def.Summary
if operation.Summary == "" {
// Use function name as API summary.
Expand Down