laminas-api-tools / api-tools

Laminas API Tools module for Laminas
https://api-tools.getlaminas.org/documentation
BSD 3-Clause "New" or "Revised" License
37 stars 19 forks source link

Unable to add IsInstanceOfValidator in Admin UI #77

Closed jasonterando closed 4 years ago

jasonterando commented 4 years ago

Bug Report

api-tools v 1.4.1 laminas-validator 2.13.4

Summary

When adding an IsInstanceOfValidator using admin UI, I receive an error that "className" is a required field. However, only "classname" (all lower case) is available in the UI.

Current behavior

UI displays "Error During the API Communication" when attempting to save the added validator. Exacerbating the problem, the actual error of 'Service with name "Laminas\Validator\IsInstanceOf" could not be created. Reason: Missing option "className"' is only viewable in the response payload.

How to reproduce

  1. Add a field to an API service
  2. Add a validator of type IsInstanceOf
  3. Put in any value for "classname" and Save

Expected behavior

API management UI should specify "className" instead of "classname"

also

Specific validation (and other) messages should be displayed to the user when available instead of generate "API Communication" or "Error saving field" kind of notifications.

More Info

screenshot-1

To confirm this is the issue, in the browser's network tab, I updated the payload of:

[{"required":true,"validators":[{"name":"Laminas\\Validator\\IsInstanceOf","options":{"classname":"ShippingRequest}}],"filters":[],"field_type":"ShippingRequest","name":"request","description":"Shipping request information"}]

to...

[{"required":true,"validators":[{"name":"Laminas\\Validator\\IsInstanceOf","options":{"className":"ShippingRequest"}}],"filters":[],"field_type":"ShippingRequest","name":"request","description":"Shipping request information"}]

with the only change being the case of "className" vs. "classname" -- and the call succeeded.

I'm attaching a screenshot and HARs of the failed and succeeded calls. bug-info.zip

jasonterando commented 4 years ago

Looks like this can't be used to validate payload, so probably doesn't matter if the AdminUI for this works or not...