id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
157,600 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/tasks/upload_task_file_responses.go | WithStatusCode | func (o *UploadTaskFileDefault) WithStatusCode(code int) *UploadTaskFileDefault {
o._statusCode = code
return o
} | go | func (o *UploadTaskFileDefault) WithStatusCode(code int) *UploadTaskFileDefault {
o._statusCode = code
return o
} | [
"func",
"(",
"o",
"*",
"UploadTaskFileDefault",
")",
"WithStatusCode",
"(",
"code",
"int",
")",
"*",
"UploadTaskFileDefault",
"{",
"o",
".",
"_statusCode",
"=",
"code",
"\n",
"return",
"o",
"\n",
"}"
] | // WithStatusCode adds the status to the upload task file default response | [
"WithStatusCode",
"adds",
"the",
"status",
"to",
"the",
"upload",
"task",
"file",
"default",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/upload_task_file_responses.go#L69-L72 |
157,601 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/tasks/upload_task_file_responses.go | WithXErrorCode | func (o *UploadTaskFileDefault) WithXErrorCode(xErrorCode string) *UploadTaskFileDefault {
o.XErrorCode = xErrorCode
return o
} | go | func (o *UploadTaskFileDefault) WithXErrorCode(xErrorCode string) *UploadTaskFileDefault {
o.XErrorCode = xErrorCode
return o
} | [
"func",
"(",
"o",
"*",
"UploadTaskFileDefault",
")",
"WithXErrorCode",
"(",
"xErrorCode",
"string",
")",
"*",
"UploadTaskFileDefault",
"{",
"o",
".",
"XErrorCode",
"=",
"xErrorCode",
"\n",
"return",
"o",
"\n",
"}"
] | // WithXErrorCode adds the xErrorCode to the upload task file default response | [
"WithXErrorCode",
"adds",
"the",
"xErrorCode",
"to",
"the",
"upload",
"task",
"file",
"default",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/upload_task_file_responses.go#L80-L83 |
157,602 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/tasks/upload_task_file_responses.go | WithPayload | func (o *UploadTaskFileDefault) WithPayload(payload *models.Error) *UploadTaskFileDefault {
o.Payload = payload
return o
} | go | func (o *UploadTaskFileDefault) WithPayload(payload *models.Error) *UploadTaskFileDefault {
o.Payload = payload
return o
} | [
"func",
"(",
"o",
"*",
"UploadTaskFileDefault",
")",
"WithPayload",
"(",
"payload",
"*",
"models",
".",
"Error",
")",
"*",
"UploadTaskFileDefault",
"{",
"o",
".",
"Payload",
"=",
"payload",
"\n",
"return",
"o",
"\n",
"}"
] | // WithPayload adds the payload to the upload task file default response | [
"WithPayload",
"adds",
"the",
"payload",
"to",
"the",
"upload",
"task",
"file",
"default",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/upload_task_file_responses.go#L91-L94 |
157,603 | go-swagger/go-swagger | examples/contributed-templates/stratoscale/restapi/operations/store/order_delete.go | NewOrderDelete | func NewOrderDelete(ctx *middleware.Context, handler OrderDeleteHandler) *OrderDelete {
return &OrderDelete{Context: ctx, Handler: handler}
} | go | func NewOrderDelete(ctx *middleware.Context, handler OrderDeleteHandler) *OrderDelete {
return &OrderDelete{Context: ctx, Handler: handler}
} | [
"func",
"NewOrderDelete",
"(",
"ctx",
"*",
"middleware",
".",
"Context",
",",
"handler",
"OrderDeleteHandler",
")",
"*",
"OrderDelete",
"{",
"return",
"&",
"OrderDelete",
"{",
"Context",
":",
"ctx",
",",
"Handler",
":",
"handler",
"}",
"\n",
"}"
] | // NewOrderDelete creates a new http.Handler for the order delete operation | [
"NewOrderDelete",
"creates",
"a",
"new",
"http",
".",
"Handler",
"for",
"the",
"order",
"delete",
"operation"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/restapi/operations/store/order_delete.go#L28-L30 |
157,604 | go-swagger/go-swagger | examples/generated/restapi/operations/user/login_user_parameters.go | bindPassword | func (o *LoginUserParams) bindPassword(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
// AllowEmptyValue: false
if raw == "" { // empty values pass all other validations
return nil
}
o.Password = &raw
return nil
} | go | func (o *LoginUserParams) bindPassword(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
// AllowEmptyValue: false
if raw == "" { // empty values pass all other validations
return nil
}
o.Password = &raw
return nil
} | [
"func",
"(",
"o",
"*",
"LoginUserParams",
")",
"bindPassword",
"(",
"rawData",
"[",
"]",
"string",
",",
"hasKey",
"bool",
",",
"formats",
"strfmt",
".",
"Registry",
")",
"error",
"{",
"var",
"raw",
"string",
"\n",
"if",
"len",
"(",
"rawData",
")",
">",... | // bindPassword binds and validates parameter Password from query. | [
"bindPassword",
"binds",
"and",
"validates",
"parameter",
"Password",
"from",
"query",
"."
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/user/login_user_parameters.go#L72-L87 |
157,605 | go-swagger/go-swagger | examples/tutorials/todo-list/server-complete/restapi/operations/todos/find_todos_responses.go | WithPayload | func (o *FindTodosOK) WithPayload(payload []*models.Item) *FindTodosOK {
o.Payload = payload
return o
} | go | func (o *FindTodosOK) WithPayload(payload []*models.Item) *FindTodosOK {
o.Payload = payload
return o
} | [
"func",
"(",
"o",
"*",
"FindTodosOK",
")",
"WithPayload",
"(",
"payload",
"[",
"]",
"*",
"models",
".",
"Item",
")",
"*",
"FindTodosOK",
"{",
"o",
".",
"Payload",
"=",
"payload",
"\n",
"return",
"o",
"\n",
"}"
] | // WithPayload adds the payload to the find todos o k response | [
"WithPayload",
"adds",
"the",
"payload",
"to",
"the",
"find",
"todos",
"o",
"k",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/tutorials/todo-list/server-complete/restapi/operations/todos/find_todos_responses.go#L38-L41 |
157,606 | go-swagger/go-swagger | examples/tutorials/todo-list/server-complete/restapi/operations/todos/find_todos_responses.go | WithStatusCode | func (o *FindTodosDefault) WithStatusCode(code int) *FindTodosDefault {
o._statusCode = code
return o
} | go | func (o *FindTodosDefault) WithStatusCode(code int) *FindTodosDefault {
o._statusCode = code
return o
} | [
"func",
"(",
"o",
"*",
"FindTodosDefault",
")",
"WithStatusCode",
"(",
"code",
"int",
")",
"*",
"FindTodosDefault",
"{",
"o",
".",
"_statusCode",
"=",
"code",
"\n",
"return",
"o",
"\n",
"}"
] | // WithStatusCode adds the status to the find todos default response | [
"WithStatusCode",
"adds",
"the",
"status",
"to",
"the",
"find",
"todos",
"default",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/tutorials/todo-list/server-complete/restapi/operations/todos/find_todos_responses.go#L88-L91 |
157,607 | go-swagger/go-swagger | examples/tutorials/todo-list/server-complete/restapi/operations/todos/find_todos_responses.go | WithPayload | func (o *FindTodosDefault) WithPayload(payload *models.Error) *FindTodosDefault {
o.Payload = payload
return o
} | go | func (o *FindTodosDefault) WithPayload(payload *models.Error) *FindTodosDefault {
o.Payload = payload
return o
} | [
"func",
"(",
"o",
"*",
"FindTodosDefault",
")",
"WithPayload",
"(",
"payload",
"*",
"models",
".",
"Error",
")",
"*",
"FindTodosDefault",
"{",
"o",
".",
"Payload",
"=",
"payload",
"\n",
"return",
"o",
"\n",
"}"
] | // WithPayload adds the payload to the find todos default response | [
"WithPayload",
"adds",
"the",
"payload",
"to",
"the",
"find",
"todos",
"default",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/tutorials/todo-list/server-complete/restapi/operations/todos/find_todos_responses.go#L99-L102 |
157,608 | go-swagger/go-swagger | examples/generated/restapi/operations/user/logout_user.go | NewLogoutUser | func NewLogoutUser(ctx *middleware.Context, handler LogoutUserHandler) *LogoutUser {
return &LogoutUser{Context: ctx, Handler: handler}
} | go | func NewLogoutUser(ctx *middleware.Context, handler LogoutUserHandler) *LogoutUser {
return &LogoutUser{Context: ctx, Handler: handler}
} | [
"func",
"NewLogoutUser",
"(",
"ctx",
"*",
"middleware",
".",
"Context",
",",
"handler",
"LogoutUserHandler",
")",
"*",
"LogoutUser",
"{",
"return",
"&",
"LogoutUser",
"{",
"Context",
":",
"ctx",
",",
"Handler",
":",
"handler",
"}",
"\n",
"}"
] | // NewLogoutUser creates a new http.Handler for the logout user operation | [
"NewLogoutUser",
"creates",
"a",
"new",
"http",
".",
"Handler",
"for",
"the",
"logout",
"user",
"operation"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/user/logout_user.go#L28-L30 |
157,609 | go-swagger/go-swagger | examples/composed-auth/restapi/operations/add_order.go | NewAddOrder | func NewAddOrder(ctx *middleware.Context, handler AddOrderHandler) *AddOrder {
return &AddOrder{Context: ctx, Handler: handler}
} | go | func NewAddOrder(ctx *middleware.Context, handler AddOrderHandler) *AddOrder {
return &AddOrder{Context: ctx, Handler: handler}
} | [
"func",
"NewAddOrder",
"(",
"ctx",
"*",
"middleware",
".",
"Context",
",",
"handler",
"AddOrderHandler",
")",
"*",
"AddOrder",
"{",
"return",
"&",
"AddOrder",
"{",
"Context",
":",
"ctx",
",",
"Handler",
":",
"handler",
"}",
"\n",
"}"
] | // NewAddOrder creates a new http.Handler for the add order operation | [
"NewAddOrder",
"creates",
"a",
"new",
"http",
".",
"Handler",
"for",
"the",
"add",
"order",
"operation"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/composed-auth/restapi/operations/add_order.go#L30-L32 |
157,610 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/tasks/update_task.go | NewUpdateTask | func NewUpdateTask(ctx *middleware.Context, handler UpdateTaskHandler) *UpdateTask {
return &UpdateTask{Context: ctx, Handler: handler}
} | go | func NewUpdateTask(ctx *middleware.Context, handler UpdateTaskHandler) *UpdateTask {
return &UpdateTask{Context: ctx, Handler: handler}
} | [
"func",
"NewUpdateTask",
"(",
"ctx",
"*",
"middleware",
".",
"Context",
",",
"handler",
"UpdateTaskHandler",
")",
"*",
"UpdateTask",
"{",
"return",
"&",
"UpdateTask",
"{",
"Context",
":",
"ctx",
",",
"Handler",
":",
"handler",
"}",
"\n",
"}"
] | // NewUpdateTask creates a new http.Handler for the update task operation | [
"NewUpdateTask",
"creates",
"a",
"new",
"http",
".",
"Handler",
"for",
"the",
"update",
"task",
"operation"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/update_task.go#L28-L30 |
157,611 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/tasks/create_task_responses.go | WithStatusCode | func (o *CreateTaskDefault) WithStatusCode(code int) *CreateTaskDefault {
o._statusCode = code
return o
} | go | func (o *CreateTaskDefault) WithStatusCode(code int) *CreateTaskDefault {
o._statusCode = code
return o
} | [
"func",
"(",
"o",
"*",
"CreateTaskDefault",
")",
"WithStatusCode",
"(",
"code",
"int",
")",
"*",
"CreateTaskDefault",
"{",
"o",
".",
"_statusCode",
"=",
"code",
"\n",
"return",
"o",
"\n",
"}"
] | // WithStatusCode adds the status to the create task default response | [
"WithStatusCode",
"adds",
"the",
"status",
"to",
"the",
"create",
"task",
"default",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/create_task_responses.go#L69-L72 |
157,612 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/tasks/create_task_responses.go | WithXErrorCode | func (o *CreateTaskDefault) WithXErrorCode(xErrorCode string) *CreateTaskDefault {
o.XErrorCode = xErrorCode
return o
} | go | func (o *CreateTaskDefault) WithXErrorCode(xErrorCode string) *CreateTaskDefault {
o.XErrorCode = xErrorCode
return o
} | [
"func",
"(",
"o",
"*",
"CreateTaskDefault",
")",
"WithXErrorCode",
"(",
"xErrorCode",
"string",
")",
"*",
"CreateTaskDefault",
"{",
"o",
".",
"XErrorCode",
"=",
"xErrorCode",
"\n",
"return",
"o",
"\n",
"}"
] | // WithXErrorCode adds the xErrorCode to the create task default response | [
"WithXErrorCode",
"adds",
"the",
"xErrorCode",
"to",
"the",
"create",
"task",
"default",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/create_task_responses.go#L80-L83 |
157,613 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/tasks/create_task_responses.go | WithPayload | func (o *CreateTaskDefault) WithPayload(payload *models.Error) *CreateTaskDefault {
o.Payload = payload
return o
} | go | func (o *CreateTaskDefault) WithPayload(payload *models.Error) *CreateTaskDefault {
o.Payload = payload
return o
} | [
"func",
"(",
"o",
"*",
"CreateTaskDefault",
")",
"WithPayload",
"(",
"payload",
"*",
"models",
".",
"Error",
")",
"*",
"CreateTaskDefault",
"{",
"o",
".",
"Payload",
"=",
"payload",
"\n",
"return",
"o",
"\n",
"}"
] | // WithPayload adds the payload to the create task default response | [
"WithPayload",
"adds",
"the",
"payload",
"to",
"the",
"create",
"task",
"default",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/create_task_responses.go#L91-L94 |
157,614 | go-swagger/go-swagger | examples/contributed-templates/stratoscale/restapi/operations/pet/pet_upload_image_responses.go | WithPayload | func (o *PetUploadImageOK) WithPayload(payload *models.APIResponse) *PetUploadImageOK {
o.Payload = payload
return o
} | go | func (o *PetUploadImageOK) WithPayload(payload *models.APIResponse) *PetUploadImageOK {
o.Payload = payload
return o
} | [
"func",
"(",
"o",
"*",
"PetUploadImageOK",
")",
"WithPayload",
"(",
"payload",
"*",
"models",
".",
"APIResponse",
")",
"*",
"PetUploadImageOK",
"{",
"o",
".",
"Payload",
"=",
"payload",
"\n",
"return",
"o",
"\n",
"}"
] | // WithPayload adds the payload to the pet upload image o k response | [
"WithPayload",
"adds",
"the",
"payload",
"to",
"the",
"pet",
"upload",
"image",
"o",
"k",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/restapi/operations/pet/pet_upload_image_responses.go#L38-L41 |
157,615 | go-swagger/go-swagger | examples/contributed-templates/stratoscale/restapi/operations/pet/pet_list_responses.go | WithPayload | func (o *PetListOK) WithPayload(payload []*models.Pet) *PetListOK {
o.Payload = payload
return o
} | go | func (o *PetListOK) WithPayload(payload []*models.Pet) *PetListOK {
o.Payload = payload
return o
} | [
"func",
"(",
"o",
"*",
"PetListOK",
")",
"WithPayload",
"(",
"payload",
"[",
"]",
"*",
"models",
".",
"Pet",
")",
"*",
"PetListOK",
"{",
"o",
".",
"Payload",
"=",
"payload",
"\n",
"return",
"o",
"\n",
"}"
] | // WithPayload adds the payload to the pet list o k response | [
"WithPayload",
"adds",
"the",
"payload",
"to",
"the",
"pet",
"list",
"o",
"k",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/restapi/operations/pet/pet_list_responses.go#L38-L41 |
157,616 | go-swagger/go-swagger | examples/task-tracker/models/user_card.go | Validate | func (m *UserCard) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateAvailableKarma(formats); err != nil {
res = append(res, err)
}
if err := m.validateID(formats); err != nil {
res = append(res, err)
}
if err := m.validateScreenName(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
} | go | func (m *UserCard) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateAvailableKarma(formats); err != nil {
res = append(res, err)
}
if err := m.validateID(formats); err != nil {
res = append(res, err)
}
if err := m.validateScreenName(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
} | [
"func",
"(",
"m",
"*",
"UserCard",
")",
"Validate",
"(",
"formats",
"strfmt",
".",
"Registry",
")",
"error",
"{",
"var",
"res",
"[",
"]",
"error",
"\n\n",
"if",
"err",
":=",
"m",
".",
"validateAvailableKarma",
"(",
"formats",
")",
";",
"err",
"!=",
"... | // Validate validates this user card | [
"Validate",
"validates",
"this",
"user",
"card"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/models/user_card.go#L63-L82 |
157,617 | go-swagger/go-swagger | examples/task-tracker/models/comment.go | Validate | func (m *Comment) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateContent(formats); err != nil {
res = append(res, err)
}
if err := m.validateCreatedAt(formats); err != nil {
res = append(res, err)
}
if err := m.validateUser(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
} | go | func (m *Comment) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateContent(formats); err != nil {
res = append(res, err)
}
if err := m.validateCreatedAt(formats); err != nil {
res = append(res, err)
}
if err := m.validateUser(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
} | [
"func",
"(",
"m",
"*",
"Comment",
")",
"Validate",
"(",
"formats",
"strfmt",
".",
"Registry",
")",
"error",
"{",
"var",
"res",
"[",
"]",
"error",
"\n\n",
"if",
"err",
":=",
"m",
".",
"validateContent",
"(",
"formats",
")",
";",
"err",
"!=",
"nil",
... | // Validate validates this comment | [
"Validate",
"validates",
"this",
"comment"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/models/comment.go#L43-L62 |
157,618 | go-swagger/go-swagger | examples/authentication/models/customer.go | Validate | func (m *Customer) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCustomerID(formats); err != nil {
res = append(res, err)
}
if err := m.validateFipsCode(formats); err != nil {
res = append(res, err)
}
if err := m.validateName(formats); err != nil {
res = append(res, err)
}
if err := m.validateSsn(formats); err != nil {
res = append(res, err)
}
if err := m.validateSurname(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
} | go | func (m *Customer) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCustomerID(formats); err != nil {
res = append(res, err)
}
if err := m.validateFipsCode(formats); err != nil {
res = append(res, err)
}
if err := m.validateName(formats); err != nil {
res = append(res, err)
}
if err := m.validateSsn(formats); err != nil {
res = append(res, err)
}
if err := m.validateSurname(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
} | [
"func",
"(",
"m",
"*",
"Customer",
")",
"Validate",
"(",
"formats",
"strfmt",
".",
"Registry",
")",
"error",
"{",
"var",
"res",
"[",
"]",
"error",
"\n\n",
"if",
"err",
":=",
"m",
".",
"validateCustomerID",
"(",
"formats",
")",
";",
"err",
"!=",
"nil"... | // Validate validates this customer | [
"Validate",
"validates",
"this",
"customer"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/authentication/models/customer.go#L50-L77 |
157,619 | go-swagger/go-swagger | examples/contributed-templates/stratoscale/client/pet/pet_create_parameters.go | WithTimeout | func (o *PetCreateParams) WithTimeout(timeout time.Duration) *PetCreateParams {
o.SetTimeout(timeout)
return o
} | go | func (o *PetCreateParams) WithTimeout(timeout time.Duration) *PetCreateParams {
o.SetTimeout(timeout)
return o
} | [
"func",
"(",
"o",
"*",
"PetCreateParams",
")",
"WithTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"*",
"PetCreateParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithTimeout adds the timeout to the pet create params | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"pet",
"create",
"params"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_create_parameters.go#L78-L81 |
157,620 | go-swagger/go-swagger | examples/contributed-templates/stratoscale/client/pet/pet_create_parameters.go | WithContext | func (o *PetCreateParams) WithContext(ctx context.Context) *PetCreateParams {
o.SetContext(ctx)
return o
} | go | func (o *PetCreateParams) WithContext(ctx context.Context) *PetCreateParams {
o.SetContext(ctx)
return o
} | [
"func",
"(",
"o",
"*",
"PetCreateParams",
")",
"WithContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"PetCreateParams",
"{",
"o",
".",
"SetContext",
"(",
"ctx",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithContext adds the context to the pet create params | [
"WithContext",
"adds",
"the",
"context",
"to",
"the",
"pet",
"create",
"params"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_create_parameters.go#L89-L92 |
157,621 | go-swagger/go-swagger | examples/contributed-templates/stratoscale/client/pet/pet_create_parameters.go | WithHTTPClient | func (o *PetCreateParams) WithHTTPClient(client *http.Client) *PetCreateParams {
o.SetHTTPClient(client)
return o
} | go | func (o *PetCreateParams) WithHTTPClient(client *http.Client) *PetCreateParams {
o.SetHTTPClient(client)
return o
} | [
"func",
"(",
"o",
"*",
"PetCreateParams",
")",
"WithHTTPClient",
"(",
"client",
"*",
"http",
".",
"Client",
")",
"*",
"PetCreateParams",
"{",
"o",
".",
"SetHTTPClient",
"(",
"client",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithHTTPClient adds the HTTPClient to the pet create params | [
"WithHTTPClient",
"adds",
"the",
"HTTPClient",
"to",
"the",
"pet",
"create",
"params"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_create_parameters.go#L100-L103 |
157,622 | go-swagger/go-swagger | examples/contributed-templates/stratoscale/client/pet/pet_create_parameters.go | WithBody | func (o *PetCreateParams) WithBody(body *models.Pet) *PetCreateParams {
o.SetBody(body)
return o
} | go | func (o *PetCreateParams) WithBody(body *models.Pet) *PetCreateParams {
o.SetBody(body)
return o
} | [
"func",
"(",
"o",
"*",
"PetCreateParams",
")",
"WithBody",
"(",
"body",
"*",
"models",
".",
"Pet",
")",
"*",
"PetCreateParams",
"{",
"o",
".",
"SetBody",
"(",
"body",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithBody adds the body to the pet create params | [
"WithBody",
"adds",
"the",
"body",
"to",
"the",
"pet",
"create",
"params"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_create_parameters.go#L111-L114 |
157,623 | go-swagger/go-swagger | examples/tutorials/todo-list/server-complete/restapi/operations/todos/destroy_one.go | NewDestroyOne | func NewDestroyOne(ctx *middleware.Context, handler DestroyOneHandler) *DestroyOne {
return &DestroyOne{Context: ctx, Handler: handler}
} | go | func NewDestroyOne(ctx *middleware.Context, handler DestroyOneHandler) *DestroyOne {
return &DestroyOne{Context: ctx, Handler: handler}
} | [
"func",
"NewDestroyOne",
"(",
"ctx",
"*",
"middleware",
".",
"Context",
",",
"handler",
"DestroyOneHandler",
")",
"*",
"DestroyOne",
"{",
"return",
"&",
"DestroyOne",
"{",
"Context",
":",
"ctx",
",",
"Handler",
":",
"handler",
"}",
"\n",
"}"
] | // NewDestroyOne creates a new http.Handler for the destroy one operation | [
"NewDestroyOne",
"creates",
"a",
"new",
"http",
".",
"Handler",
"for",
"the",
"destroy",
"one",
"operation"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/tutorials/todo-list/server-complete/restapi/operations/todos/destroy_one.go#L28-L30 |
157,624 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/tasks/list_tasks_responses.go | WithXLastTaskID | func (o *ListTasksOK) WithXLastTaskID(xLastTaskID int64) *ListTasksOK {
o.XLastTaskID = xLastTaskID
return o
} | go | func (o *ListTasksOK) WithXLastTaskID(xLastTaskID int64) *ListTasksOK {
o.XLastTaskID = xLastTaskID
return o
} | [
"func",
"(",
"o",
"*",
"ListTasksOK",
")",
"WithXLastTaskID",
"(",
"xLastTaskID",
"int64",
")",
"*",
"ListTasksOK",
"{",
"o",
".",
"XLastTaskID",
"=",
"xLastTaskID",
"\n",
"return",
"o",
"\n",
"}"
] | // WithXLastTaskID adds the xLastTaskId to the list tasks o k response | [
"WithXLastTaskID",
"adds",
"the",
"xLastTaskId",
"to",
"the",
"list",
"tasks",
"o",
"k",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/list_tasks_responses.go#L43-L46 |
157,625 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/tasks/list_tasks_responses.go | WithPayload | func (o *ListTasksOK) WithPayload(payload []*models.TaskCard) *ListTasksOK {
o.Payload = payload
return o
} | go | func (o *ListTasksOK) WithPayload(payload []*models.TaskCard) *ListTasksOK {
o.Payload = payload
return o
} | [
"func",
"(",
"o",
"*",
"ListTasksOK",
")",
"WithPayload",
"(",
"payload",
"[",
"]",
"*",
"models",
".",
"TaskCard",
")",
"*",
"ListTasksOK",
"{",
"o",
".",
"Payload",
"=",
"payload",
"\n",
"return",
"o",
"\n",
"}"
] | // WithPayload adds the payload to the list tasks o k response | [
"WithPayload",
"adds",
"the",
"payload",
"to",
"the",
"list",
"tasks",
"o",
"k",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/list_tasks_responses.go#L54-L57 |
157,626 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/tasks/list_tasks_responses.go | WithPayload | func (o *ListTasksUnprocessableEntity) WithPayload(payload *models.ValidationError) *ListTasksUnprocessableEntity {
o.Payload = payload
return o
} | go | func (o *ListTasksUnprocessableEntity) WithPayload(payload *models.ValidationError) *ListTasksUnprocessableEntity {
o.Payload = payload
return o
} | [
"func",
"(",
"o",
"*",
"ListTasksUnprocessableEntity",
")",
"WithPayload",
"(",
"payload",
"*",
"models",
".",
"ValidationError",
")",
"*",
"ListTasksUnprocessableEntity",
"{",
"o",
".",
"Payload",
"=",
"payload",
"\n",
"return",
"o",
"\n",
"}"
] | // WithPayload adds the payload to the list tasks unprocessable entity response | [
"WithPayload",
"adds",
"the",
"payload",
"to",
"the",
"list",
"tasks",
"unprocessable",
"entity",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/list_tasks_responses.go#L108-L111 |
157,627 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/tasks/list_tasks_responses.go | WithStatusCode | func (o *ListTasksDefault) WithStatusCode(code int) *ListTasksDefault {
o._statusCode = code
return o
} | go | func (o *ListTasksDefault) WithStatusCode(code int) *ListTasksDefault {
o._statusCode = code
return o
} | [
"func",
"(",
"o",
"*",
"ListTasksDefault",
")",
"WithStatusCode",
"(",
"code",
"int",
")",
"*",
"ListTasksDefault",
"{",
"o",
".",
"_statusCode",
"=",
"code",
"\n",
"return",
"o",
"\n",
"}"
] | // WithStatusCode adds the status to the list tasks default response | [
"WithStatusCode",
"adds",
"the",
"status",
"to",
"the",
"list",
"tasks",
"default",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/list_tasks_responses.go#L159-L162 |
157,628 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/tasks/list_tasks_responses.go | WithXErrorCode | func (o *ListTasksDefault) WithXErrorCode(xErrorCode string) *ListTasksDefault {
o.XErrorCode = xErrorCode
return o
} | go | func (o *ListTasksDefault) WithXErrorCode(xErrorCode string) *ListTasksDefault {
o.XErrorCode = xErrorCode
return o
} | [
"func",
"(",
"o",
"*",
"ListTasksDefault",
")",
"WithXErrorCode",
"(",
"xErrorCode",
"string",
")",
"*",
"ListTasksDefault",
"{",
"o",
".",
"XErrorCode",
"=",
"xErrorCode",
"\n",
"return",
"o",
"\n",
"}"
] | // WithXErrorCode adds the xErrorCode to the list tasks default response | [
"WithXErrorCode",
"adds",
"the",
"xErrorCode",
"to",
"the",
"list",
"tasks",
"default",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/list_tasks_responses.go#L170-L173 |
157,629 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/tasks/list_tasks_responses.go | WithPayload | func (o *ListTasksDefault) WithPayload(payload *models.Error) *ListTasksDefault {
o.Payload = payload
return o
} | go | func (o *ListTasksDefault) WithPayload(payload *models.Error) *ListTasksDefault {
o.Payload = payload
return o
} | [
"func",
"(",
"o",
"*",
"ListTasksDefault",
")",
"WithPayload",
"(",
"payload",
"*",
"models",
".",
"Error",
")",
"*",
"ListTasksDefault",
"{",
"o",
".",
"Payload",
"=",
"payload",
"\n",
"return",
"o",
"\n",
"}"
] | // WithPayload adds the payload to the list tasks default response | [
"WithPayload",
"adds",
"the",
"payload",
"to",
"the",
"list",
"tasks",
"default",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/list_tasks_responses.go#L181-L184 |
157,630 | go-swagger/go-swagger | fixtures/goparsing/petstore/petstore-fixture/main.go | main | func main() {
// this has no real purpose besides making the import present in this main package.
// without this line the meta info for the swagger doc wouldn't be discovered
petstore.APIVersion = Version
// This servers na hypothetical API
if err := rest.ServeAPI(); err != nil {
log.Fatal(err)
}
} | go | func main() {
// this has no real purpose besides making the import present in this main package.
// without this line the meta info for the swagger doc wouldn't be discovered
petstore.APIVersion = Version
// This servers na hypothetical API
if err := rest.ServeAPI(); err != nil {
log.Fatal(err)
}
} | [
"func",
"main",
"(",
")",
"{",
"// this has no real purpose besides making the import present in this main package.",
"// without this line the meta info for the swagger doc wouldn't be discovered",
"petstore",
".",
"APIVersion",
"=",
"Version",
"\n\n",
"// This servers na hypothetical API... | // This is an application that doesn't actually do anything,
// it's used for testing the scanner | [
"This",
"is",
"an",
"application",
"that",
"doesn",
"t",
"actually",
"do",
"anything",
"it",
"s",
"used",
"for",
"testing",
"the",
"scanner"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/fixtures/goparsing/petstore/petstore-fixture/main.go#L31-L40 |
157,631 | go-swagger/go-swagger | examples/todo-list/client/todos/add_one_parameters.go | WithTimeout | func (o *AddOneParams) WithTimeout(timeout time.Duration) *AddOneParams {
o.SetTimeout(timeout)
return o
} | go | func (o *AddOneParams) WithTimeout(timeout time.Duration) *AddOneParams {
o.SetTimeout(timeout)
return o
} | [
"func",
"(",
"o",
"*",
"AddOneParams",
")",
"WithTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"*",
"AddOneParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithTimeout adds the timeout to the add one params | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"add",
"one",
"params"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/todo-list/client/todos/add_one_parameters.go#L75-L78 |
157,632 | go-swagger/go-swagger | examples/todo-list/client/todos/add_one_parameters.go | WithContext | func (o *AddOneParams) WithContext(ctx context.Context) *AddOneParams {
o.SetContext(ctx)
return o
} | go | func (o *AddOneParams) WithContext(ctx context.Context) *AddOneParams {
o.SetContext(ctx)
return o
} | [
"func",
"(",
"o",
"*",
"AddOneParams",
")",
"WithContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"AddOneParams",
"{",
"o",
".",
"SetContext",
"(",
"ctx",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithContext adds the context to the add one params | [
"WithContext",
"adds",
"the",
"context",
"to",
"the",
"add",
"one",
"params"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/todo-list/client/todos/add_one_parameters.go#L86-L89 |
157,633 | go-swagger/go-swagger | examples/todo-list/client/todos/add_one_parameters.go | WithHTTPClient | func (o *AddOneParams) WithHTTPClient(client *http.Client) *AddOneParams {
o.SetHTTPClient(client)
return o
} | go | func (o *AddOneParams) WithHTTPClient(client *http.Client) *AddOneParams {
o.SetHTTPClient(client)
return o
} | [
"func",
"(",
"o",
"*",
"AddOneParams",
")",
"WithHTTPClient",
"(",
"client",
"*",
"http",
".",
"Client",
")",
"*",
"AddOneParams",
"{",
"o",
".",
"SetHTTPClient",
"(",
"client",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithHTTPClient adds the HTTPClient to the add one params | [
"WithHTTPClient",
"adds",
"the",
"HTTPClient",
"to",
"the",
"add",
"one",
"params"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/todo-list/client/todos/add_one_parameters.go#L97-L100 |
157,634 | go-swagger/go-swagger | examples/todo-list/client/todos/add_one_parameters.go | WithBody | func (o *AddOneParams) WithBody(body *models.Item) *AddOneParams {
o.SetBody(body)
return o
} | go | func (o *AddOneParams) WithBody(body *models.Item) *AddOneParams {
o.SetBody(body)
return o
} | [
"func",
"(",
"o",
"*",
"AddOneParams",
")",
"WithBody",
"(",
"body",
"*",
"models",
".",
"Item",
")",
"*",
"AddOneParams",
"{",
"o",
".",
"SetBody",
"(",
"body",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithBody adds the body to the add one params | [
"WithBody",
"adds",
"the",
"body",
"to",
"the",
"add",
"one",
"params"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/todo-list/client/todos/add_one_parameters.go#L108-L111 |
157,635 | go-swagger/go-swagger | examples/composed-auth/restapi/operations/get_items.go | NewGetItems | func NewGetItems(ctx *middleware.Context, handler GetItemsHandler) *GetItems {
return &GetItems{Context: ctx, Handler: handler}
} | go | func NewGetItems(ctx *middleware.Context, handler GetItemsHandler) *GetItems {
return &GetItems{Context: ctx, Handler: handler}
} | [
"func",
"NewGetItems",
"(",
"ctx",
"*",
"middleware",
".",
"Context",
",",
"handler",
"GetItemsHandler",
")",
"*",
"GetItems",
"{",
"return",
"&",
"GetItems",
"{",
"Context",
":",
"ctx",
",",
"Handler",
":",
"handler",
"}",
"\n",
"}"
] | // NewGetItems creates a new http.Handler for the get items operation | [
"NewGetItems",
"creates",
"a",
"new",
"http",
".",
"Handler",
"for",
"the",
"get",
"items",
"operation"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/composed-auth/restapi/operations/get_items.go#L28-L30 |
157,636 | go-swagger/go-swagger | examples/generated/restapi/operations/user/create_users_with_array_input.go | NewCreateUsersWithArrayInput | func NewCreateUsersWithArrayInput(ctx *middleware.Context, handler CreateUsersWithArrayInputHandler) *CreateUsersWithArrayInput {
return &CreateUsersWithArrayInput{Context: ctx, Handler: handler}
} | go | func NewCreateUsersWithArrayInput(ctx *middleware.Context, handler CreateUsersWithArrayInputHandler) *CreateUsersWithArrayInput {
return &CreateUsersWithArrayInput{Context: ctx, Handler: handler}
} | [
"func",
"NewCreateUsersWithArrayInput",
"(",
"ctx",
"*",
"middleware",
".",
"Context",
",",
"handler",
"CreateUsersWithArrayInputHandler",
")",
"*",
"CreateUsersWithArrayInput",
"{",
"return",
"&",
"CreateUsersWithArrayInput",
"{",
"Context",
":",
"ctx",
",",
"Handler",... | // NewCreateUsersWithArrayInput creates a new http.Handler for the create users with array input operation | [
"NewCreateUsersWithArrayInput",
"creates",
"a",
"new",
"http",
".",
"Handler",
"for",
"the",
"create",
"users",
"with",
"array",
"input",
"operation"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/user/create_users_with_array_input.go#L28-L30 |
157,637 | go-swagger/go-swagger | examples/composed-auth/models/order.go | Validate | func (m *OrderLine) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validatePurchasedItem(formats); err != nil {
res = append(res, err)
}
if err := m.validateQuantity(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
} | go | func (m *OrderLine) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validatePurchasedItem(formats); err != nil {
res = append(res, err)
}
if err := m.validateQuantity(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
} | [
"func",
"(",
"m",
"*",
"OrderLine",
")",
"Validate",
"(",
"formats",
"strfmt",
".",
"Registry",
")",
"error",
"{",
"var",
"res",
"[",
"]",
"error",
"\n\n",
"if",
"err",
":=",
"m",
".",
"validatePurchasedItem",
"(",
"formats",
")",
";",
"err",
"!=",
"... | // Validate validates this order line | [
"Validate",
"validates",
"this",
"order",
"line"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/composed-auth/models/order.go#L115-L130 |
157,638 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/task_tracker_api.go | NewTaskTrackerAPI | func NewTaskTrackerAPI(spec *loads.Document) *TaskTrackerAPI {
return &TaskTrackerAPI{
handlers: make(map[string]map[string]http.Handler),
formats: strfmt.Default,
defaultConsumes: "application/json",
defaultProduces: "application/json",
customConsumers: make(map[string]runtime.Consumer),
customProducers: make(map[string]runtime.Producer),
ServerShutdown: func() {},
spec: spec,
ServeError: errors.ServeError,
BasicAuthenticator: security.BasicAuth,
APIKeyAuthenticator: security.APIKeyAuth,
BearerAuthenticator: security.BearerAuth,
JSONConsumer: runtime.JSONConsumer(),
MultipartformConsumer: runtime.DiscardConsumer,
JSONProducer: runtime.JSONProducer(),
TasksAddCommentToTaskHandler: tasks.AddCommentToTaskHandlerFunc(func(params tasks.AddCommentToTaskParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation TasksAddCommentToTask has not yet been implemented")
}),
TasksCreateTaskHandler: tasks.CreateTaskHandlerFunc(func(params tasks.CreateTaskParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation TasksCreateTask has not yet been implemented")
}),
TasksDeleteTaskHandler: tasks.DeleteTaskHandlerFunc(func(params tasks.DeleteTaskParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation TasksDeleteTask has not yet been implemented")
}),
TasksGetTaskCommentsHandler: tasks.GetTaskCommentsHandlerFunc(func(params tasks.GetTaskCommentsParams) middleware.Responder {
return middleware.NotImplemented("operation TasksGetTaskComments has not yet been implemented")
}),
TasksGetTaskDetailsHandler: tasks.GetTaskDetailsHandlerFunc(func(params tasks.GetTaskDetailsParams) middleware.Responder {
return middleware.NotImplemented("operation TasksGetTaskDetails has not yet been implemented")
}),
TasksListTasksHandler: tasks.ListTasksHandlerFunc(func(params tasks.ListTasksParams) middleware.Responder {
return middleware.NotImplemented("operation TasksListTasks has not yet been implemented")
}),
TasksUpdateTaskHandler: tasks.UpdateTaskHandlerFunc(func(params tasks.UpdateTaskParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation TasksUpdateTask has not yet been implemented")
}),
TasksUploadTaskFileHandler: tasks.UploadTaskFileHandlerFunc(func(params tasks.UploadTaskFileParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation TasksUploadTaskFile has not yet been implemented")
}),
// Applies when the "token" query is set
APIKeyAuth: func(token string) (interface{}, error) {
return nil, errors.NotImplemented("api key auth (api_key) token from query param [token] has not yet been implemented")
},
// Applies when the "X-Token" header is set
TokenHeaderAuth: func(token string) (interface{}, error) {
return nil, errors.NotImplemented("api key auth (token_header) X-Token from header param [X-Token] has not yet been implemented")
},
// default authorizer is authorized meaning no requests are blocked
APIAuthorizer: security.Authorized(),
}
} | go | func NewTaskTrackerAPI(spec *loads.Document) *TaskTrackerAPI {
return &TaskTrackerAPI{
handlers: make(map[string]map[string]http.Handler),
formats: strfmt.Default,
defaultConsumes: "application/json",
defaultProduces: "application/json",
customConsumers: make(map[string]runtime.Consumer),
customProducers: make(map[string]runtime.Producer),
ServerShutdown: func() {},
spec: spec,
ServeError: errors.ServeError,
BasicAuthenticator: security.BasicAuth,
APIKeyAuthenticator: security.APIKeyAuth,
BearerAuthenticator: security.BearerAuth,
JSONConsumer: runtime.JSONConsumer(),
MultipartformConsumer: runtime.DiscardConsumer,
JSONProducer: runtime.JSONProducer(),
TasksAddCommentToTaskHandler: tasks.AddCommentToTaskHandlerFunc(func(params tasks.AddCommentToTaskParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation TasksAddCommentToTask has not yet been implemented")
}),
TasksCreateTaskHandler: tasks.CreateTaskHandlerFunc(func(params tasks.CreateTaskParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation TasksCreateTask has not yet been implemented")
}),
TasksDeleteTaskHandler: tasks.DeleteTaskHandlerFunc(func(params tasks.DeleteTaskParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation TasksDeleteTask has not yet been implemented")
}),
TasksGetTaskCommentsHandler: tasks.GetTaskCommentsHandlerFunc(func(params tasks.GetTaskCommentsParams) middleware.Responder {
return middleware.NotImplemented("operation TasksGetTaskComments has not yet been implemented")
}),
TasksGetTaskDetailsHandler: tasks.GetTaskDetailsHandlerFunc(func(params tasks.GetTaskDetailsParams) middleware.Responder {
return middleware.NotImplemented("operation TasksGetTaskDetails has not yet been implemented")
}),
TasksListTasksHandler: tasks.ListTasksHandlerFunc(func(params tasks.ListTasksParams) middleware.Responder {
return middleware.NotImplemented("operation TasksListTasks has not yet been implemented")
}),
TasksUpdateTaskHandler: tasks.UpdateTaskHandlerFunc(func(params tasks.UpdateTaskParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation TasksUpdateTask has not yet been implemented")
}),
TasksUploadTaskFileHandler: tasks.UploadTaskFileHandlerFunc(func(params tasks.UploadTaskFileParams, principal interface{}) middleware.Responder {
return middleware.NotImplemented("operation TasksUploadTaskFile has not yet been implemented")
}),
// Applies when the "token" query is set
APIKeyAuth: func(token string) (interface{}, error) {
return nil, errors.NotImplemented("api key auth (api_key) token from query param [token] has not yet been implemented")
},
// Applies when the "X-Token" header is set
TokenHeaderAuth: func(token string) (interface{}, error) {
return nil, errors.NotImplemented("api key auth (token_header) X-Token from header param [X-Token] has not yet been implemented")
},
// default authorizer is authorized meaning no requests are blocked
APIAuthorizer: security.Authorized(),
}
} | [
"func",
"NewTaskTrackerAPI",
"(",
"spec",
"*",
"loads",
".",
"Document",
")",
"*",
"TaskTrackerAPI",
"{",
"return",
"&",
"TaskTrackerAPI",
"{",
"handlers",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"http",
".",
"Handler",
")... | // NewTaskTrackerAPI creates a new TaskTracker instance | [
"NewTaskTrackerAPI",
"creates",
"a",
"new",
"TaskTracker",
"instance"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/task_tracker_api.go#L26-L80 |
157,639 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/task_tracker_api.go | Validate | func (o *TaskTrackerAPI) Validate() error {
var unregistered []string
if o.JSONConsumer == nil {
unregistered = append(unregistered, "JSONConsumer")
}
if o.MultipartformConsumer == nil {
unregistered = append(unregistered, "MultipartformConsumer")
}
if o.JSONProducer == nil {
unregistered = append(unregistered, "JSONProducer")
}
if o.APIKeyAuth == nil {
unregistered = append(unregistered, "TokenAuth")
}
if o.TokenHeaderAuth == nil {
unregistered = append(unregistered, "XTokenAuth")
}
if o.TasksAddCommentToTaskHandler == nil {
unregistered = append(unregistered, "tasks.AddCommentToTaskHandler")
}
if o.TasksCreateTaskHandler == nil {
unregistered = append(unregistered, "tasks.CreateTaskHandler")
}
if o.TasksDeleteTaskHandler == nil {
unregistered = append(unregistered, "tasks.DeleteTaskHandler")
}
if o.TasksGetTaskCommentsHandler == nil {
unregistered = append(unregistered, "tasks.GetTaskCommentsHandler")
}
if o.TasksGetTaskDetailsHandler == nil {
unregistered = append(unregistered, "tasks.GetTaskDetailsHandler")
}
if o.TasksListTasksHandler == nil {
unregistered = append(unregistered, "tasks.ListTasksHandler")
}
if o.TasksUpdateTaskHandler == nil {
unregistered = append(unregistered, "tasks.UpdateTaskHandler")
}
if o.TasksUploadTaskFileHandler == nil {
unregistered = append(unregistered, "tasks.UploadTaskFileHandler")
}
if len(unregistered) > 0 {
return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", "))
}
return nil
} | go | func (o *TaskTrackerAPI) Validate() error {
var unregistered []string
if o.JSONConsumer == nil {
unregistered = append(unregistered, "JSONConsumer")
}
if o.MultipartformConsumer == nil {
unregistered = append(unregistered, "MultipartformConsumer")
}
if o.JSONProducer == nil {
unregistered = append(unregistered, "JSONProducer")
}
if o.APIKeyAuth == nil {
unregistered = append(unregistered, "TokenAuth")
}
if o.TokenHeaderAuth == nil {
unregistered = append(unregistered, "XTokenAuth")
}
if o.TasksAddCommentToTaskHandler == nil {
unregistered = append(unregistered, "tasks.AddCommentToTaskHandler")
}
if o.TasksCreateTaskHandler == nil {
unregistered = append(unregistered, "tasks.CreateTaskHandler")
}
if o.TasksDeleteTaskHandler == nil {
unregistered = append(unregistered, "tasks.DeleteTaskHandler")
}
if o.TasksGetTaskCommentsHandler == nil {
unregistered = append(unregistered, "tasks.GetTaskCommentsHandler")
}
if o.TasksGetTaskDetailsHandler == nil {
unregistered = append(unregistered, "tasks.GetTaskDetailsHandler")
}
if o.TasksListTasksHandler == nil {
unregistered = append(unregistered, "tasks.ListTasksHandler")
}
if o.TasksUpdateTaskHandler == nil {
unregistered = append(unregistered, "tasks.UpdateTaskHandler")
}
if o.TasksUploadTaskFileHandler == nil {
unregistered = append(unregistered, "tasks.UploadTaskFileHandler")
}
if len(unregistered) > 0 {
return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", "))
}
return nil
} | [
"func",
"(",
"o",
"*",
"TaskTrackerAPI",
")",
"Validate",
"(",
")",
"error",
"{",
"var",
"unregistered",
"[",
"]",
"string",
"\n\n",
"if",
"o",
".",
"JSONConsumer",
"==",
"nil",
"{",
"unregistered",
"=",
"append",
"(",
"unregistered",
",",
"\"",
"\"",
... | // Validate validates the registrations in the TaskTrackerAPI | [
"Validate",
"validates",
"the",
"registrations",
"in",
"the",
"TaskTrackerAPI"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/task_tracker_api.go#L197-L257 |
157,640 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/task_tracker_api.go | ServeErrorFor | func (o *TaskTrackerAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error) {
return o.ServeError
} | go | func (o *TaskTrackerAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error) {
return o.ServeError
} | [
"func",
"(",
"o",
"*",
"TaskTrackerAPI",
")",
"ServeErrorFor",
"(",
"operationID",
"string",
")",
"func",
"(",
"http",
".",
"ResponseWriter",
",",
"*",
"http",
".",
"Request",
",",
"error",
")",
"{",
"return",
"o",
".",
"ServeError",
"\n",
"}"
] | // ServeErrorFor gets a error handler for a given operation id | [
"ServeErrorFor",
"gets",
"a",
"error",
"handler",
"for",
"a",
"given",
"operation",
"id"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/task_tracker_api.go#L260-L262 |
157,641 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/task_tracker_api.go | Context | func (o *TaskTrackerAPI) Context() *middleware.Context {
if o.context == nil {
o.context = middleware.NewRoutableContext(o.spec, o, nil)
}
return o.context
} | go | func (o *TaskTrackerAPI) Context() *middleware.Context {
if o.context == nil {
o.context = middleware.NewRoutableContext(o.spec, o, nil)
}
return o.context
} | [
"func",
"(",
"o",
"*",
"TaskTrackerAPI",
")",
"Context",
"(",
")",
"*",
"middleware",
".",
"Context",
"{",
"if",
"o",
".",
"context",
"==",
"nil",
"{",
"o",
".",
"context",
"=",
"middleware",
".",
"NewRoutableContext",
"(",
"o",
".",
"spec",
",",
"o"... | // Context returns the middleware context for the task tracker API | [
"Context",
"returns",
"the",
"middleware",
"context",
"for",
"the",
"task",
"tracker",
"API"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/task_tracker_api.go#L352-L358 |
157,642 | go-swagger/go-swagger | examples/oauth2/restapi/operations/get_auth_callback.go | NewGetAuthCallback | func NewGetAuthCallback(ctx *middleware.Context, handler GetAuthCallbackHandler) *GetAuthCallback {
return &GetAuthCallback{Context: ctx, Handler: handler}
} | go | func NewGetAuthCallback(ctx *middleware.Context, handler GetAuthCallbackHandler) *GetAuthCallback {
return &GetAuthCallback{Context: ctx, Handler: handler}
} | [
"func",
"NewGetAuthCallback",
"(",
"ctx",
"*",
"middleware",
".",
"Context",
",",
"handler",
"GetAuthCallbackHandler",
")",
"*",
"GetAuthCallback",
"{",
"return",
"&",
"GetAuthCallback",
"{",
"Context",
":",
"ctx",
",",
"Handler",
":",
"handler",
"}",
"\n",
"}... | // NewGetAuthCallback creates a new http.Handler for the get auth callback operation | [
"NewGetAuthCallback",
"creates",
"a",
"new",
"http",
".",
"Handler",
"for",
"the",
"get",
"auth",
"callback",
"operation"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/oauth2/restapi/operations/get_auth_callback.go#L30-L32 |
157,643 | go-swagger/go-swagger | examples/oauth2/restapi/operations/get_auth_callback.go | UnmarshalBinary | func (o *GetAuthCallbackOKBody) UnmarshalBinary(b []byte) error {
var res GetAuthCallbackOKBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
} | go | func (o *GetAuthCallbackOKBody) UnmarshalBinary(b []byte) error {
var res GetAuthCallbackOKBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
} | [
"func",
"(",
"o",
"*",
"GetAuthCallbackOKBody",
")",
"UnmarshalBinary",
"(",
"b",
"[",
"]",
"byte",
")",
"error",
"{",
"var",
"res",
"GetAuthCallbackOKBody",
"\n",
"if",
"err",
":=",
"swag",
".",
"ReadJSON",
"(",
"b",
",",
"&",
"res",
")",
";",
"err",
... | // UnmarshalBinary interface implementation | [
"UnmarshalBinary",
"interface",
"implementation"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/oauth2/restapi/operations/get_auth_callback.go#L84-L91 |
157,644 | go-swagger/go-swagger | examples/generated/restapi/operations/user/create_user_responses.go | WithStatusCode | func (o *CreateUserDefault) WithStatusCode(code int) *CreateUserDefault {
o._statusCode = code
return o
} | go | func (o *CreateUserDefault) WithStatusCode(code int) *CreateUserDefault {
o._statusCode = code
return o
} | [
"func",
"(",
"o",
"*",
"CreateUserDefault",
")",
"WithStatusCode",
"(",
"code",
"int",
")",
"*",
"CreateUserDefault",
"{",
"o",
".",
"_statusCode",
"=",
"code",
"\n",
"return",
"o",
"\n",
"}"
] | // WithStatusCode adds the status to the create user default response | [
"WithStatusCode",
"adds",
"the",
"status",
"to",
"the",
"create",
"user",
"default",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/user/create_user_responses.go#L34-L37 |
157,645 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/tasks/upload_task_file.go | NewUploadTaskFile | func NewUploadTaskFile(ctx *middleware.Context, handler UploadTaskFileHandler) *UploadTaskFile {
return &UploadTaskFile{Context: ctx, Handler: handler}
} | go | func NewUploadTaskFile(ctx *middleware.Context, handler UploadTaskFileHandler) *UploadTaskFile {
return &UploadTaskFile{Context: ctx, Handler: handler}
} | [
"func",
"NewUploadTaskFile",
"(",
"ctx",
"*",
"middleware",
".",
"Context",
",",
"handler",
"UploadTaskFileHandler",
")",
"*",
"UploadTaskFile",
"{",
"return",
"&",
"UploadTaskFile",
"{",
"Context",
":",
"ctx",
",",
"Handler",
":",
"handler",
"}",
"\n",
"}"
] | // NewUploadTaskFile creates a new http.Handler for the upload task file operation | [
"NewUploadTaskFile",
"creates",
"a",
"new",
"http",
".",
"Handler",
"for",
"the",
"upload",
"task",
"file",
"operation"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/upload_task_file.go#L28-L30 |
157,646 | go-swagger/go-swagger | generator/debug.go | debugLog | func debugLog(frmt string, args ...interface{}) {
if Debug {
_, file, pos, _ := runtime.Caller(1)
generatorLogger.Printf("%s:%d: %s", filepath.Base(file), pos,
fmt.Sprintf(frmt, args...))
}
} | go | func debugLog(frmt string, args ...interface{}) {
if Debug {
_, file, pos, _ := runtime.Caller(1)
generatorLogger.Printf("%s:%d: %s", filepath.Base(file), pos,
fmt.Sprintf(frmt, args...))
}
} | [
"func",
"debugLog",
"(",
"frmt",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"Debug",
"{",
"_",
",",
"file",
",",
"pos",
",",
"_",
":=",
"runtime",
".",
"Caller",
"(",
"1",
")",
"\n",
"generatorLogger",
".",
"Printf",
"(",
... | // debugLog wraps log.Printf with a debug-specific logger | [
"debugLog",
"wraps",
"log",
".",
"Printf",
"with",
"a",
"debug",
"-",
"specific",
"logger"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/generator/debug.go#L43-L49 |
157,647 | go-swagger/go-swagger | generator/debug.go | debugLogAsJSON | func debugLogAsJSON(frmt string, args ...interface{}) {
if Debug {
var dfrmt string
_, file, pos, _ := runtime.Caller(1)
dargs := make([]interface{}, 0, len(args)+2)
dargs = append(dargs, filepath.Base(file), pos)
if len(args) > 0 {
dfrmt = "%s:%d: " + frmt + "\n%s"
bbb, _ := json.MarshalIndent(args[len(args)-1], "", " ")
dargs = append(dargs, args[0:len(args)-1]...)
dargs = append(dargs, string(bbb))
} else {
dfrmt = "%s:%d: " + frmt
}
generatorLogger.Printf(dfrmt, dargs...)
}
} | go | func debugLogAsJSON(frmt string, args ...interface{}) {
if Debug {
var dfrmt string
_, file, pos, _ := runtime.Caller(1)
dargs := make([]interface{}, 0, len(args)+2)
dargs = append(dargs, filepath.Base(file), pos)
if len(args) > 0 {
dfrmt = "%s:%d: " + frmt + "\n%s"
bbb, _ := json.MarshalIndent(args[len(args)-1], "", " ")
dargs = append(dargs, args[0:len(args)-1]...)
dargs = append(dargs, string(bbb))
} else {
dfrmt = "%s:%d: " + frmt
}
generatorLogger.Printf(dfrmt, dargs...)
}
} | [
"func",
"debugLogAsJSON",
"(",
"frmt",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"Debug",
"{",
"var",
"dfrmt",
"string",
"\n",
"_",
",",
"file",
",",
"pos",
",",
"_",
":=",
"runtime",
".",
"Caller",
"(",
"1",
")",
"\n",
... | // debugLogAsJSON unmarshals its last arg as pretty JSON | [
"debugLogAsJSON",
"unmarshals",
"its",
"last",
"arg",
"as",
"pretty",
"JSON"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/generator/debug.go#L52-L68 |
157,648 | go-swagger/go-swagger | fixtures/goparsing/petstore/rest/app.go | ServeAPI | func ServeAPI() error {
mux := denco.NewMux()
routes := []denco.Handler{
mux.GET("/pets", handlers.GetPets),
mux.POST("/pets", handlers.CreatePet),
mux.GET("/pets/:id", handlers.GetPetByID),
mux.PUT("/pets/:id", handlers.UpdatePet),
mux.Handler("DELETE", "/pets/:id", handlers.DeletePet),
mux.GET("/orders/:id", handlers.GetOrderDetails),
mux.POST("/orders", handlers.CreateOrder),
mux.PUT("/orders/:id", handlers.UpdateOrder),
mux.Handler("DELETE", "/orders/:id", handlers.CancelOrder),
}
handler, err := mux.Build(routes)
if err != nil {
return err
}
return http.ListenAndServe(":8000", handler)
} | go | func ServeAPI() error {
mux := denco.NewMux()
routes := []denco.Handler{
mux.GET("/pets", handlers.GetPets),
mux.POST("/pets", handlers.CreatePet),
mux.GET("/pets/:id", handlers.GetPetByID),
mux.PUT("/pets/:id", handlers.UpdatePet),
mux.Handler("DELETE", "/pets/:id", handlers.DeletePet),
mux.GET("/orders/:id", handlers.GetOrderDetails),
mux.POST("/orders", handlers.CreateOrder),
mux.PUT("/orders/:id", handlers.UpdateOrder),
mux.Handler("DELETE", "/orders/:id", handlers.CancelOrder),
}
handler, err := mux.Build(routes)
if err != nil {
return err
}
return http.ListenAndServe(":8000", handler)
} | [
"func",
"ServeAPI",
"(",
")",
"error",
"{",
"mux",
":=",
"denco",
".",
"NewMux",
"(",
")",
"\n\n",
"routes",
":=",
"[",
"]",
"denco",
".",
"Handler",
"{",
"mux",
".",
"GET",
"(",
"\"",
"\"",
",",
"handlers",
".",
"GetPets",
")",
",",
"mux",
".",
... | // ServeAPI serves this api | [
"ServeAPI",
"serves",
"this",
"api"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/fixtures/goparsing/petstore/rest/app.go#L25-L44 |
157,649 | go-swagger/go-swagger | generator/client.go | GenerateClient | func GenerateClient(name string, modelNames, operationIDs []string, opts *GenOpts) error {
templates.LoadDefaults()
if opts == nil {
return errors.New("gen opts are required")
}
if opts.Template != "" {
if err := templates.LoadContrib(opts.Template); err != nil {
return err
}
}
if opts.TemplateDir != "" {
if err := templates.LoadDir(opts.TemplateDir); err != nil {
return err
}
}
if err := opts.CheckOpts(); err != nil {
return err
}
// Load the spec
_, specDoc, err := loadSpec(opts.Spec)
if err != nil {
return err
}
// Validate and Expand. specDoc is in/out param.
specDoc, err = validateAndFlattenSpec(opts, specDoc)
if err != nil {
return err
}
analyzed := analysis.New(specDoc.Spec())
models, err := gatherModels(specDoc, modelNames)
if err != nil {
return err
}
operations := gatherOperations(analyzed, operationIDs)
if len(operations) == 0 {
return errors.New("no operations were selected")
}
defaultScheme := opts.DefaultScheme
if defaultScheme == "" {
defaultScheme = sHTTP
}
defaultConsumes := opts.DefaultConsumes
if defaultConsumes == "" {
defaultConsumes = runtime.JSONMime
}
defaultProduces := opts.DefaultProduces
if defaultProduces == "" {
defaultProduces = runtime.JSONMime
}
generator := appGenerator{
Name: appNameOrDefault(specDoc, name, "rest"),
SpecDoc: specDoc,
Analyzed: analyzed,
Models: models,
Operations: operations,
Target: opts.Target,
DumpData: opts.DumpData,
Package: opts.LanguageOpts.ManglePackageName(opts.ClientPackage, "client"),
APIPackage: opts.LanguageOpts.ManglePackagePath(opts.APIPackage, "api"),
ModelsPackage: opts.LanguageOpts.ManglePackagePath(opts.ModelPackage, "definitions"),
ServerPackage: opts.LanguageOpts.ManglePackagePath(opts.ServerPackage, "server"),
ClientPackage: opts.LanguageOpts.ManglePackagePath(opts.ClientPackage, "client"),
OperationsPackage: opts.LanguageOpts.ManglePackagePath(opts.ClientPackage, "client"),
Principal: opts.Principal,
DefaultScheme: defaultScheme,
DefaultProduces: defaultProduces,
DefaultConsumes: defaultConsumes,
GenOpts: opts,
}
generator.Receiver = "o"
return (&clientGenerator{generator}).Generate()
} | go | func GenerateClient(name string, modelNames, operationIDs []string, opts *GenOpts) error {
templates.LoadDefaults()
if opts == nil {
return errors.New("gen opts are required")
}
if opts.Template != "" {
if err := templates.LoadContrib(opts.Template); err != nil {
return err
}
}
if opts.TemplateDir != "" {
if err := templates.LoadDir(opts.TemplateDir); err != nil {
return err
}
}
if err := opts.CheckOpts(); err != nil {
return err
}
// Load the spec
_, specDoc, err := loadSpec(opts.Spec)
if err != nil {
return err
}
// Validate and Expand. specDoc is in/out param.
specDoc, err = validateAndFlattenSpec(opts, specDoc)
if err != nil {
return err
}
analyzed := analysis.New(specDoc.Spec())
models, err := gatherModels(specDoc, modelNames)
if err != nil {
return err
}
operations := gatherOperations(analyzed, operationIDs)
if len(operations) == 0 {
return errors.New("no operations were selected")
}
defaultScheme := opts.DefaultScheme
if defaultScheme == "" {
defaultScheme = sHTTP
}
defaultConsumes := opts.DefaultConsumes
if defaultConsumes == "" {
defaultConsumes = runtime.JSONMime
}
defaultProduces := opts.DefaultProduces
if defaultProduces == "" {
defaultProduces = runtime.JSONMime
}
generator := appGenerator{
Name: appNameOrDefault(specDoc, name, "rest"),
SpecDoc: specDoc,
Analyzed: analyzed,
Models: models,
Operations: operations,
Target: opts.Target,
DumpData: opts.DumpData,
Package: opts.LanguageOpts.ManglePackageName(opts.ClientPackage, "client"),
APIPackage: opts.LanguageOpts.ManglePackagePath(opts.APIPackage, "api"),
ModelsPackage: opts.LanguageOpts.ManglePackagePath(opts.ModelPackage, "definitions"),
ServerPackage: opts.LanguageOpts.ManglePackagePath(opts.ServerPackage, "server"),
ClientPackage: opts.LanguageOpts.ManglePackagePath(opts.ClientPackage, "client"),
OperationsPackage: opts.LanguageOpts.ManglePackagePath(opts.ClientPackage, "client"),
Principal: opts.Principal,
DefaultScheme: defaultScheme,
DefaultProduces: defaultProduces,
DefaultConsumes: defaultConsumes,
GenOpts: opts,
}
generator.Receiver = "o"
return (&clientGenerator{generator}).Generate()
} | [
"func",
"GenerateClient",
"(",
"name",
"string",
",",
"modelNames",
",",
"operationIDs",
"[",
"]",
"string",
",",
"opts",
"*",
"GenOpts",
")",
"error",
"{",
"templates",
".",
"LoadDefaults",
"(",
")",
"\n",
"if",
"opts",
"==",
"nil",
"{",
"return",
"erro... | // GenerateClient generates a client library for a swagger spec document. | [
"GenerateClient",
"generates",
"a",
"client",
"library",
"for",
"a",
"swagger",
"spec",
"document",
"."
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/generator/client.go#L32-L116 |
157,650 | go-swagger/go-swagger | examples/generated/restapi/operations/pet/update_pet_with_form_parameters.go | bindName | func (o *UpdatePetWithFormParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
if !hasKey {
return errors.Required("name", "formData")
}
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: true
if err := validate.RequiredString("name", "formData", raw); err != nil {
return err
}
o.Name = raw
return nil
} | go | func (o *UpdatePetWithFormParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
if !hasKey {
return errors.Required("name", "formData")
}
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: true
if err := validate.RequiredString("name", "formData", raw); err != nil {
return err
}
o.Name = raw
return nil
} | [
"func",
"(",
"o",
"*",
"UpdatePetWithFormParams",
")",
"bindName",
"(",
"rawData",
"[",
"]",
"string",
",",
"hasKey",
"bool",
",",
"formats",
"strfmt",
".",
"Registry",
")",
"error",
"{",
"if",
"!",
"hasKey",
"{",
"return",
"errors",
".",
"Required",
"("... | // bindName binds and validates parameter Name from formData. | [
"bindName",
"binds",
"and",
"validates",
"parameter",
"Name",
"from",
"formData",
"."
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/pet/update_pet_with_form_parameters.go#L92-L110 |
157,651 | go-swagger/go-swagger | examples/todo-list/restapi/operations/todos/find.go | NewFind | func NewFind(ctx *middleware.Context, handler FindHandler) *Find {
return &Find{Context: ctx, Handler: handler}
} | go | func NewFind(ctx *middleware.Context, handler FindHandler) *Find {
return &Find{Context: ctx, Handler: handler}
} | [
"func",
"NewFind",
"(",
"ctx",
"*",
"middleware",
".",
"Context",
",",
"handler",
"FindHandler",
")",
"*",
"Find",
"{",
"return",
"&",
"Find",
"{",
"Context",
":",
"ctx",
",",
"Handler",
":",
"handler",
"}",
"\n",
"}"
] | // NewFind creates a new http.Handler for the find operation | [
"NewFind",
"creates",
"a",
"new",
"http",
".",
"Handler",
"for",
"the",
"find",
"operation"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/todo-list/restapi/operations/todos/find.go#L28-L30 |
157,652 | go-swagger/go-swagger | examples/generated/restapi/operations/pet/update_pet.go | NewUpdatePet | func NewUpdatePet(ctx *middleware.Context, handler UpdatePetHandler) *UpdatePet {
return &UpdatePet{Context: ctx, Handler: handler}
} | go | func NewUpdatePet(ctx *middleware.Context, handler UpdatePetHandler) *UpdatePet {
return &UpdatePet{Context: ctx, Handler: handler}
} | [
"func",
"NewUpdatePet",
"(",
"ctx",
"*",
"middleware",
".",
"Context",
",",
"handler",
"UpdatePetHandler",
")",
"*",
"UpdatePet",
"{",
"return",
"&",
"UpdatePet",
"{",
"Context",
":",
"ctx",
",",
"Handler",
":",
"handler",
"}",
"\n",
"}"
] | // NewUpdatePet creates a new http.Handler for the update pet operation | [
"NewUpdatePet",
"creates",
"a",
"new",
"http",
".",
"Handler",
"for",
"the",
"update",
"pet",
"operation"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/pet/update_pet.go#L28-L30 |
157,653 | go-swagger/go-swagger | examples/generated/restapi/operations/store/place_order_responses.go | WithPayload | func (o *PlaceOrderOK) WithPayload(payload *models.Order) *PlaceOrderOK {
o.Payload = payload
return o
} | go | func (o *PlaceOrderOK) WithPayload(payload *models.Order) *PlaceOrderOK {
o.Payload = payload
return o
} | [
"func",
"(",
"o",
"*",
"PlaceOrderOK",
")",
"WithPayload",
"(",
"payload",
"*",
"models",
".",
"Order",
")",
"*",
"PlaceOrderOK",
"{",
"o",
".",
"Payload",
"=",
"payload",
"\n",
"return",
"o",
"\n",
"}"
] | // WithPayload adds the payload to the place order o k response | [
"WithPayload",
"adds",
"the",
"payload",
"to",
"the",
"place",
"order",
"o",
"k",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/store/place_order_responses.go#L38-L41 |
157,654 | go-swagger/go-swagger | examples/todo-list/client/todo_list_client.go | New | func New(transport runtime.ClientTransport, formats strfmt.Registry) *TodoList {
// ensure nullable parameters have default
if formats == nil {
formats = strfmt.Default
}
cli := new(TodoList)
cli.Transport = transport
cli.Todos = todos.New(transport, formats)
return cli
} | go | func New(transport runtime.ClientTransport, formats strfmt.Registry) *TodoList {
// ensure nullable parameters have default
if formats == nil {
formats = strfmt.Default
}
cli := new(TodoList)
cli.Transport = transport
cli.Todos = todos.New(transport, formats)
return cli
} | [
"func",
"New",
"(",
"transport",
"runtime",
".",
"ClientTransport",
",",
"formats",
"strfmt",
".",
"Registry",
")",
"*",
"TodoList",
"{",
"// ensure nullable parameters have default",
"if",
"formats",
"==",
"nil",
"{",
"formats",
"=",
"strfmt",
".",
"Default",
"... | // New creates a new todo list client | [
"New",
"creates",
"a",
"new",
"todo",
"list",
"client"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/todo-list/client/todo_list_client.go#L51-L63 |
157,655 | go-swagger/go-swagger | examples/generated/restapi/operations/user/update_user.go | NewUpdateUser | func NewUpdateUser(ctx *middleware.Context, handler UpdateUserHandler) *UpdateUser {
return &UpdateUser{Context: ctx, Handler: handler}
} | go | func NewUpdateUser(ctx *middleware.Context, handler UpdateUserHandler) *UpdateUser {
return &UpdateUser{Context: ctx, Handler: handler}
} | [
"func",
"NewUpdateUser",
"(",
"ctx",
"*",
"middleware",
".",
"Context",
",",
"handler",
"UpdateUserHandler",
")",
"*",
"UpdateUser",
"{",
"return",
"&",
"UpdateUser",
"{",
"Context",
":",
"ctx",
",",
"Handler",
":",
"handler",
"}",
"\n",
"}"
] | // NewUpdateUser creates a new http.Handler for the update user operation | [
"NewUpdateUser",
"creates",
"a",
"new",
"http",
".",
"Handler",
"for",
"the",
"update",
"user",
"operation"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/user/update_user.go#L28-L30 |
157,656 | go-swagger/go-swagger | examples/generated/restapi/operations/store/delete_order.go | NewDeleteOrder | func NewDeleteOrder(ctx *middleware.Context, handler DeleteOrderHandler) *DeleteOrder {
return &DeleteOrder{Context: ctx, Handler: handler}
} | go | func NewDeleteOrder(ctx *middleware.Context, handler DeleteOrderHandler) *DeleteOrder {
return &DeleteOrder{Context: ctx, Handler: handler}
} | [
"func",
"NewDeleteOrder",
"(",
"ctx",
"*",
"middleware",
".",
"Context",
",",
"handler",
"DeleteOrderHandler",
")",
"*",
"DeleteOrder",
"{",
"return",
"&",
"DeleteOrder",
"{",
"Context",
":",
"ctx",
",",
"Handler",
":",
"handler",
"}",
"\n",
"}"
] | // NewDeleteOrder creates a new http.Handler for the delete order operation | [
"NewDeleteOrder",
"creates",
"a",
"new",
"http",
".",
"Handler",
"for",
"the",
"delete",
"order",
"operation"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/store/delete_order.go#L28-L30 |
157,657 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/tasks/get_task_details_responses.go | WithPayload | func (o *GetTaskDetailsOK) WithPayload(payload *models.Task) *GetTaskDetailsOK {
o.Payload = payload
return o
} | go | func (o *GetTaskDetailsOK) WithPayload(payload *models.Task) *GetTaskDetailsOK {
o.Payload = payload
return o
} | [
"func",
"(",
"o",
"*",
"GetTaskDetailsOK",
")",
"WithPayload",
"(",
"payload",
"*",
"models",
".",
"Task",
")",
"*",
"GetTaskDetailsOK",
"{",
"o",
".",
"Payload",
"=",
"payload",
"\n",
"return",
"o",
"\n",
"}"
] | // WithPayload adds the payload to the get task details o k response | [
"WithPayload",
"adds",
"the",
"payload",
"to",
"the",
"get",
"task",
"details",
"o",
"k",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/get_task_details_responses.go#L38-L41 |
157,658 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/tasks/get_task_details_responses.go | WithPayload | func (o *GetTaskDetailsUnprocessableEntity) WithPayload(payload *models.ValidationError) *GetTaskDetailsUnprocessableEntity {
o.Payload = payload
return o
} | go | func (o *GetTaskDetailsUnprocessableEntity) WithPayload(payload *models.ValidationError) *GetTaskDetailsUnprocessableEntity {
o.Payload = payload
return o
} | [
"func",
"(",
"o",
"*",
"GetTaskDetailsUnprocessableEntity",
")",
"WithPayload",
"(",
"payload",
"*",
"models",
".",
"ValidationError",
")",
"*",
"GetTaskDetailsUnprocessableEntity",
"{",
"o",
".",
"Payload",
"=",
"payload",
"\n",
"return",
"o",
"\n",
"}"
] | // WithPayload adds the payload to the get task details unprocessable entity response | [
"WithPayload",
"adds",
"the",
"payload",
"to",
"the",
"get",
"task",
"details",
"unprocessable",
"entity",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/get_task_details_responses.go#L82-L85 |
157,659 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/tasks/get_task_details_responses.go | WithStatusCode | func (o *GetTaskDetailsDefault) WithStatusCode(code int) *GetTaskDetailsDefault {
o._statusCode = code
return o
} | go | func (o *GetTaskDetailsDefault) WithStatusCode(code int) *GetTaskDetailsDefault {
o._statusCode = code
return o
} | [
"func",
"(",
"o",
"*",
"GetTaskDetailsDefault",
")",
"WithStatusCode",
"(",
"code",
"int",
")",
"*",
"GetTaskDetailsDefault",
"{",
"o",
".",
"_statusCode",
"=",
"code",
"\n",
"return",
"o",
"\n",
"}"
] | // WithStatusCode adds the status to the get task details default response | [
"WithStatusCode",
"adds",
"the",
"status",
"to",
"the",
"get",
"task",
"details",
"default",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/get_task_details_responses.go#L133-L136 |
157,660 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/tasks/get_task_details_responses.go | WithXErrorCode | func (o *GetTaskDetailsDefault) WithXErrorCode(xErrorCode string) *GetTaskDetailsDefault {
o.XErrorCode = xErrorCode
return o
} | go | func (o *GetTaskDetailsDefault) WithXErrorCode(xErrorCode string) *GetTaskDetailsDefault {
o.XErrorCode = xErrorCode
return o
} | [
"func",
"(",
"o",
"*",
"GetTaskDetailsDefault",
")",
"WithXErrorCode",
"(",
"xErrorCode",
"string",
")",
"*",
"GetTaskDetailsDefault",
"{",
"o",
".",
"XErrorCode",
"=",
"xErrorCode",
"\n",
"return",
"o",
"\n",
"}"
] | // WithXErrorCode adds the xErrorCode to the get task details default response | [
"WithXErrorCode",
"adds",
"the",
"xErrorCode",
"to",
"the",
"get",
"task",
"details",
"default",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/get_task_details_responses.go#L144-L147 |
157,661 | go-swagger/go-swagger | examples/task-tracker/restapi/operations/tasks/get_task_details_responses.go | WithPayload | func (o *GetTaskDetailsDefault) WithPayload(payload *models.Error) *GetTaskDetailsDefault {
o.Payload = payload
return o
} | go | func (o *GetTaskDetailsDefault) WithPayload(payload *models.Error) *GetTaskDetailsDefault {
o.Payload = payload
return o
} | [
"func",
"(",
"o",
"*",
"GetTaskDetailsDefault",
")",
"WithPayload",
"(",
"payload",
"*",
"models",
".",
"Error",
")",
"*",
"GetTaskDetailsDefault",
"{",
"o",
".",
"Payload",
"=",
"payload",
"\n",
"return",
"o",
"\n",
"}"
] | // WithPayload adds the payload to the get task details default response | [
"WithPayload",
"adds",
"the",
"payload",
"to",
"the",
"get",
"task",
"details",
"default",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/get_task_details_responses.go#L155-L158 |
157,662 | go-swagger/go-swagger | examples/contributed-templates/stratoscale/client/pet/pet_update_parameters.go | WithTimeout | func (o *PetUpdateParams) WithTimeout(timeout time.Duration) *PetUpdateParams {
o.SetTimeout(timeout)
return o
} | go | func (o *PetUpdateParams) WithTimeout(timeout time.Duration) *PetUpdateParams {
o.SetTimeout(timeout)
return o
} | [
"func",
"(",
"o",
"*",
"PetUpdateParams",
")",
"WithTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"*",
"PetUpdateParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithTimeout adds the timeout to the pet update params | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"pet",
"update",
"params"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_update_parameters.go#L78-L81 |
157,663 | go-swagger/go-swagger | examples/contributed-templates/stratoscale/client/pet/pet_update_parameters.go | WithContext | func (o *PetUpdateParams) WithContext(ctx context.Context) *PetUpdateParams {
o.SetContext(ctx)
return o
} | go | func (o *PetUpdateParams) WithContext(ctx context.Context) *PetUpdateParams {
o.SetContext(ctx)
return o
} | [
"func",
"(",
"o",
"*",
"PetUpdateParams",
")",
"WithContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"PetUpdateParams",
"{",
"o",
".",
"SetContext",
"(",
"ctx",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithContext adds the context to the pet update params | [
"WithContext",
"adds",
"the",
"context",
"to",
"the",
"pet",
"update",
"params"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_update_parameters.go#L89-L92 |
157,664 | go-swagger/go-swagger | examples/contributed-templates/stratoscale/client/pet/pet_update_parameters.go | WithHTTPClient | func (o *PetUpdateParams) WithHTTPClient(client *http.Client) *PetUpdateParams {
o.SetHTTPClient(client)
return o
} | go | func (o *PetUpdateParams) WithHTTPClient(client *http.Client) *PetUpdateParams {
o.SetHTTPClient(client)
return o
} | [
"func",
"(",
"o",
"*",
"PetUpdateParams",
")",
"WithHTTPClient",
"(",
"client",
"*",
"http",
".",
"Client",
")",
"*",
"PetUpdateParams",
"{",
"o",
".",
"SetHTTPClient",
"(",
"client",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithHTTPClient adds the HTTPClient to the pet update params | [
"WithHTTPClient",
"adds",
"the",
"HTTPClient",
"to",
"the",
"pet",
"update",
"params"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_update_parameters.go#L100-L103 |
157,665 | go-swagger/go-swagger | examples/contributed-templates/stratoscale/client/pet/pet_update_parameters.go | WithBody | func (o *PetUpdateParams) WithBody(body *models.Pet) *PetUpdateParams {
o.SetBody(body)
return o
} | go | func (o *PetUpdateParams) WithBody(body *models.Pet) *PetUpdateParams {
o.SetBody(body)
return o
} | [
"func",
"(",
"o",
"*",
"PetUpdateParams",
")",
"WithBody",
"(",
"body",
"*",
"models",
".",
"Pet",
")",
"*",
"PetUpdateParams",
"{",
"o",
".",
"SetBody",
"(",
"body",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithBody adds the body to the pet update params | [
"WithBody",
"adds",
"the",
"body",
"to",
"the",
"pet",
"update",
"params"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/pet/pet_update_parameters.go#L111-L114 |
157,666 | go-swagger/go-swagger | examples/task-tracker/client/tasks/update_task_parameters.go | WithTimeout | func (o *UpdateTaskParams) WithTimeout(timeout time.Duration) *UpdateTaskParams {
o.SetTimeout(timeout)
return o
} | go | func (o *UpdateTaskParams) WithTimeout(timeout time.Duration) *UpdateTaskParams {
o.SetTimeout(timeout)
return o
} | [
"func",
"(",
"o",
"*",
"UpdateTaskParams",
")",
"WithTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"*",
"UpdateTaskParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithTimeout adds the timeout to the update task params | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"update",
"task",
"params"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/update_task_parameters.go#L84-L87 |
157,667 | go-swagger/go-swagger | examples/task-tracker/client/tasks/update_task_parameters.go | WithContext | func (o *UpdateTaskParams) WithContext(ctx context.Context) *UpdateTaskParams {
o.SetContext(ctx)
return o
} | go | func (o *UpdateTaskParams) WithContext(ctx context.Context) *UpdateTaskParams {
o.SetContext(ctx)
return o
} | [
"func",
"(",
"o",
"*",
"UpdateTaskParams",
")",
"WithContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"UpdateTaskParams",
"{",
"o",
".",
"SetContext",
"(",
"ctx",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithContext adds the context to the update task params | [
"WithContext",
"adds",
"the",
"context",
"to",
"the",
"update",
"task",
"params"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/update_task_parameters.go#L95-L98 |
157,668 | go-swagger/go-swagger | examples/task-tracker/client/tasks/update_task_parameters.go | WithHTTPClient | func (o *UpdateTaskParams) WithHTTPClient(client *http.Client) *UpdateTaskParams {
o.SetHTTPClient(client)
return o
} | go | func (o *UpdateTaskParams) WithHTTPClient(client *http.Client) *UpdateTaskParams {
o.SetHTTPClient(client)
return o
} | [
"func",
"(",
"o",
"*",
"UpdateTaskParams",
")",
"WithHTTPClient",
"(",
"client",
"*",
"http",
".",
"Client",
")",
"*",
"UpdateTaskParams",
"{",
"o",
".",
"SetHTTPClient",
"(",
"client",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithHTTPClient adds the HTTPClient to the update task params | [
"WithHTTPClient",
"adds",
"the",
"HTTPClient",
"to",
"the",
"update",
"task",
"params"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/update_task_parameters.go#L106-L109 |
157,669 | go-swagger/go-swagger | examples/task-tracker/client/tasks/update_task_parameters.go | WithBody | func (o *UpdateTaskParams) WithBody(body *models.Task) *UpdateTaskParams {
o.SetBody(body)
return o
} | go | func (o *UpdateTaskParams) WithBody(body *models.Task) *UpdateTaskParams {
o.SetBody(body)
return o
} | [
"func",
"(",
"o",
"*",
"UpdateTaskParams",
")",
"WithBody",
"(",
"body",
"*",
"models",
".",
"Task",
")",
"*",
"UpdateTaskParams",
"{",
"o",
".",
"SetBody",
"(",
"body",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithBody adds the body to the update task params | [
"WithBody",
"adds",
"the",
"body",
"to",
"the",
"update",
"task",
"params"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/update_task_parameters.go#L117-L120 |
157,670 | go-swagger/go-swagger | examples/task-tracker/client/tasks/update_task_parameters.go | WithID | func (o *UpdateTaskParams) WithID(id int64) *UpdateTaskParams {
o.SetID(id)
return o
} | go | func (o *UpdateTaskParams) WithID(id int64) *UpdateTaskParams {
o.SetID(id)
return o
} | [
"func",
"(",
"o",
"*",
"UpdateTaskParams",
")",
"WithID",
"(",
"id",
"int64",
")",
"*",
"UpdateTaskParams",
"{",
"o",
".",
"SetID",
"(",
"id",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithID adds the id to the update task params | [
"WithID",
"adds",
"the",
"id",
"to",
"the",
"update",
"task",
"params"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/update_task_parameters.go#L128-L131 |
157,671 | go-swagger/go-swagger | examples/tutorials/todo-list/server-complete/restapi/operations/todos/update_one_responses.go | WithPayload | func (o *UpdateOneOK) WithPayload(payload *models.Item) *UpdateOneOK {
o.Payload = payload
return o
} | go | func (o *UpdateOneOK) WithPayload(payload *models.Item) *UpdateOneOK {
o.Payload = payload
return o
} | [
"func",
"(",
"o",
"*",
"UpdateOneOK",
")",
"WithPayload",
"(",
"payload",
"*",
"models",
".",
"Item",
")",
"*",
"UpdateOneOK",
"{",
"o",
".",
"Payload",
"=",
"payload",
"\n",
"return",
"o",
"\n",
"}"
] | // WithPayload adds the payload to the update one o k response | [
"WithPayload",
"adds",
"the",
"payload",
"to",
"the",
"update",
"one",
"o",
"k",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/tutorials/todo-list/server-complete/restapi/operations/todos/update_one_responses.go#L38-L41 |
157,672 | go-swagger/go-swagger | examples/tutorials/todo-list/server-complete/restapi/operations/todos/update_one_responses.go | WithStatusCode | func (o *UpdateOneDefault) WithStatusCode(code int) *UpdateOneDefault {
o._statusCode = code
return o
} | go | func (o *UpdateOneDefault) WithStatusCode(code int) *UpdateOneDefault {
o._statusCode = code
return o
} | [
"func",
"(",
"o",
"*",
"UpdateOneDefault",
")",
"WithStatusCode",
"(",
"code",
"int",
")",
"*",
"UpdateOneDefault",
"{",
"o",
".",
"_statusCode",
"=",
"code",
"\n",
"return",
"o",
"\n",
"}"
] | // WithStatusCode adds the status to the update one default response | [
"WithStatusCode",
"adds",
"the",
"status",
"to",
"the",
"update",
"one",
"default",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/tutorials/todo-list/server-complete/restapi/operations/todos/update_one_responses.go#L85-L88 |
157,673 | go-swagger/go-swagger | examples/tutorials/todo-list/server-complete/restapi/operations/todos/update_one_responses.go | WithPayload | func (o *UpdateOneDefault) WithPayload(payload *models.Error) *UpdateOneDefault {
o.Payload = payload
return o
} | go | func (o *UpdateOneDefault) WithPayload(payload *models.Error) *UpdateOneDefault {
o.Payload = payload
return o
} | [
"func",
"(",
"o",
"*",
"UpdateOneDefault",
")",
"WithPayload",
"(",
"payload",
"*",
"models",
".",
"Error",
")",
"*",
"UpdateOneDefault",
"{",
"o",
".",
"Payload",
"=",
"payload",
"\n",
"return",
"o",
"\n",
"}"
] | // WithPayload adds the payload to the update one default response | [
"WithPayload",
"adds",
"the",
"payload",
"to",
"the",
"update",
"one",
"default",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/tutorials/todo-list/server-complete/restapi/operations/todos/update_one_responses.go#L96-L99 |
157,674 | go-swagger/go-swagger | examples/contributed-templates/stratoscale/client/store/inventory_get_parameters.go | WithTimeout | func (o *InventoryGetParams) WithTimeout(timeout time.Duration) *InventoryGetParams {
o.SetTimeout(timeout)
return o
} | go | func (o *InventoryGetParams) WithTimeout(timeout time.Duration) *InventoryGetParams {
o.SetTimeout(timeout)
return o
} | [
"func",
"(",
"o",
"*",
"InventoryGetParams",
")",
"WithTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"*",
"InventoryGetParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithTimeout adds the timeout to the inventory get params | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"inventory",
"get",
"params"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/store/inventory_get_parameters.go#L69-L72 |
157,675 | go-swagger/go-swagger | examples/contributed-templates/stratoscale/client/store/inventory_get_parameters.go | WithContext | func (o *InventoryGetParams) WithContext(ctx context.Context) *InventoryGetParams {
o.SetContext(ctx)
return o
} | go | func (o *InventoryGetParams) WithContext(ctx context.Context) *InventoryGetParams {
o.SetContext(ctx)
return o
} | [
"func",
"(",
"o",
"*",
"InventoryGetParams",
")",
"WithContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"InventoryGetParams",
"{",
"o",
".",
"SetContext",
"(",
"ctx",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithContext adds the context to the inventory get params | [
"WithContext",
"adds",
"the",
"context",
"to",
"the",
"inventory",
"get",
"params"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/store/inventory_get_parameters.go#L80-L83 |
157,676 | go-swagger/go-swagger | examples/contributed-templates/stratoscale/client/store/inventory_get_parameters.go | WithHTTPClient | func (o *InventoryGetParams) WithHTTPClient(client *http.Client) *InventoryGetParams {
o.SetHTTPClient(client)
return o
} | go | func (o *InventoryGetParams) WithHTTPClient(client *http.Client) *InventoryGetParams {
o.SetHTTPClient(client)
return o
} | [
"func",
"(",
"o",
"*",
"InventoryGetParams",
")",
"WithHTTPClient",
"(",
"client",
"*",
"http",
".",
"Client",
")",
"*",
"InventoryGetParams",
"{",
"o",
".",
"SetHTTPClient",
"(",
"client",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithHTTPClient adds the HTTPClient to the inventory get params | [
"WithHTTPClient",
"adds",
"the",
"HTTPClient",
"to",
"the",
"inventory",
"get",
"params"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/client/store/inventory_get_parameters.go#L91-L94 |
157,677 | go-swagger/go-swagger | examples/stream-server/restapi/operations/countdown_api.go | NewCountdownAPI | func NewCountdownAPI(spec *loads.Document) *CountdownAPI {
return &CountdownAPI{
handlers: make(map[string]map[string]http.Handler),
formats: strfmt.Default,
defaultConsumes: "application/json",
defaultProduces: "application/json",
customConsumers: make(map[string]runtime.Consumer),
customProducers: make(map[string]runtime.Producer),
ServerShutdown: func() {},
spec: spec,
ServeError: errors.ServeError,
BasicAuthenticator: security.BasicAuth,
APIKeyAuthenticator: security.APIKeyAuth,
BearerAuthenticator: security.BearerAuth,
JSONConsumer: runtime.JSONConsumer(),
JSONProducer: runtime.JSONProducer(),
ElapseHandler: ElapseHandlerFunc(func(params ElapseParams) middleware.Responder {
return middleware.NotImplemented("operation Elapse has not yet been implemented")
}),
}
} | go | func NewCountdownAPI(spec *loads.Document) *CountdownAPI {
return &CountdownAPI{
handlers: make(map[string]map[string]http.Handler),
formats: strfmt.Default,
defaultConsumes: "application/json",
defaultProduces: "application/json",
customConsumers: make(map[string]runtime.Consumer),
customProducers: make(map[string]runtime.Producer),
ServerShutdown: func() {},
spec: spec,
ServeError: errors.ServeError,
BasicAuthenticator: security.BasicAuth,
APIKeyAuthenticator: security.APIKeyAuth,
BearerAuthenticator: security.BearerAuth,
JSONConsumer: runtime.JSONConsumer(),
JSONProducer: runtime.JSONProducer(),
ElapseHandler: ElapseHandlerFunc(func(params ElapseParams) middleware.Responder {
return middleware.NotImplemented("operation Elapse has not yet been implemented")
}),
}
} | [
"func",
"NewCountdownAPI",
"(",
"spec",
"*",
"loads",
".",
"Document",
")",
"*",
"CountdownAPI",
"{",
"return",
"&",
"CountdownAPI",
"{",
"handlers",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"http",
".",
"Handler",
")",
"... | // NewCountdownAPI creates a new Countdown instance | [
"NewCountdownAPI",
"creates",
"a",
"new",
"Countdown",
"instance"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/stream-server/restapi/operations/countdown_api.go#L24-L44 |
157,678 | go-swagger/go-swagger | examples/stream-server/restapi/operations/countdown_api.go | Validate | func (o *CountdownAPI) Validate() error {
var unregistered []string
if o.JSONConsumer == nil {
unregistered = append(unregistered, "JSONConsumer")
}
if o.JSONProducer == nil {
unregistered = append(unregistered, "JSONProducer")
}
if o.ElapseHandler == nil {
unregistered = append(unregistered, "ElapseHandler")
}
if len(unregistered) > 0 {
return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", "))
}
return nil
} | go | func (o *CountdownAPI) Validate() error {
var unregistered []string
if o.JSONConsumer == nil {
unregistered = append(unregistered, "JSONConsumer")
}
if o.JSONProducer == nil {
unregistered = append(unregistered, "JSONProducer")
}
if o.ElapseHandler == nil {
unregistered = append(unregistered, "ElapseHandler")
}
if len(unregistered) > 0 {
return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", "))
}
return nil
} | [
"func",
"(",
"o",
"*",
"CountdownAPI",
")",
"Validate",
"(",
")",
"error",
"{",
"var",
"unregistered",
"[",
"]",
"string",
"\n\n",
"if",
"o",
".",
"JSONConsumer",
"==",
"nil",
"{",
"unregistered",
"=",
"append",
"(",
"unregistered",
",",
"\"",
"\"",
")... | // Validate validates the registrations in the CountdownAPI | [
"Validate",
"validates",
"the",
"registrations",
"in",
"the",
"CountdownAPI"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/stream-server/restapi/operations/countdown_api.go#L128-L148 |
157,679 | go-swagger/go-swagger | examples/stream-server/restapi/operations/countdown_api.go | Context | func (o *CountdownAPI) Context() *middleware.Context {
if o.context == nil {
o.context = middleware.NewRoutableContext(o.spec, o, nil)
}
return o.context
} | go | func (o *CountdownAPI) Context() *middleware.Context {
if o.context == nil {
o.context = middleware.NewRoutableContext(o.spec, o, nil)
}
return o.context
} | [
"func",
"(",
"o",
"*",
"CountdownAPI",
")",
"Context",
"(",
")",
"*",
"middleware",
".",
"Context",
"{",
"if",
"o",
".",
"context",
"==",
"nil",
"{",
"o",
".",
"context",
"=",
"middleware",
".",
"NewRoutableContext",
"(",
"o",
".",
"spec",
",",
"o",
... | // Context returns the middleware context for the countdown API | [
"Context",
"returns",
"the",
"middleware",
"context",
"for",
"the",
"countdown",
"API"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/stream-server/restapi/operations/countdown_api.go#L226-L232 |
157,680 | go-swagger/go-swagger | examples/authentication/restapi/operations/customers/get_id_responses.go | WithPayload | func (o *GetIDOK) WithPayload(payload *models.Customer) *GetIDOK {
o.Payload = payload
return o
} | go | func (o *GetIDOK) WithPayload(payload *models.Customer) *GetIDOK {
o.Payload = payload
return o
} | [
"func",
"(",
"o",
"*",
"GetIDOK",
")",
"WithPayload",
"(",
"payload",
"*",
"models",
".",
"Customer",
")",
"*",
"GetIDOK",
"{",
"o",
".",
"Payload",
"=",
"payload",
"\n",
"return",
"o",
"\n",
"}"
] | // WithPayload adds the payload to the get Id o k response | [
"WithPayload",
"adds",
"the",
"payload",
"to",
"the",
"get",
"Id",
"o",
"k",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/authentication/restapi/operations/customers/get_id_responses.go#L38-L41 |
157,681 | go-swagger/go-swagger | examples/authentication/restapi/operations/customers/get_id_responses.go | WithPayload | func (o *GetIDUnauthorized) WithPayload(payload *models.Error) *GetIDUnauthorized {
o.Payload = payload
return o
} | go | func (o *GetIDUnauthorized) WithPayload(payload *models.Error) *GetIDUnauthorized {
o.Payload = payload
return o
} | [
"func",
"(",
"o",
"*",
"GetIDUnauthorized",
")",
"WithPayload",
"(",
"payload",
"*",
"models",
".",
"Error",
")",
"*",
"GetIDUnauthorized",
"{",
"o",
".",
"Payload",
"=",
"payload",
"\n",
"return",
"o",
"\n",
"}"
] | // WithPayload adds the payload to the get Id unauthorized response | [
"WithPayload",
"adds",
"the",
"payload",
"to",
"the",
"get",
"Id",
"unauthorized",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/authentication/restapi/operations/customers/get_id_responses.go#L82-L85 |
157,682 | go-swagger/go-swagger | examples/authentication/restapi/operations/customers/get_id_responses.go | WithPayload | func (o *GetIDNotFound) WithPayload(payload *models.Error) *GetIDNotFound {
o.Payload = payload
return o
} | go | func (o *GetIDNotFound) WithPayload(payload *models.Error) *GetIDNotFound {
o.Payload = payload
return o
} | [
"func",
"(",
"o",
"*",
"GetIDNotFound",
")",
"WithPayload",
"(",
"payload",
"*",
"models",
".",
"Error",
")",
"*",
"GetIDNotFound",
"{",
"o",
".",
"Payload",
"=",
"payload",
"\n",
"return",
"o",
"\n",
"}"
] | // WithPayload adds the payload to the get Id not found response | [
"WithPayload",
"adds",
"the",
"payload",
"to",
"the",
"get",
"Id",
"not",
"found",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/authentication/restapi/operations/customers/get_id_responses.go#L126-L129 |
157,683 | go-swagger/go-swagger | examples/authentication/restapi/operations/customers/get_id_responses.go | WithStatusCode | func (o *GetIDDefault) WithStatusCode(code int) *GetIDDefault {
o._statusCode = code
return o
} | go | func (o *GetIDDefault) WithStatusCode(code int) *GetIDDefault {
o._statusCode = code
return o
} | [
"func",
"(",
"o",
"*",
"GetIDDefault",
")",
"WithStatusCode",
"(",
"code",
"int",
")",
"*",
"GetIDDefault",
"{",
"o",
".",
"_statusCode",
"=",
"code",
"\n",
"return",
"o",
"\n",
"}"
] | // WithStatusCode adds the status to the get Id default response | [
"WithStatusCode",
"adds",
"the",
"status",
"to",
"the",
"get",
"Id",
"default",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/authentication/restapi/operations/customers/get_id_responses.go#L173-L176 |
157,684 | go-swagger/go-swagger | examples/authentication/restapi/operations/customers/get_id_responses.go | WithPayload | func (o *GetIDDefault) WithPayload(payload *models.Error) *GetIDDefault {
o.Payload = payload
return o
} | go | func (o *GetIDDefault) WithPayload(payload *models.Error) *GetIDDefault {
o.Payload = payload
return o
} | [
"func",
"(",
"o",
"*",
"GetIDDefault",
")",
"WithPayload",
"(",
"payload",
"*",
"models",
".",
"Error",
")",
"*",
"GetIDDefault",
"{",
"o",
".",
"Payload",
"=",
"payload",
"\n",
"return",
"o",
"\n",
"}"
] | // WithPayload adds the payload to the get Id default response | [
"WithPayload",
"adds",
"the",
"payload",
"to",
"the",
"get",
"Id",
"default",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/authentication/restapi/operations/customers/get_id_responses.go#L184-L187 |
157,685 | go-swagger/go-swagger | examples/composed-auth/restapi/operations/get_order.go | NewGetOrder | func NewGetOrder(ctx *middleware.Context, handler GetOrderHandler) *GetOrder {
return &GetOrder{Context: ctx, Handler: handler}
} | go | func NewGetOrder(ctx *middleware.Context, handler GetOrderHandler) *GetOrder {
return &GetOrder{Context: ctx, Handler: handler}
} | [
"func",
"NewGetOrder",
"(",
"ctx",
"*",
"middleware",
".",
"Context",
",",
"handler",
"GetOrderHandler",
")",
"*",
"GetOrder",
"{",
"return",
"&",
"GetOrder",
"{",
"Context",
":",
"ctx",
",",
"Handler",
":",
"handler",
"}",
"\n",
"}"
] | // NewGetOrder creates a new http.Handler for the get order operation | [
"NewGetOrder",
"creates",
"a",
"new",
"http",
".",
"Handler",
"for",
"the",
"get",
"order",
"operation"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/composed-auth/restapi/operations/get_order.go#L30-L32 |
157,686 | go-swagger/go-swagger | examples/contributed-templates/stratoscale/restapi/operations/pet/pet_update_responses.go | WithPayload | func (o *PetUpdateCreated) WithPayload(payload *models.Pet) *PetUpdateCreated {
o.Payload = payload
return o
} | go | func (o *PetUpdateCreated) WithPayload(payload *models.Pet) *PetUpdateCreated {
o.Payload = payload
return o
} | [
"func",
"(",
"o",
"*",
"PetUpdateCreated",
")",
"WithPayload",
"(",
"payload",
"*",
"models",
".",
"Pet",
")",
"*",
"PetUpdateCreated",
"{",
"o",
".",
"Payload",
"=",
"payload",
"\n",
"return",
"o",
"\n",
"}"
] | // WithPayload adds the payload to the pet update created response | [
"WithPayload",
"adds",
"the",
"payload",
"to",
"the",
"pet",
"update",
"created",
"response"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/restapi/operations/pet/pet_update_responses.go#L38-L41 |
157,687 | go-swagger/go-swagger | examples/generated/restapi/operations/pet/get_pet_by_id.go | NewGetPetByID | func NewGetPetByID(ctx *middleware.Context, handler GetPetByIDHandler) *GetPetByID {
return &GetPetByID{Context: ctx, Handler: handler}
} | go | func NewGetPetByID(ctx *middleware.Context, handler GetPetByIDHandler) *GetPetByID {
return &GetPetByID{Context: ctx, Handler: handler}
} | [
"func",
"NewGetPetByID",
"(",
"ctx",
"*",
"middleware",
".",
"Context",
",",
"handler",
"GetPetByIDHandler",
")",
"*",
"GetPetByID",
"{",
"return",
"&",
"GetPetByID",
"{",
"Context",
":",
"ctx",
",",
"Handler",
":",
"handler",
"}",
"\n",
"}"
] | // NewGetPetByID creates a new http.Handler for the get pet by Id operation | [
"NewGetPetByID",
"creates",
"a",
"new",
"http",
".",
"Handler",
"for",
"the",
"get",
"pet",
"by",
"Id",
"operation"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/pet/get_pet_by_id.go#L28-L30 |
157,688 | go-swagger/go-swagger | scan/scanner.go | Application | func Application(opts Opts) (*spec.Swagger, error) {
parser, err := newAppScanner(&opts)
if err != nil {
return nil, err
}
return parser.Parse()
} | go | func Application(opts Opts) (*spec.Swagger, error) {
parser, err := newAppScanner(&opts)
if err != nil {
return nil, err
}
return parser.Parse()
} | [
"func",
"Application",
"(",
"opts",
"Opts",
")",
"(",
"*",
"spec",
".",
"Swagger",
",",
"error",
")",
"{",
"parser",
",",
"err",
":=",
"newAppScanner",
"(",
"&",
"opts",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",... | // Application scans the application and builds a swagger spec based on the information from the code files.
// When there are includes provided, only those files are considered for the initial discovery.
// Similarly the excludes will exclude an item from initial discovery through scanning for annotations.
// When something in the discovered items requires a type that is contained in the includes or excludes it will still be
// in the spec. | [
"Application",
"scans",
"the",
"application",
"and",
"builds",
"a",
"swagger",
"spec",
"based",
"on",
"the",
"information",
"from",
"the",
"code",
"files",
".",
"When",
"there",
"are",
"includes",
"provided",
"only",
"those",
"files",
"are",
"considered",
"for... | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/scan/scanner.go#L180-L187 |
157,689 | go-swagger/go-swagger | scan/scanner.go | newAppScanner | func newAppScanner(opts *Opts) (*appScanner, error) {
if Debug {
log.Println("scanning packages discovered through entrypoint @ ", opts.BasePath)
}
var ldr loader.Config
ldr.ParserMode = goparser.ParseComments
ldr.Import(opts.BasePath)
if opts.BuildTags != "" {
ldr.Build = &build.Default
ldr.Build.BuildTags = strings.Split(opts.BuildTags, ",")
}
ldr.TypeChecker = types.Config{FakeImportC: true}
prog, err := ldr.Load()
if err != nil {
return nil, err
}
var includes, excludes packageFilters
if len(opts.Include) > 0 {
for _, include := range opts.Include {
includes = append(includes, packageFilter{Name: include})
}
}
if len(opts.Exclude) > 0 {
for _, exclude := range opts.Exclude {
excludes = append(excludes, packageFilter{Name: exclude})
}
}
includeTags := make(map[string]bool)
for _, includeTag := range opts.IncludeTags {
includeTags[includeTag] = true
}
excludeTags := make(map[string]bool)
for _, excludeTag := range opts.ExcludeTags {
excludeTags[excludeTag] = true
}
input := opts.Input
if input == nil {
input = new(spec.Swagger)
input.Swagger = "2.0"
}
if input.Paths == nil {
input.Paths = new(spec.Paths)
}
if input.Definitions == nil {
input.Definitions = make(map[string]spec.Schema)
}
if input.Responses == nil {
input.Responses = make(map[string]spec.Response)
}
if input.Extensions == nil {
input.Extensions = make(spec.Extensions)
}
return &appScanner{
MainPackage: opts.BasePath,
prog: prog,
input: input,
loader: &ldr,
operations: collectOperationsFromInput(input),
definitions: input.Definitions,
responses: input.Responses,
scanModels: opts.ScanModels,
classifier: &programClassifier{
Includes: includes,
Excludes: excludes,
},
includeTags: includeTags,
excludeTas: excludeTags,
}, nil
} | go | func newAppScanner(opts *Opts) (*appScanner, error) {
if Debug {
log.Println("scanning packages discovered through entrypoint @ ", opts.BasePath)
}
var ldr loader.Config
ldr.ParserMode = goparser.ParseComments
ldr.Import(opts.BasePath)
if opts.BuildTags != "" {
ldr.Build = &build.Default
ldr.Build.BuildTags = strings.Split(opts.BuildTags, ",")
}
ldr.TypeChecker = types.Config{FakeImportC: true}
prog, err := ldr.Load()
if err != nil {
return nil, err
}
var includes, excludes packageFilters
if len(opts.Include) > 0 {
for _, include := range opts.Include {
includes = append(includes, packageFilter{Name: include})
}
}
if len(opts.Exclude) > 0 {
for _, exclude := range opts.Exclude {
excludes = append(excludes, packageFilter{Name: exclude})
}
}
includeTags := make(map[string]bool)
for _, includeTag := range opts.IncludeTags {
includeTags[includeTag] = true
}
excludeTags := make(map[string]bool)
for _, excludeTag := range opts.ExcludeTags {
excludeTags[excludeTag] = true
}
input := opts.Input
if input == nil {
input = new(spec.Swagger)
input.Swagger = "2.0"
}
if input.Paths == nil {
input.Paths = new(spec.Paths)
}
if input.Definitions == nil {
input.Definitions = make(map[string]spec.Schema)
}
if input.Responses == nil {
input.Responses = make(map[string]spec.Response)
}
if input.Extensions == nil {
input.Extensions = make(spec.Extensions)
}
return &appScanner{
MainPackage: opts.BasePath,
prog: prog,
input: input,
loader: &ldr,
operations: collectOperationsFromInput(input),
definitions: input.Definitions,
responses: input.Responses,
scanModels: opts.ScanModels,
classifier: &programClassifier{
Includes: includes,
Excludes: excludes,
},
includeTags: includeTags,
excludeTas: excludeTags,
}, nil
} | [
"func",
"newAppScanner",
"(",
"opts",
"*",
"Opts",
")",
"(",
"*",
"appScanner",
",",
"error",
")",
"{",
"if",
"Debug",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
",",
"opts",
".",
"BasePath",
")",
"\n",
"}",
"\n",
"var",
"ldr",
"loader",
".",
"... | // newAppScanner creates a new api parser | [
"newAppScanner",
"creates",
"a",
"new",
"api",
"parser"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/scan/scanner.go#L209-L281 |
157,690 | go-swagger/go-swagger | scan/scanner.go | Parse | func (a *appScanner) Parse() (*spec.Swagger, error) {
// classification still includes files that are completely commented out
cp, err := a.classifier.Classify(a.prog)
if err != nil {
return nil, err
}
// build models dictionary
if a.scanModels {
for _, modelsFile := range cp.Models {
if err := a.parseSchema(modelsFile); err != nil {
return nil, err
}
}
}
// build parameters dictionary
for _, paramsFile := range cp.Parameters {
if err := a.parseParameters(paramsFile); err != nil {
return nil, err
}
}
// build responses dictionary
for _, responseFile := range cp.Responses {
if err := a.parseResponses(responseFile); err != nil {
return nil, err
}
}
// build definitions dictionary
if err := a.processDiscovered(); err != nil {
return nil, err
}
// build paths dictionary
for _, routeFile := range cp.Routes {
if err := a.parseRoutes(routeFile); err != nil {
return nil, err
}
}
for _, operationFile := range cp.Operations {
if err := a.parseOperations(operationFile); err != nil {
return nil, err
}
}
// build swagger object
for _, metaFile := range cp.Meta {
if err := a.parseMeta(metaFile); err != nil {
return nil, err
}
}
if a.input.Swagger == "" {
a.input.Swagger = "2.0"
}
return a.input, nil
} | go | func (a *appScanner) Parse() (*spec.Swagger, error) {
// classification still includes files that are completely commented out
cp, err := a.classifier.Classify(a.prog)
if err != nil {
return nil, err
}
// build models dictionary
if a.scanModels {
for _, modelsFile := range cp.Models {
if err := a.parseSchema(modelsFile); err != nil {
return nil, err
}
}
}
// build parameters dictionary
for _, paramsFile := range cp.Parameters {
if err := a.parseParameters(paramsFile); err != nil {
return nil, err
}
}
// build responses dictionary
for _, responseFile := range cp.Responses {
if err := a.parseResponses(responseFile); err != nil {
return nil, err
}
}
// build definitions dictionary
if err := a.processDiscovered(); err != nil {
return nil, err
}
// build paths dictionary
for _, routeFile := range cp.Routes {
if err := a.parseRoutes(routeFile); err != nil {
return nil, err
}
}
for _, operationFile := range cp.Operations {
if err := a.parseOperations(operationFile); err != nil {
return nil, err
}
}
// build swagger object
for _, metaFile := range cp.Meta {
if err := a.parseMeta(metaFile); err != nil {
return nil, err
}
}
if a.input.Swagger == "" {
a.input.Swagger = "2.0"
}
return a.input, nil
} | [
"func",
"(",
"a",
"*",
"appScanner",
")",
"Parse",
"(",
")",
"(",
"*",
"spec",
".",
"Swagger",
",",
"error",
")",
"{",
"// classification still includes files that are completely commented out",
"cp",
",",
"err",
":=",
"a",
".",
"classifier",
".",
"Classify",
... | // Parse produces a swagger object for an application | [
"Parse",
"produces",
"a",
"swagger",
"object",
"for",
"an",
"application"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/scan/scanner.go#L314-L373 |
157,691 | go-swagger/go-swagger | scan/scanner.go | MustExpandPackagePath | func (a *appScanner) MustExpandPackagePath(packagePath string) string {
pkgRealpath := swag.FindInGoSearchPath(packagePath)
if pkgRealpath == "" {
log.Fatalf("Can't find package %s \n", packagePath)
}
return pkgRealpath
} | go | func (a *appScanner) MustExpandPackagePath(packagePath string) string {
pkgRealpath := swag.FindInGoSearchPath(packagePath)
if pkgRealpath == "" {
log.Fatalf("Can't find package %s \n", packagePath)
}
return pkgRealpath
} | [
"func",
"(",
"a",
"*",
"appScanner",
")",
"MustExpandPackagePath",
"(",
"packagePath",
"string",
")",
"string",
"{",
"pkgRealpath",
":=",
"swag",
".",
"FindInGoSearchPath",
"(",
"packagePath",
")",
"\n",
"if",
"pkgRealpath",
"==",
"\"",
"\"",
"{",
"log",
"."... | // MustExpandPackagePath gets the real package path on disk | [
"MustExpandPackagePath",
"gets",
"the",
"real",
"package",
"path",
"on",
"disk"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/scan/scanner.go#L459-L466 |
157,692 | go-swagger/go-swagger | scan/scanner.go | collectScannerTitleDescription | func collectScannerTitleDescription(headers []string) (title, desc []string) {
hdrs := cleanupScannerLines(headers, rxUncommentHeaders, nil)
idx := -1
for i, line := range hdrs {
if strings.TrimSpace(line) == "" {
idx = i
break
}
}
if idx > -1 {
title = hdrs[:idx]
if len(hdrs) > idx+1 {
desc = hdrs[idx+1:]
} else {
desc = nil
}
return
}
if len(hdrs) > 0 {
line := hdrs[0]
if rxPunctuationEnd.MatchString(line) {
title = []string{line}
desc = hdrs[1:]
} else {
desc = hdrs
}
}
return
} | go | func collectScannerTitleDescription(headers []string) (title, desc []string) {
hdrs := cleanupScannerLines(headers, rxUncommentHeaders, nil)
idx := -1
for i, line := range hdrs {
if strings.TrimSpace(line) == "" {
idx = i
break
}
}
if idx > -1 {
title = hdrs[:idx]
if len(hdrs) > idx+1 {
desc = hdrs[idx+1:]
} else {
desc = nil
}
return
}
if len(hdrs) > 0 {
line := hdrs[0]
if rxPunctuationEnd.MatchString(line) {
title = []string{line}
desc = hdrs[1:]
} else {
desc = hdrs
}
}
return
} | [
"func",
"collectScannerTitleDescription",
"(",
"headers",
"[",
"]",
"string",
")",
"(",
"title",
",",
"desc",
"[",
"]",
"string",
")",
"{",
"hdrs",
":=",
"cleanupScannerLines",
"(",
"headers",
",",
"rxUncommentHeaders",
",",
"nil",
")",
"\n\n",
"idx",
":=",
... | // a shared function that can be used to split given headers
// into a title and description | [
"a",
"shared",
"function",
"that",
"can",
"be",
"used",
"to",
"split",
"given",
"headers",
"into",
"a",
"title",
"and",
"description"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/scan/scanner.go#L665-L697 |
157,693 | go-swagger/go-swagger | generator/operation.go | GenerateServerOperation | func GenerateServerOperation(operationNames []string, opts *GenOpts) error {
if opts == nil {
return errors.New("gen opts are required")
}
templates.LoadDefaults()
if opts.TemplateDir != "" {
if err := templates.LoadDir(opts.TemplateDir); err != nil {
return err
}
}
if err := opts.CheckOpts(); err != nil {
return err
}
// Load the spec
_, specDoc, err := loadSpec(opts.Spec)
if err != nil {
return err
}
// Validate and Expand. specDoc is in/out param.
specDoc, err = validateAndFlattenSpec(opts, specDoc)
if err != nil {
return err
}
analyzed := analysis.New(specDoc.Spec())
ops := gatherOperations(analyzed, operationNames)
if len(ops) == 0 {
return errors.New("no operations were selected")
}
for operationName, opRef := range ops {
method, path, operation := opRef.Method, opRef.Path, opRef.Op
defaultScheme := opts.DefaultScheme
if defaultScheme == "" {
defaultScheme = sHTTP
}
defaultProduces := opts.DefaultProduces
if defaultProduces == "" {
defaultProduces = runtime.JSONMime
}
defaultConsumes := opts.DefaultConsumes
if defaultConsumes == "" {
defaultConsumes = runtime.JSONMime
}
serverPackage := opts.LanguageOpts.ManglePackagePath(opts.ServerPackage, "server")
generator := operationGenerator{
Name: operationName,
Method: method,
Path: path,
BasePath: specDoc.BasePath(),
APIPackage: opts.LanguageOpts.ManglePackagePath(opts.APIPackage, "api"),
ModelsPackage: opts.LanguageOpts.ManglePackagePath(opts.ModelPackage, "definitions"),
ClientPackage: opts.LanguageOpts.ManglePackagePath(opts.ClientPackage, "client"),
ServerPackage: serverPackage,
Operation: *operation,
SecurityRequirements: analyzed.SecurityRequirementsFor(operation),
SecurityDefinitions: analyzed.SecurityDefinitionsFor(operation),
Principal: opts.Principal,
Target: filepath.Join(opts.Target, filepath.FromSlash(serverPackage)),
Base: opts.Target,
Tags: opts.Tags,
IncludeHandler: opts.IncludeHandler,
IncludeParameters: opts.IncludeParameters,
IncludeResponses: opts.IncludeResponses,
IncludeValidator: true, // we no more support the CLI option to disable validation
DumpData: opts.DumpData,
DefaultScheme: defaultScheme,
DefaultProduces: defaultProduces,
DefaultConsumes: defaultConsumes,
Doc: specDoc,
Analyzed: analyzed,
GenOpts: opts,
}
if err := generator.Generate(); err != nil {
return err
}
}
return nil
} | go | func GenerateServerOperation(operationNames []string, opts *GenOpts) error {
if opts == nil {
return errors.New("gen opts are required")
}
templates.LoadDefaults()
if opts.TemplateDir != "" {
if err := templates.LoadDir(opts.TemplateDir); err != nil {
return err
}
}
if err := opts.CheckOpts(); err != nil {
return err
}
// Load the spec
_, specDoc, err := loadSpec(opts.Spec)
if err != nil {
return err
}
// Validate and Expand. specDoc is in/out param.
specDoc, err = validateAndFlattenSpec(opts, specDoc)
if err != nil {
return err
}
analyzed := analysis.New(specDoc.Spec())
ops := gatherOperations(analyzed, operationNames)
if len(ops) == 0 {
return errors.New("no operations were selected")
}
for operationName, opRef := range ops {
method, path, operation := opRef.Method, opRef.Path, opRef.Op
defaultScheme := opts.DefaultScheme
if defaultScheme == "" {
defaultScheme = sHTTP
}
defaultProduces := opts.DefaultProduces
if defaultProduces == "" {
defaultProduces = runtime.JSONMime
}
defaultConsumes := opts.DefaultConsumes
if defaultConsumes == "" {
defaultConsumes = runtime.JSONMime
}
serverPackage := opts.LanguageOpts.ManglePackagePath(opts.ServerPackage, "server")
generator := operationGenerator{
Name: operationName,
Method: method,
Path: path,
BasePath: specDoc.BasePath(),
APIPackage: opts.LanguageOpts.ManglePackagePath(opts.APIPackage, "api"),
ModelsPackage: opts.LanguageOpts.ManglePackagePath(opts.ModelPackage, "definitions"),
ClientPackage: opts.LanguageOpts.ManglePackagePath(opts.ClientPackage, "client"),
ServerPackage: serverPackage,
Operation: *operation,
SecurityRequirements: analyzed.SecurityRequirementsFor(operation),
SecurityDefinitions: analyzed.SecurityDefinitionsFor(operation),
Principal: opts.Principal,
Target: filepath.Join(opts.Target, filepath.FromSlash(serverPackage)),
Base: opts.Target,
Tags: opts.Tags,
IncludeHandler: opts.IncludeHandler,
IncludeParameters: opts.IncludeParameters,
IncludeResponses: opts.IncludeResponses,
IncludeValidator: true, // we no more support the CLI option to disable validation
DumpData: opts.DumpData,
DefaultScheme: defaultScheme,
DefaultProduces: defaultProduces,
DefaultConsumes: defaultConsumes,
Doc: specDoc,
Analyzed: analyzed,
GenOpts: opts,
}
if err := generator.Generate(); err != nil {
return err
}
}
return nil
} | [
"func",
"GenerateServerOperation",
"(",
"operationNames",
"[",
"]",
"string",
",",
"opts",
"*",
"GenOpts",
")",
"error",
"{",
"if",
"opts",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"templates",
".",
"Load... | // GenerateServerOperation generates a parameter model, parameter validator, http handler implementations for a given operation
// It also generates an operation handler interface that uses the parameter model for handling a valid request.
// Allows for specifying a list of tags to include only certain tags for the generation | [
"GenerateServerOperation",
"generates",
"a",
"parameter",
"model",
"parameter",
"validator",
"http",
"handler",
"implementations",
"for",
"a",
"given",
"operation",
"It",
"also",
"generates",
"an",
"operation",
"handler",
"interface",
"that",
"uses",
"the",
"parameter... | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/generator/operation.go#L61-L144 |
157,694 | go-swagger/go-swagger | generator/operation.go | renameTimeout | func renameTimeout(seenIds map[string][]string, current string) string {
var next string
switch strings.ToLower(current) {
case "timeout":
next = "requestTimeout"
case "requesttimeout":
next = "httpRequestTimeout"
case "httptrequesttimeout":
next = "swaggerTimeout"
case "swaggertimeout":
next = "operationTimeout"
case "operationtimeout":
next = "opTimeout"
case "optimeout":
next = "operTimeout"
}
if _, ok := seenIds[next]; ok {
return renameTimeout(seenIds, next)
}
return next
} | go | func renameTimeout(seenIds map[string][]string, current string) string {
var next string
switch strings.ToLower(current) {
case "timeout":
next = "requestTimeout"
case "requesttimeout":
next = "httpRequestTimeout"
case "httptrequesttimeout":
next = "swaggerTimeout"
case "swaggertimeout":
next = "operationTimeout"
case "operationtimeout":
next = "opTimeout"
case "optimeout":
next = "operTimeout"
}
if _, ok := seenIds[next]; ok {
return renameTimeout(seenIds, next)
}
return next
} | [
"func",
"renameTimeout",
"(",
"seenIds",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
",",
"current",
"string",
")",
"string",
"{",
"var",
"next",
"string",
"\n",
"switch",
"strings",
".",
"ToLower",
"(",
"current",
")",
"{",
"case",
"\"",
"\"",
":",... | // renameTimeout renames the variable in use by client template to avoid conflicting
// with param names. | [
"renameTimeout",
"renames",
"the",
"variable",
"in",
"use",
"by",
"client",
"template",
"to",
"avoid",
"conflicting",
"with",
"param",
"names",
"."
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/generator/operation.go#L288-L308 |
157,695 | go-swagger/go-swagger | generator/operation.go | HasValidations | func (b *codeGenOpBuilder) HasValidations(sh spec.CommonValidations, rt resolvedType) (hasValidations bool, hasSliceValidations bool) {
// TODO: exclude format byte (istrfmt.Base64) from validation (issue#1548)
hasNumberValidation := sh.Maximum != nil || sh.Minimum != nil || sh.MultipleOf != nil
hasStringValidation := sh.MaxLength != nil || sh.MinLength != nil || sh.Pattern != ""
hasSliceValidations = sh.MaxItems != nil || sh.MinItems != nil || sh.UniqueItems || len(sh.Enum) > 0
hasValidations = (hasNumberValidation || hasStringValidation || hasSliceValidations || rt.IsCustomFormatter) && !rt.IsStream && !rt.IsInterface
return
} | go | func (b *codeGenOpBuilder) HasValidations(sh spec.CommonValidations, rt resolvedType) (hasValidations bool, hasSliceValidations bool) {
// TODO: exclude format byte (istrfmt.Base64) from validation (issue#1548)
hasNumberValidation := sh.Maximum != nil || sh.Minimum != nil || sh.MultipleOf != nil
hasStringValidation := sh.MaxLength != nil || sh.MinLength != nil || sh.Pattern != ""
hasSliceValidations = sh.MaxItems != nil || sh.MinItems != nil || sh.UniqueItems || len(sh.Enum) > 0
hasValidations = (hasNumberValidation || hasStringValidation || hasSliceValidations || rt.IsCustomFormatter) && !rt.IsStream && !rt.IsInterface
return
} | [
"func",
"(",
"b",
"*",
"codeGenOpBuilder",
")",
"HasValidations",
"(",
"sh",
"spec",
".",
"CommonValidations",
",",
"rt",
"resolvedType",
")",
"(",
"hasValidations",
"bool",
",",
"hasSliceValidations",
"bool",
")",
"{",
"// TODO: exclude format byte (istrfmt.Base64) f... | // HasValidations resolves the validation status for simple schema objects | [
"HasValidations",
"resolves",
"the",
"validation",
"status",
"for",
"simple",
"schema",
"objects"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/generator/operation.go#L675-L682 |
157,696 | go-swagger/go-swagger | generator/operation.go | MakeBodyParameter | func (b *codeGenOpBuilder) MakeBodyParameter(res *GenParameter, resolver *typeResolver, sch *spec.Schema) error {
// resolve schema model
schema, ers := b.buildOperationSchema(res.Path, b.Operation.ID+"ParamsBody", swag.ToGoName(b.Operation.ID+" Body"), res.ReceiverName, res.IndexVar, sch, resolver)
if ers != nil {
return ers
}
res.Schema = &schema
res.Schema.Required = res.Required // Required in body is managed independently from validations
// build Child items for nested slices and maps
var items *GenItems
res.KeyVar = "k"
res.Schema.KeyVar = "k"
if schema.IsMap && !schema.IsInterface {
items = b.MakeBodyParameterItemsAndMaps(res, res.Schema.AdditionalProperties)
} else if schema.IsArray {
items = b.MakeBodyParameterItemsAndMaps(res, res.Schema.Items)
} else {
items = new(GenItems)
}
// templates assume at least one .Child != nil
res.Child = items
schema.HasValidations = schema.HasValidations || items.HasValidations
res.resolvedType = schema.resolvedType
// simple and schema views share the same validations
res.sharedValidations = schema.sharedValidations
res.ZeroValue = schema.Zero()
return nil
} | go | func (b *codeGenOpBuilder) MakeBodyParameter(res *GenParameter, resolver *typeResolver, sch *spec.Schema) error {
// resolve schema model
schema, ers := b.buildOperationSchema(res.Path, b.Operation.ID+"ParamsBody", swag.ToGoName(b.Operation.ID+" Body"), res.ReceiverName, res.IndexVar, sch, resolver)
if ers != nil {
return ers
}
res.Schema = &schema
res.Schema.Required = res.Required // Required in body is managed independently from validations
// build Child items for nested slices and maps
var items *GenItems
res.KeyVar = "k"
res.Schema.KeyVar = "k"
if schema.IsMap && !schema.IsInterface {
items = b.MakeBodyParameterItemsAndMaps(res, res.Schema.AdditionalProperties)
} else if schema.IsArray {
items = b.MakeBodyParameterItemsAndMaps(res, res.Schema.Items)
} else {
items = new(GenItems)
}
// templates assume at least one .Child != nil
res.Child = items
schema.HasValidations = schema.HasValidations || items.HasValidations
res.resolvedType = schema.resolvedType
// simple and schema views share the same validations
res.sharedValidations = schema.sharedValidations
res.ZeroValue = schema.Zero()
return nil
} | [
"func",
"(",
"b",
"*",
"codeGenOpBuilder",
")",
"MakeBodyParameter",
"(",
"res",
"*",
"GenParameter",
",",
"resolver",
"*",
"typeResolver",
",",
"sch",
"*",
"spec",
".",
"Schema",
")",
"error",
"{",
"// resolve schema model",
"schema",
",",
"ers",
":=",
"b",... | // MakeBodyParameter constructs a body parameter schema | [
"MakeBodyParameter",
"constructs",
"a",
"body",
"parameter",
"schema"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/generator/operation.go#L783-L814 |
157,697 | go-swagger/go-swagger | generator/operation.go | makeSecuritySchemes | func (b *codeGenOpBuilder) makeSecuritySchemes(receiver string) GenSecuritySchemes {
return gatherSecuritySchemes(b.SecurityDefinitions, b.Name, b.Principal, receiver)
} | go | func (b *codeGenOpBuilder) makeSecuritySchemes(receiver string) GenSecuritySchemes {
return gatherSecuritySchemes(b.SecurityDefinitions, b.Name, b.Principal, receiver)
} | [
"func",
"(",
"b",
"*",
"codeGenOpBuilder",
")",
"makeSecuritySchemes",
"(",
"receiver",
"string",
")",
"GenSecuritySchemes",
"{",
"return",
"gatherSecuritySchemes",
"(",
"b",
".",
"SecurityDefinitions",
",",
"b",
".",
"Name",
",",
"b",
".",
"Principal",
",",
"... | // makeSecuritySchemes produces a sorted list of security schemes for this operation | [
"makeSecuritySchemes",
"produces",
"a",
"sorted",
"list",
"of",
"security",
"schemes",
"for",
"this",
"operation"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/generator/operation.go#L965-L967 |
157,698 | go-swagger/go-swagger | generator/operation.go | cloneSchema | func (b *codeGenOpBuilder) cloneSchema(schema *spec.Schema) *spec.Schema {
savedSchema := &spec.Schema{}
schemaRep, _ := json.Marshal(schema)
_ = json.Unmarshal(schemaRep, savedSchema)
return savedSchema
} | go | func (b *codeGenOpBuilder) cloneSchema(schema *spec.Schema) *spec.Schema {
savedSchema := &spec.Schema{}
schemaRep, _ := json.Marshal(schema)
_ = json.Unmarshal(schemaRep, savedSchema)
return savedSchema
} | [
"func",
"(",
"b",
"*",
"codeGenOpBuilder",
")",
"cloneSchema",
"(",
"schema",
"*",
"spec",
".",
"Schema",
")",
"*",
"spec",
".",
"Schema",
"{",
"savedSchema",
":=",
"&",
"spec",
".",
"Schema",
"{",
"}",
"\n",
"schemaRep",
",",
"_",
":=",
"json",
".",... | // cloneSchema returns a deep copy of a schema | [
"cloneSchema",
"returns",
"a",
"deep",
"copy",
"of",
"a",
"schema"
] | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/generator/operation.go#L998-L1003 |
157,699 | go-swagger/go-swagger | generator/operation.go | liftExtraSchemas | func (b *codeGenOpBuilder) liftExtraSchemas(resolver, br *typeResolver, bs *spec.Schema, sc *schemaGenContext) (schema *GenSchema, err error) {
// restore resolving state before previous call to makeGenSchema()
rslv := br
sc.Schema = *bs
pg := sc.shallowClone()
pkg := b.GenOpts.LanguageOpts.ManglePackageName(resolver.ModelsPackage, "models")
pg.TypeResolver = newTypeResolver("", rslv.Doc).withKeepDefinitionsPackage(pkg)
pg.ExtraSchemas = make(map[string]GenSchema, len(sc.ExtraSchemas))
if err = pg.makeGenSchema(); err != nil {
return
}
// lift nested extra schemas (inlined types)
if b.ExtraSchemas == nil {
b.ExtraSchemas = make(map[string]GenSchema, len(pg.ExtraSchemas))
}
for _, v := range pg.ExtraSchemas {
vv := v
if !v.IsStream {
b.ExtraSchemas[vv.Name] = vv
}
}
schema = &pg.GenSchema
return
} | go | func (b *codeGenOpBuilder) liftExtraSchemas(resolver, br *typeResolver, bs *spec.Schema, sc *schemaGenContext) (schema *GenSchema, err error) {
// restore resolving state before previous call to makeGenSchema()
rslv := br
sc.Schema = *bs
pg := sc.shallowClone()
pkg := b.GenOpts.LanguageOpts.ManglePackageName(resolver.ModelsPackage, "models")
pg.TypeResolver = newTypeResolver("", rslv.Doc).withKeepDefinitionsPackage(pkg)
pg.ExtraSchemas = make(map[string]GenSchema, len(sc.ExtraSchemas))
if err = pg.makeGenSchema(); err != nil {
return
}
// lift nested extra schemas (inlined types)
if b.ExtraSchemas == nil {
b.ExtraSchemas = make(map[string]GenSchema, len(pg.ExtraSchemas))
}
for _, v := range pg.ExtraSchemas {
vv := v
if !v.IsStream {
b.ExtraSchemas[vv.Name] = vv
}
}
schema = &pg.GenSchema
return
} | [
"func",
"(",
"b",
"*",
"codeGenOpBuilder",
")",
"liftExtraSchemas",
"(",
"resolver",
",",
"br",
"*",
"typeResolver",
",",
"bs",
"*",
"spec",
".",
"Schema",
",",
"sc",
"*",
"schemaGenContext",
")",
"(",
"schema",
"*",
"GenSchema",
",",
"err",
"error",
")"... | // liftExtraSchemas constructs the schema for an anonymous construct with some ExtraSchemas.
//
// When some ExtraSchemas are produced from something else than a definition,
// this indicates we are not running in fully flattened mode and we need to render
// these ExtraSchemas in the operation's package.
// We need to rebuild the schema with a new type resolver to reflect this change in the
// models package. | [
"liftExtraSchemas",
"constructs",
"the",
"schema",
"for",
"an",
"anonymous",
"construct",
"with",
"some",
"ExtraSchemas",
".",
"When",
"some",
"ExtraSchemas",
"are",
"produced",
"from",
"something",
"else",
"than",
"a",
"definition",
"this",
"indicates",
"we",
"ar... | ffefbd274717d6fa3bcca1c494487edf1f48104b | https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/generator/operation.go#L1021-L1046 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.