jhthorsen / mojolicious-plugin-openapi

OpenAPI / Swagger plugin for Mojolicious
54 stars 42 forks source link

You should check for definedness #164

Closed Skeeve closed 4 years ago

Skeeve commented 4 years ago

https://github.com/jhthorsen/mojolicious-plugin-openapi/blob/e310f388a80928c37cd670a64648dea4b15b9589/t/basic-custom-formats.t#L14

$oap->validator->formats->{need_to_be_x} = sub { (defined $_[0] && $_[0] eq 'x') ? undef : 'Not x.' };

Otherwise you'll get messages like this upon startup:

iplist_1   | Use of uninitialized value $_ in pattern match (m//) at /home/scripts/iplist/lib/IPList.pm line 57.

(I used a pattern match not an eq)

jhthorsen commented 4 years ago

IPList.pm is not part of this repo.

Skeeve commented 4 years ago

Sorry - That was just the errormessage from my repo when I followed the instructions.