1. 克隆 swagger-ui 代码【参考博客)】

      1. git clone https://github.com/swagger-api/swagger-ui.git
    2. 把克隆下来的代码中的 dist 目录中的代码,拷贝到 node 项目中的 public 目录(如果没有这个目录就新建一个)

      1. // app.js 文件
      2. app.use('/api-docs', express.static('public'))
    3. 修改 public 目录下面的 index.html 文件

      1. const ui = SwaggerUIBundle({
      2. // url: "https://petstore.swagger.io/v2/swagger.json",
      3. url: './swagger.json', // 根据自己的项目自定义的 swagger.json 文件
      4. validatorUrl: false,
      5. dom_id: '#swagger-ui',
      6. deepLinking: true,
      7. presets: [
      8. SwaggerUIBundle.presets.apis,
      9. SwaggerUIStandalonePreset
      10. ],
      11. plugins: [
      12. SwaggerUIBundle.plugins.DownloadUrl
      13. ],
      14. layout: "StandaloneLayout"
      15. });
    4. swagger.json 文件 demo

      1. {
      2. "swagger": "2.0",
      3. "info": {
      4. "title": "在线图书项目",
      5. "version": "1.0.0",
      6. "description": "这是给在线图书管理项目提供的api文档",
      7. "concat": {
      8. "email": "13661603945@163.com"
      9. }
      10. },
      11. "schemes": [
      12. "http",
      13. "https"
      14. ],
      15. "tags": [
      16. {
      17. "name": "users",
      18. "description": "用户相关"
      19. }
      20. ],
      21. "paths": {
      22. "/users/list": {
      23. "get": {
      24. "tags": ["users"],
      25. "summary": "查询用户列表",
      26. "parameters": [
      27. {
      28. "name": "id",
      29. "type": "integer"
      30. }
      31. ],
      32. "responses": {
      33. "200": {
      34. "description": "操作成功"
      35. },
      36. "403": {
      37. "description": "没有访问权限"
      38. },
      39. "404": {
      40. "description": "接口没有发布"
      41. }
      42. }
      43. }
      44. },
      45. "/users/add": {
      46. "post": {
      47. "tags": ["users"],
      48. "summary": "新增用户",
      49. "consumes": [
      50. "application/json",
      51. "application/xml"
      52. ],
      53. "parameters": [
      54. {
      55. "in": "body",
      56. "name": "body",
      57. "type": "string",
      58. "description": "新增用户",
      59. "required": true,
      60. "schema": {
      61. "type": "object",
      62. "required": ["name", "age"],
      63. "properties": {
      64. "name": {
      65. "type": "string",
      66. "example": "张三"
      67. },
      68. "age": {
      69. "type": "integer",
      70. "example": 19
      71. }
      72. }
      73. }
      74. }
      75. ],
      76. "responses": {
      77. "200": {
      78. "description": "操作成功"
      79. },
      80. "403": {
      81. "description": "没有访问权限"
      82. },
      83. "404": {
      84. "description": "接口没有发布"
      85. }
      86. }
      87. }
      88. }
      89. }
      90. }
    5. 官方 swagger.json 文件

      1. {
      2. "swagger": "2.0",
      3. "info": {
      4. "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.",
      5. "version": "1.0.6",
      6. "title": "Swagger Petstore",
      7. "termsOfService": "http://swagger.io/terms/",
      8. "contact": {
      9. "email": "apiteam@swagger.io"
      10. },
      11. "license": {
      12. "name": "Apache 2.0",
      13. "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
      14. }
      15. },
      16. "host": "petstore.swagger.io",
      17. "basePath": "/v2",
      18. "tags": [
      19. {
      20. "name": "pet",
      21. "description": "Everything about your Pets",
      22. "externalDocs": {
      23. "description": "Find out more",
      24. "url": "http://swagger.io"
      25. }
      26. },
      27. {
      28. "name": "store",
      29. "description": "Access to Petstore orders"
      30. },
      31. {
      32. "name": "user",
      33. "description": "Operations about user",
      34. "externalDocs": {
      35. "description": "Find out more about our store",
      36. "url": "http://swagger.io"
      37. }
      38. }
      39. ],
      40. "schemes": [
      41. "https",
      42. "http"
      43. ],
      44. "paths": {
      45. "/pet/{petId}/uploadImage": {
      46. "post": {
      47. "tags": [
      48. "pet"
      49. ],
      50. "summary": "uploads an image",
      51. "description": "",
      52. "operationId": "uploadFile",
      53. "consumes": [
      54. "multipart/form-data"
      55. ],
      56. "produces": [
      57. "application/json"
      58. ],
      59. "parameters": [
      60. {
      61. "name": "petId",
      62. "in": "path",
      63. "description": "ID of pet to update",
      64. "required": true,
      65. "type": "integer",
      66. "format": "int64"
      67. },
      68. {
      69. "name": "additionalMetadata",
      70. "in": "formData",
      71. "description": "Additional data to pass to server",
      72. "required": false,
      73. "type": "string"
      74. },
      75. {
      76. "name": "file",
      77. "in": "formData",
      78. "description": "file to upload",
      79. "required": false,
      80. "type": "file"
      81. }
      82. ],
      83. "responses": {
      84. "200": {
      85. "description": "successful operation",
      86. "schema": {
      87. "$ref": "#/definitions/ApiResponse"
      88. }
      89. }
      90. },
      91. "security": [
      92. {
      93. "petstore_auth": [
      94. "write:pets",
      95. "read:pets"
      96. ]
      97. }
      98. ]
      99. }
      100. },
      101. "/pet": {
      102. "post": {
      103. "tags": [
      104. "pet"
      105. ],
      106. "summary": "Add a new pet to the store",
      107. "description": "",
      108. "operationId": "addPet",
      109. "consumes": [
      110. "application/json",
      111. "application/xml"
      112. ],
      113. "produces": [
      114. "application/json",
      115. "application/xml"
      116. ],
      117. "parameters": [
      118. {
      119. "in": "body",
      120. "name": "body",
      121. "description": "Pet object that needs to be added to the store",
      122. "required": true,
      123. "schema": {
      124. "$ref": "#/definitions/Pet"
      125. }
      126. }
      127. ],
      128. "responses": {
      129. "405": {
      130. "description": "Invalid input"
      131. }
      132. },
      133. "security": [
      134. {
      135. "petstore_auth": [
      136. "write:pets",
      137. "read:pets"
      138. ]
      139. }
      140. ]
      141. },
      142. "put": {
      143. "tags": [
      144. "pet"
      145. ],
      146. "summary": "Update an existing pet",
      147. "description": "",
      148. "operationId": "updatePet",
      149. "consumes": [
      150. "application/json",
      151. "application/xml"
      152. ],
      153. "produces": [
      154. "application/json",
      155. "application/xml"
      156. ],
      157. "parameters": [
      158. {
      159. "in": "body",
      160. "name": "body",
      161. "description": "Pet object that needs to be added to the store",
      162. "required": true,
      163. "schema": {
      164. "$ref": "#/definitions/Pet"
      165. }
      166. }
      167. ],
      168. "responses": {
      169. "400": {
      170. "description": "Invalid ID supplied"
      171. },
      172. "404": {
      173. "description": "Pet not found"
      174. },
      175. "405": {
      176. "description": "Validation exception"
      177. }
      178. },
      179. "security": [
      180. {
      181. "petstore_auth": [
      182. "write:pets",
      183. "read:pets"
      184. ]
      185. }
      186. ]
      187. }
      188. },
      189. "/pet/findByStatus": {
      190. "get": {
      191. "tags": [
      192. "pet"
      193. ],
      194. "summary": "Finds Pets by status",
      195. "description": "Multiple status values can be provided with comma separated strings",
      196. "operationId": "findPetsByStatus",
      197. "produces": [
      198. "application/json",
      199. "application/xml"
      200. ],
      201. "parameters": [
      202. {
      203. "name": "status",
      204. "in": "query",
      205. "description": "Status values that need to be considered for filter",
      206. "required": true,
      207. "type": "array",
      208. "items": {
      209. "type": "string",
      210. "enum": [
      211. "available",
      212. "pending",
      213. "sold"
      214. ],
      215. "default": "available"
      216. },
      217. "collectionFormat": "multi"
      218. }
      219. ],
      220. "responses": {
      221. "200": {
      222. "description": "successful operation",
      223. "schema": {
      224. "type": "array",
      225. "items": {
      226. "$ref": "#/definitions/Pet"
      227. }
      228. }
      229. },
      230. "400": {
      231. "description": "Invalid status value"
      232. }
      233. },
      234. "security": [
      235. {
      236. "petstore_auth": [
      237. "write:pets",
      238. "read:pets"
      239. ]
      240. }
      241. ]
      242. }
      243. },
      244. "/pet/findByTags": {
      245. "get": {
      246. "tags": [
      247. "pet"
      248. ],
      249. "summary": "Finds Pets by tags",
      250. "description": "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.",
      251. "operationId": "findPetsByTags",
      252. "produces": [
      253. "application/json",
      254. "application/xml"
      255. ],
      256. "parameters": [
      257. {
      258. "name": "tags",
      259. "in": "query",
      260. "description": "Tags to filter by",
      261. "required": true,
      262. "type": "array",
      263. "items": {
      264. "type": "string"
      265. },
      266. "collectionFormat": "multi"
      267. }
      268. ],
      269. "responses": {
      270. "200": {
      271. "description": "successful operation",
      272. "schema": {
      273. "type": "array",
      274. "items": {
      275. "$ref": "#/definitions/Pet"
      276. }
      277. }
      278. },
      279. "400": {
      280. "description": "Invalid tag value"
      281. }
      282. },
      283. "security": [
      284. {
      285. "petstore_auth": [
      286. "write:pets",
      287. "read:pets"
      288. ]
      289. }
      290. ],
      291. "deprecated": true
      292. }
      293. },
      294. "/pet/{petId}": {
      295. "get": {
      296. "tags": [
      297. "pet"
      298. ],
      299. "summary": "Find pet by ID",
      300. "description": "Returns a single pet",
      301. "operationId": "getPetById",
      302. "produces": [
      303. "application/json",
      304. "application/xml"
      305. ],
      306. "parameters": [
      307. {
      308. "name": "petId",
      309. "in": "path",
      310. "description": "ID of pet to return",
      311. "required": true,
      312. "type": "integer",
      313. "format": "int64"
      314. }
      315. ],
      316. "responses": {
      317. "200": {
      318. "description": "successful operation",
      319. "schema": {
      320. "$ref": "#/definitions/Pet"
      321. }
      322. },
      323. "400": {
      324. "description": "Invalid ID supplied"
      325. },
      326. "404": {
      327. "description": "Pet not found"
      328. }
      329. },
      330. "security": [
      331. {
      332. "api_key": [ ]
      333. }
      334. ]
      335. },
      336. "post": {
      337. "tags": [
      338. "pet"
      339. ],
      340. "summary": "Updates a pet in the store with form data",
      341. "description": "",
      342. "operationId": "updatePetWithForm",
      343. "consumes": [
      344. "application/x-www-form-urlencoded"
      345. ],
      346. "produces": [
      347. "application/json",
      348. "application/xml"
      349. ],
      350. "parameters": [
      351. {
      352. "name": "petId",
      353. "in": "path",
      354. "description": "ID of pet that needs to be updated",
      355. "required": true,
      356. "type": "integer",
      357. "format": "int64"
      358. },
      359. {
      360. "name": "name",
      361. "in": "formData",
      362. "description": "Updated name of the pet",
      363. "required": false,
      364. "type": "string"
      365. },
      366. {
      367. "name": "status",
      368. "in": "formData",
      369. "description": "Updated status of the pet",
      370. "required": false,
      371. "type": "string"
      372. }
      373. ],
      374. "responses": {
      375. "405": {
      376. "description": "Invalid input"
      377. }
      378. },
      379. "security": [
      380. {
      381. "petstore_auth": [
      382. "write:pets",
      383. "read:pets"
      384. ]
      385. }
      386. ]
      387. },
      388. "delete": {
      389. "tags": [
      390. "pet"
      391. ],
      392. "summary": "Deletes a pet",
      393. "description": "",
      394. "operationId": "deletePet",
      395. "produces": [
      396. "application/json",
      397. "application/xml"
      398. ],
      399. "parameters": [
      400. {
      401. "name": "api_key",
      402. "in": "header",
      403. "required": false,
      404. "type": "string"
      405. },
      406. {
      407. "name": "petId",
      408. "in": "path",
      409. "description": "Pet id to delete",
      410. "required": true,
      411. "type": "integer",
      412. "format": "int64"
      413. }
      414. ],
      415. "responses": {
      416. "400": {
      417. "description": "Invalid ID supplied"
      418. },
      419. "404": {
      420. "description": "Pet not found"
      421. }
      422. },
      423. "security": [
      424. {
      425. "petstore_auth": [
      426. "write:pets",
      427. "read:pets"
      428. ]
      429. }
      430. ]
      431. }
      432. },
      433. "/store/order": {
      434. "post": {
      435. "tags": [
      436. "store"
      437. ],
      438. "summary": "Place an order for a pet",
      439. "description": "",
      440. "operationId": "placeOrder",
      441. "consumes": [
      442. "application/json"
      443. ],
      444. "produces": [
      445. "application/json",
      446. "application/xml"
      447. ],
      448. "parameters": [
      449. {
      450. "in": "body",
      451. "name": "body",
      452. "description": "order placed for purchasing the pet",
      453. "required": true,
      454. "schema": {
      455. "$ref": "#/definitions/Order"
      456. }
      457. }
      458. ],
      459. "responses": {
      460. "200": {
      461. "description": "successful operation",
      462. "schema": {
      463. "$ref": "#/definitions/Order"
      464. }
      465. },
      466. "400": {
      467. "description": "Invalid Order"
      468. }
      469. }
      470. }
      471. },
      472. "/store/order/{orderId}": {
      473. "get": {
      474. "tags": [
      475. "store"
      476. ],
      477. "summary": "Find purchase order by ID",
      478. "description": "For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions",
      479. "operationId": "getOrderById",
      480. "produces": [
      481. "application/json",
      482. "application/xml"
      483. ],
      484. "parameters": [
      485. {
      486. "name": "orderId",
      487. "in": "path",
      488. "description": "ID of pet that needs to be fetched",
      489. "required": true,
      490. "type": "integer",
      491. "maximum": 10,
      492. "minimum": 1,
      493. "format": "int64"
      494. }
      495. ],
      496. "responses": {
      497. "200": {
      498. "description": "successful operation",
      499. "schema": {
      500. "$ref": "#/definitions/Order"
      501. }
      502. },
      503. "400": {
      504. "description": "Invalid ID supplied"
      505. },
      506. "404": {
      507. "description": "Order not found"
      508. }
      509. }
      510. },
      511. "delete": {
      512. "tags": [
      513. "store"
      514. ],
      515. "summary": "Delete purchase order by ID",
      516. "description": "For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors",
      517. "operationId": "deleteOrder",
      518. "produces": [
      519. "application/json",
      520. "application/xml"
      521. ],
      522. "parameters": [
      523. {
      524. "name": "orderId",
      525. "in": "path",
      526. "description": "ID of the order that needs to be deleted",
      527. "required": true,
      528. "type": "integer",
      529. "minimum": 1,
      530. "format": "int64"
      531. }
      532. ],
      533. "responses": {
      534. "400": {
      535. "description": "Invalid ID supplied"
      536. },
      537. "404": {
      538. "description": "Order not found"
      539. }
      540. }
      541. }
      542. },
      543. "/store/inventory": {
      544. "get": {
      545. "tags": [
      546. "store"
      547. ],
      548. "summary": "Returns pet inventories by status",
      549. "description": "Returns a map of status codes to quantities",
      550. "operationId": "getInventory",
      551. "produces": [
      552. "application/json"
      553. ],
      554. "parameters": [ ],
      555. "responses": {
      556. "200": {
      557. "description": "successful operation",
      558. "schema": {
      559. "type": "object",
      560. "additionalProperties": {
      561. "type": "integer",
      562. "format": "int32"
      563. }
      564. }
      565. }
      566. },
      567. "security": [
      568. {
      569. "api_key": [ ]
      570. }
      571. ]
      572. }
      573. },
      574. "/user/createWithArray": {
      575. "post": {
      576. "tags": [
      577. "user"
      578. ],
      579. "summary": "Creates list of users with given input array",
      580. "description": "",
      581. "operationId": "createUsersWithArrayInput",
      582. "consumes": [
      583. "application/json"
      584. ],
      585. "produces": [
      586. "application/json",
      587. "application/xml"
      588. ],
      589. "parameters": [
      590. {
      591. "in": "body",
      592. "name": "body",
      593. "description": "List of user object",
      594. "required": true,
      595. "schema": {
      596. "type": "array",
      597. "items": {
      598. "$ref": "#/definitions/User"
      599. }
      600. }
      601. }
      602. ],
      603. "responses": {
      604. "default": {
      605. "description": "successful operation"
      606. }
      607. }
      608. }
      609. },
      610. "/user/createWithList": {
      611. "post": {
      612. "tags": [
      613. "user"
      614. ],
      615. "summary": "Creates list of users with given input array",
      616. "description": "",
      617. "operationId": "createUsersWithListInput",
      618. "consumes": [
      619. "application/json"
      620. ],
      621. "produces": [
      622. "application/json",
      623. "application/xml"
      624. ],
      625. "parameters": [
      626. {
      627. "in": "body",
      628. "name": "body",
      629. "description": "List of user object",
      630. "required": true,
      631. "schema": {
      632. "type": "array",
      633. "items": {
      634. "$ref": "#/definitions/User"
      635. }
      636. }
      637. }
      638. ],
      639. "responses": {
      640. "default": {
      641. "description": "successful operation"
      642. }
      643. }
      644. }
      645. },
      646. "/user/{username}": {
      647. "get": {
      648. "tags": [
      649. "user"
      650. ],
      651. "summary": "Get user by user name",
      652. "description": "",
      653. "operationId": "getUserByName",
      654. "produces": [
      655. "application/json",
      656. "application/xml"
      657. ],
      658. "parameters": [
      659. {
      660. "name": "username",
      661. "in": "path",
      662. "description": "The name that needs to be fetched. Use user1 for testing. ",
      663. "required": true,
      664. "type": "string"
      665. }
      666. ],
      667. "responses": {
      668. "200": {
      669. "description": "successful operation",
      670. "schema": {
      671. "$ref": "#/definitions/User"
      672. }
      673. },
      674. "400": {
      675. "description": "Invalid username supplied"
      676. },
      677. "404": {
      678. "description": "User not found"
      679. }
      680. }
      681. },
      682. "put": {
      683. "tags": [
      684. "user"
      685. ],
      686. "summary": "Updated user",
      687. "description": "This can only be done by the logged in user.",
      688. "operationId": "updateUser",
      689. "consumes": [
      690. "application/json"
      691. ],
      692. "produces": [
      693. "application/json",
      694. "application/xml"
      695. ],
      696. "parameters": [
      697. {
      698. "name": "username",
      699. "in": "path",
      700. "description": "name that need to be updated",
      701. "required": true,
      702. "type": "string"
      703. },
      704. {
      705. "in": "body",
      706. "name": "body",
      707. "description": "Updated user object",
      708. "required": true,
      709. "schema": {
      710. "$ref": "#/definitions/User"
      711. }
      712. }
      713. ],
      714. "responses": {
      715. "400": {
      716. "description": "Invalid user supplied"
      717. },
      718. "404": {
      719. "description": "User not found"
      720. }
      721. }
      722. },
      723. "delete": {
      724. "tags": [
      725. "user"
      726. ],
      727. "summary": "Delete user",
      728. "description": "This can only be done by the logged in user.",
      729. "operationId": "deleteUser",
      730. "produces": [
      731. "application/json",
      732. "application/xml"
      733. ],
      734. "parameters": [
      735. {
      736. "name": "username",
      737. "in": "path",
      738. "description": "The name that needs to be deleted",
      739. "required": true,
      740. "type": "string"
      741. }
      742. ],
      743. "responses": {
      744. "400": {
      745. "description": "Invalid username supplied"
      746. },
      747. "404": {
      748. "description": "User not found"
      749. }
      750. }
      751. }
      752. },
      753. "/user/login": {
      754. "get": {
      755. "tags": [
      756. "user"
      757. ],
      758. "summary": "Logs user into the system",
      759. "description": "",
      760. "operationId": "loginUser",
      761. "produces": [
      762. "application/json",
      763. "application/xml"
      764. ],
      765. "parameters": [
      766. {
      767. "name": "username",
      768. "in": "query",
      769. "description": "The user name for login",
      770. "required": true,
      771. "type": "string"
      772. },
      773. {
      774. "name": "password",
      775. "in": "query",
      776. "description": "The password for login in clear text",
      777. "required": true,
      778. "type": "string"
      779. }
      780. ],
      781. "responses": {
      782. "200": {
      783. "description": "successful operation",
      784. "headers": {
      785. "X-Expires-After": {
      786. "type": "string",
      787. "format": "date-time",
      788. "description": "date in UTC when token expires"
      789. },
      790. "X-Rate-Limit": {
      791. "type": "integer",
      792. "format": "int32",
      793. "description": "calls per hour allowed by the user"
      794. }
      795. },
      796. "schema": {
      797. "type": "string"
      798. }
      799. },
      800. "400": {
      801. "description": "Invalid username/password supplied"
      802. }
      803. }
      804. }
      805. },
      806. "/user/logout": {
      807. "get": {
      808. "tags": [
      809. "user"
      810. ],
      811. "summary": "Logs out current logged in user session",
      812. "description": "",
      813. "operationId": "logoutUser",
      814. "produces": [
      815. "application/json",
      816. "application/xml"
      817. ],
      818. "parameters": [ ],
      819. "responses": {
      820. "default": {
      821. "description": "successful operation"
      822. }
      823. }
      824. }
      825. },
      826. "/user": {
      827. "post": {
      828. "tags": [
      829. "user"
      830. ],
      831. "summary": "Create user",
      832. "description": "This can only be done by the logged in user.",
      833. "operationId": "createUser",
      834. "consumes": [
      835. "application/json"
      836. ],
      837. "produces": [
      838. "application/json",
      839. "application/xml"
      840. ],
      841. "parameters": [
      842. {
      843. "in": "body",
      844. "name": "body",
      845. "description": "Created user object",
      846. "required": true,
      847. "schema": {
      848. "$ref": "#/definitions/User"
      849. }
      850. }
      851. ],
      852. "responses": {
      853. "default": {
      854. "description": "successful operation"
      855. }
      856. }
      857. }
      858. }
      859. },
      860. "securityDefinitions": {
      861. "api_key": {
      862. "type": "apiKey",
      863. "name": "api_key",
      864. "in": "header"
      865. },
      866. "petstore_auth": {
      867. "type": "oauth2",
      868. "authorizationUrl": "https://petstore.swagger.io/oauth/authorize",
      869. "flow": "implicit",
      870. "scopes": {
      871. "read:pets": "read your pets",
      872. "write:pets": "modify pets in your account"
      873. }
      874. }
      875. },
      876. "definitions": {
      877. "ApiResponse": {
      878. "type": "object",
      879. "properties": {
      880. "code": {
      881. "type": "integer",
      882. "format": "int32"
      883. },
      884. "type": {
      885. "type": "string"
      886. },
      887. "message": {
      888. "type": "string"
      889. }
      890. }
      891. },
      892. "Category": {
      893. "type": "object",
      894. "properties": {
      895. "id": {
      896. "type": "integer",
      897. "format": "int64"
      898. },
      899. "name": {
      900. "type": "string"
      901. }
      902. },
      903. "xml": {
      904. "name": "Category"
      905. }
      906. },
      907. "Pet": {
      908. "type": "object",
      909. "required": [
      910. "name",
      911. "photoUrls"
      912. ],
      913. "properties": {
      914. "id": {
      915. "type": "integer",
      916. "format": "int64"
      917. },
      918. "category": {
      919. "$ref": "#/definitions/Category"
      920. },
      921. "name": {
      922. "type": "string",
      923. "example": "doggie"
      924. },
      925. "photoUrls": {
      926. "type": "array",
      927. "xml": {
      928. "wrapped": true
      929. },
      930. "items": {
      931. "type": "string",
      932. "xml": {
      933. "name": "photoUrl"
      934. }
      935. }
      936. },
      937. "tags": {
      938. "type": "array",
      939. "xml": {
      940. "wrapped": true
      941. },
      942. "items": {
      943. "xml": {
      944. "name": "tag"
      945. },
      946. "$ref": "#/definitions/Tag"
      947. }
      948. },
      949. "status": {
      950. "type": "string",
      951. "description": "pet status in the store",
      952. "enum": [
      953. "available",
      954. "pending",
      955. "sold"
      956. ]
      957. }
      958. },
      959. "xml": {
      960. "name": "Pet"
      961. }
      962. },
      963. "Tag": {
      964. "type": "object",
      965. "properties": {
      966. "id": {
      967. "type": "integer",
      968. "format": "int64"
      969. },
      970. "name": {
      971. "type": "string"
      972. }
      973. },
      974. "xml": {
      975. "name": "Tag"
      976. }
      977. },
      978. "Order": {
      979. "type": "object",
      980. "properties": {
      981. "id": {
      982. "type": "integer",
      983. "format": "int64"
      984. },
      985. "petId": {
      986. "type": "integer",
      987. "format": "int64"
      988. },
      989. "quantity": {
      990. "type": "integer",
      991. "format": "int32"
      992. },
      993. "shipDate": {
      994. "type": "string",
      995. "format": "date-time"
      996. },
      997. "status": {
      998. "type": "string",
      999. "description": "Order Status",
      1000. "enum": [
      1001. "placed",
      1002. "approved",
      1003. "delivered"
      1004. ]
      1005. },
      1006. "complete": {
      1007. "type": "boolean"
      1008. }
      1009. },
      1010. "xml": {
      1011. "name": "Order"
      1012. }
      1013. },
      1014. "User": {
      1015. "type": "object",
      1016. "properties": {
      1017. "id": {
      1018. "type": "integer",
      1019. "format": "int64"
      1020. },
      1021. "username": {
      1022. "type": "string"
      1023. },
      1024. "firstName": {
      1025. "type": "string"
      1026. },
      1027. "lastName": {
      1028. "type": "string"
      1029. },
      1030. "email": {
      1031. "type": "string"
      1032. },
      1033. "password": {
      1034. "type": "string"
      1035. },
      1036. "phone": {
      1037. "type": "string"
      1038. },
      1039. "userStatus": {
      1040. "type": "integer",
      1041. "format": "int32",
      1042. "description": "User Status"
      1043. }
      1044. },
      1045. "xml": {
      1046. "name": "User"
      1047. }
      1048. }
      1049. },
      1050. "externalDocs": {
      1051. "description": "Find out more about Swagger",
      1052. "url": "http://swagger.io"
      1053. }
      1054. }