fix(syntaxHighlighter): request and response examples for json cases (#7199)
* OAS 2 request and response examples for json cases * OAS 3 request and response examples for json cases * OAS2 and OAS3 tests * jsonParse utils for syntax highlighting
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
swagger: '2.0'
|
||||
info:
|
||||
description: sample OAS 2 definition to test syntax highlighting
|
||||
version: 1.0.0
|
||||
title: json syntax highlighting
|
||||
host: "localhost:3200"
|
||||
basePath: /v1
|
||||
schemes:
|
||||
- https
|
||||
- http
|
||||
paths:
|
||||
/setServices:
|
||||
post:
|
||||
summary: "simple service"
|
||||
produces:
|
||||
- application/json
|
||||
parameters:
|
||||
- in: body
|
||||
name: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/setServicesBody'
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/setServicesResponse'
|
||||
404:
|
||||
description: "Page not found"
|
||||
definitions:
|
||||
setServicesBody:
|
||||
type: object
|
||||
required:
|
||||
- appid
|
||||
- key
|
||||
- userid
|
||||
- station_objectid
|
||||
- details
|
||||
properties:
|
||||
appid:
|
||||
type: string
|
||||
example: "Website"
|
||||
description: "application ID"
|
||||
userid:
|
||||
type: integer
|
||||
example: "79daf5b4-aa4b-1452-eae5-42c231477ba7"
|
||||
description: "user id available to test"
|
||||
station_objectid:
|
||||
type: string
|
||||
example: "22a124b4-594b-4452-bdf5-fc3ef1477ba7"
|
||||
description: "station id available to test"
|
||||
details:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
station_serviceid:
|
||||
type: integer
|
||||
example: "34"
|
||||
description: "optional service id"
|
||||
name:
|
||||
type: string
|
||||
example: "hooray"
|
||||
amount:
|
||||
type: string
|
||||
example: "0.00"
|
||||
quantity:
|
||||
type: integer
|
||||
example: "999999"
|
||||
date:
|
||||
type: string
|
||||
format: date-time
|
||||
example: "2020-11-12 18:52:29"
|
||||
setServicesResponse:
|
||||
type: object
|
||||
properties:
|
||||
status:
|
||||
type: boolean
|
||||
example: true
|
||||
count:
|
||||
type: boolean
|
||||
example: 1
|
||||
response:
|
||||
type: object
|
||||
properties:
|
||||
status:
|
||||
type: integer
|
||||
example: 200
|
||||
station_serviceid:
|
||||
type: integer
|
||||
example: "3"
|
||||
userid:
|
||||
type: integer
|
||||
example: "5ff06f632bb165394501b05d3a833355"
|
||||
statusId:
|
||||
type: string
|
||||
example: "f0009babde9dbe204540d79cf754408e"
|
||||
@@ -0,0 +1,94 @@
|
||||
openapi: 3.0.1
|
||||
info:
|
||||
title: json syntax highlighting
|
||||
description: sample OAS 3 definition to test syntax highlighting
|
||||
version: 1.0.0
|
||||
servers:
|
||||
- url: https://localhost:3200/v1
|
||||
- url: http://localhost:3200/v1
|
||||
paths:
|
||||
/setServices:
|
||||
post:
|
||||
summary: simple service
|
||||
requestBody:
|
||||
content:
|
||||
'*/*':
|
||||
schema:
|
||||
$ref: '#/components/schemas/setServicesBody'
|
||||
required: true
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/setServicesResponse'
|
||||
404:
|
||||
description: Page not found
|
||||
content: {}
|
||||
x-codegen-request-body-name: body
|
||||
components:
|
||||
schemas:
|
||||
setServicesBody:
|
||||
required:
|
||||
- appid
|
||||
- details
|
||||
- station_objectid
|
||||
- userid
|
||||
type: object
|
||||
properties:
|
||||
appid:
|
||||
type: string
|
||||
description: application ID
|
||||
example: Website
|
||||
userid:
|
||||
type: integer
|
||||
description: user id available to test
|
||||
station_objectid:
|
||||
type: string
|
||||
description: station id available to test
|
||||
example: 22a124b4-594b-4452-bdf5-fc3ef1477ba7
|
||||
details:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
station_serviceid:
|
||||
type: integer
|
||||
description: optional service id
|
||||
example: 34
|
||||
name:
|
||||
type: string
|
||||
example: hooray
|
||||
amount:
|
||||
type: string
|
||||
example: "0.00"
|
||||
quantity:
|
||||
type: integer
|
||||
example: 999999
|
||||
date:
|
||||
type: string
|
||||
format: date-time
|
||||
setServicesResponse:
|
||||
type: object
|
||||
properties:
|
||||
status:
|
||||
type: boolean
|
||||
example: true
|
||||
count:
|
||||
type: boolean
|
||||
example: false
|
||||
response:
|
||||
type: object
|
||||
properties:
|
||||
status:
|
||||
type: integer
|
||||
example: 200
|
||||
station_serviceid:
|
||||
type: integer
|
||||
example: 3
|
||||
userid:
|
||||
type: integer
|
||||
statusId:
|
||||
type: string
|
||||
example: f0009babde9dbe204540d79cf754408e
|
||||
Reference in New Issue
Block a user