Jump to content

ошибки в editor.swagger.io


mstdmstd
 Share

Recommended Posts

Подскажите,
пытаюсь в http://editor.swagger.io написать описание GET - запроса с необязательным параметром department_id
 

swagger: "2.0"
info:
description: "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters."
version: "1.0.0"
title: "Clients demo"
termsOfService: "http://swagger.io/terms/"
contact:
email: "apiteam@swagger.io"
license:
name: "Apache 2.0"
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
host: "ec2-34-212-140-26.us-west-2.compute.amazonaws.com"
basePath: "/v1"
tags:
- name: "client"
description: "Everything about your Clients demo"
externalDocs:
description: "Find out more"
url: "http://swagger.io"


- name: "department"
description: "Access to departments of Clients demo"
externalDocs:
description: "Find out more about our store"
url: "http://swagger.io"
schemes:
- "http"
paths:
/department/{department_id}:
get:
tags:
- "department"
summary: "Finds departments by department_id or by filters"
description: "Multiple status values can be provided with comma separated strings"
operationId: "findPetsByStatus"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "department_id"
in: "path"
description: "ID of department that needs to be retrieved"
type: "integer"
format: "int64"


responses:
200:
description: "successful operation"
schema:
type: "array"
items:
$ref: "#/definitions/Department"
400:
description: "Invalid status value"
#security:
#- petstore_auth:
# - "write:pets"
# - "read:pets"

post:
tags:
- "department"
summary: "Add a new department to the Clients demo"
description: "Department object(
`department_id` INT(11) - required,
`name` VARCHAR(50) - required,
`is_active` TINYINT(1) - (0/1) - required,
`created_at` - autogenerated,
) that needs to be added to the Clients Demo"
operationId: "addDepartment"
consumes:
- "application/json"
- "application/xml"
produces:
- "application/xml"
- "application/json"
parameters:
- in: "body"
name: "body"
description: ""
required: true
schema:
$ref: "#/definitions/Department"
responses:
405:
description: "Invalid input"
# security:
# - petstore_auth:
# - "write:pets"
# - "read:pets"

definitions:
Department:
type: "object"
properties:
department_id:
type: "integer"
format: "int64"
name:
type: "string"
is_active:
type: "integer"
description: "Order Status"
enum:
- 0
- 1
created_at:
type: "string"
default: false
xml:
name: "Order"



и получаю ошибкиprintscreen:

А как правильно?

Спасибо !
 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy