Closed localh0rst closed 3 months ago
When using $ref in the response for i.e. a get request, the response is not validated. POC:
#!/usr/bin/env perl use v5.24; use warnings; use Mojolicious::Lite -signatures; get "/test" => sub ($c) { $c->openapi->valid_input or return; $c->render( status => 200, # Should be invalid because prop2 is missing? openapi => {prop1 => 200, different => 'WTF'} ); }, 'test'; plugin OpenAPI => {url => "data:///spec.yaml"}; app->start; __DATA__ @@ spec.yaml openapi: 3.0.0 info: title: Response validation test version: 1.0.0 paths: /test: get: x-mojo-name: test responses: 200: $ref: '#/components/responses/should_be_validated' components: schemas: test_schema: type: object required: [prop1, prop2] properties: prop1: type: integer prop2: type: string responses: should_be_validated: description: schema should be validated content: application/json: schema: $ref: '#/components/schemas/test_schema'
Maybe i am missicng something?
This sounds related to #251.
When using $ref in the response for i.e. a get request, the response is not validated. POC:
Maybe i am missicng something?