-
Notifications
You must be signed in to change notification settings - Fork 44
Closed
Labels
Description
OpenAPI v3 features a new option to declare fields as nullable.
Reference: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#fixed-fields-20
This doesn't appear to work yet.
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
use utf8;
use Test::More;
use Test::Mojo;
use Mojolicious::Lite;
get '/test' => sub {
shift->render( openapi => { foo => undef }, status => 200 );
}, 'test';
plugin 'OpenAPI' => {
url => 'data:///api.yml',
schema => 'v3',
};
my $t = Test::Mojo->new();
$t->get_ok( '/test', { Accept => 'application/json' } )
->status_is(200)
->json_is( { foo => undef } );
done_testing;
__DATA__
@@ api.yml
openapi: 3.0.0
info:
title: Test
version: 0.0.0
paths:
/test:
get:
x-mojo-name: test
responses:
'200':
description: Test
content:
application/json:
schema:
properties:
foo:
type: string
nullable: true