mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Add missing swagger spec (#175)
* Add missing swagger spec * More cleaning up of the swagger.yml and removing unused structs * Add TaskWrapper
This commit is contained in:
committed by
C Cirello
parent
c95c0dd8f0
commit
e85a31b715
@@ -1,34 +0,0 @@
|
|||||||
package models
|
|
||||||
|
|
||||||
import (
|
|
||||||
strfmt "github.com/go-openapi/strfmt"
|
|
||||||
"github.com/go-openapi/validate"
|
|
||||||
|
|
||||||
"github.com/go-openapi/errors"
|
|
||||||
)
|
|
||||||
|
|
||||||
type AppsWrapper struct {
|
|
||||||
Apps []*App `json:"apps"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *AppsWrapper) Validate(formats strfmt.Registry) error {
|
|
||||||
var res []error
|
|
||||||
|
|
||||||
if err := m.validateApps(formats); err != nil {
|
|
||||||
res = append(res, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(res) > 0 {
|
|
||||||
return errors.CompositeValidationError(res...)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *AppsWrapper) validateApps(formats strfmt.Registry) error {
|
|
||||||
|
|
||||||
if err := validate.Required("apps", "body", m.Apps); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
package models
|
|
||||||
|
|
||||||
// This file was generated by the swagger tool.
|
|
||||||
// Editing this file might prove futile when you re-run the swagger generate command
|
|
||||||
|
|
||||||
import (
|
|
||||||
strfmt "github.com/go-openapi/strfmt"
|
|
||||||
|
|
||||||
"github.com/go-openapi/errors"
|
|
||||||
"github.com/go-openapi/validate"
|
|
||||||
)
|
|
||||||
|
|
||||||
/*NewTasksWrapper new tasks wrapper
|
|
||||||
|
|
||||||
swagger:model NewTasksWrapper
|
|
||||||
*/
|
|
||||||
type NewTasksWrapper struct {
|
|
||||||
|
|
||||||
/* tasks
|
|
||||||
|
|
||||||
Required: true
|
|
||||||
*/
|
|
||||||
Tasks []*NewTask `json:"tasks"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate validates this new tasks wrapper
|
|
||||||
func (m *NewTasksWrapper) Validate(formats strfmt.Registry) error {
|
|
||||||
var res []error
|
|
||||||
|
|
||||||
if err := m.validateTasks(formats); err != nil {
|
|
||||||
// prop
|
|
||||||
res = append(res, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(res) > 0 {
|
|
||||||
return errors.CompositeValidationError(res...)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *NewTasksWrapper) validateTasks(formats strfmt.Registry) error {
|
|
||||||
|
|
||||||
if err := validate.Required("tasks", "body", m.Tasks); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
package models
|
|
||||||
|
|
||||||
import (
|
|
||||||
strfmt "github.com/go-openapi/strfmt"
|
|
||||||
"github.com/go-openapi/validate"
|
|
||||||
|
|
||||||
"github.com/go-openapi/errors"
|
|
||||||
)
|
|
||||||
|
|
||||||
type RoutesWrapper struct {
|
|
||||||
Cursor string `json:"cursor,omitempty"`
|
|
||||||
Error *ErrorBody `json:"error,omitempty"`
|
|
||||||
Routes []*Route `json:"routes"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RoutesWrapper) Validate(formats strfmt.Registry) error {
|
|
||||||
var res []error
|
|
||||||
|
|
||||||
if err := m.validateRoutes(formats); err != nil {
|
|
||||||
res = append(res, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(res) > 0 {
|
|
||||||
return errors.CompositeValidationError(res...)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RoutesWrapper) validateRoutes(formats strfmt.Registry) error {
|
|
||||||
|
|
||||||
if err := validate.Required("routes", "body", m.Routes); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
package models
|
|
||||||
|
|
||||||
// This file was generated by the swagger tool.
|
|
||||||
// Editing this file might prove futile when you re-run the swagger generate command
|
|
||||||
|
|
||||||
import (
|
|
||||||
strfmt "github.com/go-openapi/strfmt"
|
|
||||||
|
|
||||||
"github.com/go-openapi/errors"
|
|
||||||
)
|
|
||||||
|
|
||||||
/*TaskWrapper task wrapper
|
|
||||||
|
|
||||||
swagger:model TaskWrapper
|
|
||||||
*/
|
|
||||||
type TaskWrapper struct {
|
|
||||||
|
|
||||||
/* task
|
|
||||||
|
|
||||||
Required: true
|
|
||||||
*/
|
|
||||||
Task *Task `json:"task"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate validates this task wrapper
|
|
||||||
func (m *TaskWrapper) Validate(formats strfmt.Registry) error {
|
|
||||||
var res []error
|
|
||||||
|
|
||||||
if err := m.validateTask(formats); err != nil {
|
|
||||||
// prop
|
|
||||||
res = append(res, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(res) > 0 {
|
|
||||||
return errors.CompositeValidationError(res...)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *TaskWrapper) validateTask(formats strfmt.Registry) error {
|
|
||||||
|
|
||||||
if m.Task != nil {
|
|
||||||
|
|
||||||
if err := m.Task.Validate(formats); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
package models
|
|
||||||
|
|
||||||
// This file was generated by the swagger tool.
|
|
||||||
// Editing this file might prove futile when you re-run the swagger generate command
|
|
||||||
|
|
||||||
import (
|
|
||||||
strfmt "github.com/go-openapi/strfmt"
|
|
||||||
|
|
||||||
"github.com/go-openapi/errors"
|
|
||||||
"github.com/go-openapi/validate"
|
|
||||||
)
|
|
||||||
|
|
||||||
/*TasksWrapper tasks wrapper
|
|
||||||
|
|
||||||
swagger:model TasksWrapper
|
|
||||||
*/
|
|
||||||
type TasksWrapper struct {
|
|
||||||
|
|
||||||
/* Used to paginate results. If this is returned, pass it into the same query again to get more results.
|
|
||||||
*/
|
|
||||||
Cursor string `json:"cursor,omitempty"`
|
|
||||||
|
|
||||||
/* error
|
|
||||||
*/
|
|
||||||
Error *ErrorBody `json:"error,omitempty"`
|
|
||||||
|
|
||||||
/* tasks
|
|
||||||
|
|
||||||
Required: true
|
|
||||||
*/
|
|
||||||
Tasks []*Task `json:"tasks"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate validates this tasks wrapper
|
|
||||||
func (m *TasksWrapper) Validate(formats strfmt.Registry) error {
|
|
||||||
var res []error
|
|
||||||
|
|
||||||
if err := m.validateTasks(formats); err != nil {
|
|
||||||
// prop
|
|
||||||
res = append(res, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(res) > 0 {
|
|
||||||
return errors.CompositeValidationError(res...)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *TasksWrapper) validateTasks(formats strfmt.Registry) error {
|
|
||||||
|
|
||||||
if err := validate.Required("tasks", "body", m.Tasks); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# This is the IronFunctions API spec
|
# This is the IronFunctions API spec
|
||||||
# If you make changes here, remember to run `go generate` in routeserver/ and
|
# If you make changes here, remember to run `go generate` in api/models/ and
|
||||||
# tasker/ to make sure you use the changes.
|
# api/server to make sure you use the changes.
|
||||||
|
|
||||||
swagger: '2.0'
|
swagger: '2.0'
|
||||||
info:
|
info:
|
||||||
@@ -143,7 +143,7 @@ paths:
|
|||||||
description: Array of routes to post.
|
description: Array of routes to post.
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/NewRoutesWrapper'
|
$ref: '#/definitions/RoutesWrapper'
|
||||||
responses:
|
responses:
|
||||||
201:
|
201:
|
||||||
description: Route created
|
description: Route created
|
||||||
@@ -251,7 +251,7 @@ paths:
|
|||||||
200:
|
200:
|
||||||
description: Task information
|
description: Task information
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/TasksWrapper'
|
$ref: '#/definitions/TaskWrapper'
|
||||||
default:
|
default:
|
||||||
description: Unexpected error
|
description: Unexpected error
|
||||||
schema:
|
schema:
|
||||||
@@ -329,7 +329,6 @@ definitions:
|
|||||||
Task:
|
Task:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: "#/definitions/NewTask"
|
- $ref: "#/definitions/NewTask"
|
||||||
- $ref: "#/definitions/IdStatus"
|
|
||||||
- type: object
|
- type: object
|
||||||
properties:
|
properties:
|
||||||
group_name:
|
group_name:
|
||||||
@@ -381,39 +380,6 @@ definitions:
|
|||||||
additionalProperties:
|
additionalProperties:
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
NewTasksWrapper:
|
|
||||||
type: object
|
|
||||||
required:
|
|
||||||
- tasks
|
|
||||||
properties:
|
|
||||||
tasks:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: '#/definitions/NewTask'
|
|
||||||
|
|
||||||
TasksWrapper:
|
|
||||||
type: object
|
|
||||||
required:
|
|
||||||
- tasks
|
|
||||||
properties:
|
|
||||||
tasks:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: '#/definitions/Task'
|
|
||||||
cursor:
|
|
||||||
type: string
|
|
||||||
description: Used to paginate results. If this is returned, pass it into the same query again to get more results.
|
|
||||||
error:
|
|
||||||
$ref: '#/definitions/ErrorBody'
|
|
||||||
|
|
||||||
TaskWrapper:
|
|
||||||
type: object
|
|
||||||
required:
|
|
||||||
- task
|
|
||||||
properties:
|
|
||||||
task:
|
|
||||||
$ref: '#/definitions/Task'
|
|
||||||
|
|
||||||
ErrorBody:
|
ErrorBody:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
@@ -429,3 +395,27 @@ definitions:
|
|||||||
properties:
|
properties:
|
||||||
error:
|
error:
|
||||||
$ref: '#/definitions/ErrorBody'
|
$ref: '#/definitions/ErrorBody'
|
||||||
|
|
||||||
|
NewTask:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- image
|
||||||
|
- priority
|
||||||
|
properties:
|
||||||
|
image:
|
||||||
|
type: string
|
||||||
|
description: Name of Docker image to use. This is optional and can be used to override the image defined at the group level.
|
||||||
|
payload:
|
||||||
|
type: string
|
||||||
|
# 256k
|
||||||
|
# maxLength breaks ruby generator too: https://github.com/iron-io/worker_ruby/blob/0aa9236ce5060af3f15758937712973f80dd54fe/lib/iron_titan/models/task.rb#L272
|
||||||
|
# maxLength: 268435456
|
||||||
|
description: Payload for the task. This is what you pass into each task to make it do something.
|
||||||
|
|
||||||
|
TaskWrapper:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- task
|
||||||
|
properties:
|
||||||
|
task:
|
||||||
|
$ref: '#/definitions/Task'
|
||||||
Reference in New Issue
Block a user