Ask a Question

Can I use $ref in examples?

piyushkurkure10
New Member

Can I use $ref in examples?

I want to use ref in example for a schema
My openapi code:

 

'200':
  description: The request is successful
  content:
     application/json:
         schema:
            $ref: '#/components/schemas/ResponseSchema'
         example:
            $ref: '#/components/examples/200Example'

 

but I get warning like: 
warning no-invalid-media-type-examples Example value must conform to the schema: must NOT have additional properties `$ref`. 
And the example properly matches the schema so no problem with that.

cancel
Showing results for 
Search instead for 
Did you mean: