APIcast icon indicating copy to clipboard operation
APIcast copied to clipboard

Validate that policy config schemas are compatible with react-jsonschema-form

Open davidor opened this issue 6 years ago • 2 comments

The 3scale UI uses react-jsonschema-form to build forms from the policy config schemas.

We need to add some kind of validation to make sure that apicast policy config schemas can be correctly rendered by that library. We have some limitations. For example, using an array of objects with oneOf does not work correctly: https://github.com/mozilla-services/react-jsonschema-form#q-does-rjsf-support-oneof-anyof-multiple-types-in-an-array-etc

In particular, the JSON schema of the rate limit policy is affected by this problem. The limiters and the error_settings properties in the schema are arrays that are not compatible with the react-jsonschema-form library.

There's a web tool to verify that a JSON schema can be rendered by the library: https://mozilla-services.github.io/react-jsonschema-form/

\cc @y-tabata

davidor avatar May 10 '18 15:05 davidor

I started a WIP branch to modify the rate limit schema and make it compatible with the react-jsonschema-form library: https://github.com/3scale/apicast/tree/adapt-rate-limit-policy-schema-to-react-jsonschema

I still need to modify the code and the tests to adapt them to the new schema.

Ref: https://github.com/3scale/apicast/pull/696

davidor avatar May 10 '18 16:05 davidor

The schema of the rate-limit policy was modified in https://github.com/3scale/apicast/pull/696

The issue of introducing an automated way of validating the schemas to make sure they're compatible with react-jsonschema-form remains open.

davidor avatar May 22 '18 09:05 davidor