Open vishal1 opened 6 years ago
Can you elaborate? Swagger should allow for some level of dynamic even if it's just having an open schema for the dynamic part(s).
Hello, thankyou for the response. Based on the below example I would like vehicleType inside vehicle definition to be of type either car or bike:
paths:
/vehicle:
post:
parameters:
- $ref: '#/parameters/vehicle'
responses:
200:
description: Success!
parameters:
vehicle:
name: vehicle
in: body
required: true
schema:
$ref: "#/definitions/vehicle"
definitions:
vehicle:
type: object
properties:
id:
type: string
name:
type: string
vehicleType:
type: object
anyOf:
- $ref: "#/definitions/car"
- $ref: "#/definitions/bike"
car:
type: object
properties:
model:
type: string
type:
type: string
enum:
- Saloon
- Estate
bike:
type: object
properties:
model:
type: string
type:
type: string
enum:
- Scooter
- Sport
Sorry for the indentation problem above. Not sure how to paste it indented.
Hi,
My nodejs app is using swagger-tools middleware with express which works fine with most of my service's contracts defined in the swagger spec.
I have a requirement where a request's body object's (json payload) some part is dynamic. So, I can't validate it using the spec. I am thinking of using express validation middleware for any custom validation. Is that a sensible approach or can I use swagger middleware for custom validation as well?
Thankyou