How to set a schema for a JSON object by Rest DSL(camel-swagger-java)
Issue
Let's say we are trying to implement a rest service which receives a JSON object.
By using swagger(openAPI), we can define the parameter's schema.
...
parameters:
- in: "body"
name: "body"
description: "Pet object that needs to be added to the store"
required: true
schema:
$ref: "#/definitions/Pet"
...
definitions:
...
Pet:
type: "object"
required:
- "name"
- "photoUrls"
properties:
id:
type: "integer"
format: "int64"
category:
$ref: "#/definitions/Category"
name:
type: "string"
example: "doggie"
photoUrls:
type: "array"
xml:
name: "photoUrl"
wrapped: true
items:
type: "string"
tags:
type: "array"
xml:
name: "tag"
wrapped: true
items:
$ref: "#/definitions/Tag"
status:
type: "string"
description: "pet status in the store"
enum:
- "available"
- "pending"
- "sold"
...
By specifying the JSON Object's schema, user can get the schema info from Swagger UI.
https://petstore.swagger.io/#/pet/addPet
Now, does camel-swagger-java have any option to set the schema for the JSON object?
Environment
- Red Hat Fuse
- 6.3
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.