|
Post by hramasub on Sept 13, 2016 3:31:51 GMT
I am developing a Redfish server using python. My system runs a fastcgi compliant web server and hence I have the following building blocks: webserver : lighttpd (https://www.lighttpd.net/) wsgi adapter : flup (https://www.saddi.com/software/flup/) REST framework : bottle (http://bottlepy.org/docs/dev/index.html) Having received a PATCH request for a Redfish resource, I would like to *validate* the json body against the schema. I find the following projects as close fits for that purpose: *jsonschema* (Python module for json schema *validation*): pypi.python.org/pypi/jsonschemagithub.com/Julian/jsonschema*json-schema-objects* (Python class *binding* for json schema): github.com/cwacek/python-jsonschema-objectsWhile these tools are able to work with *simple* and *standalone* json schema files, I have not been able to parse Redfish schema. The following are some of the issues which I encountered while using those tools on Redfish schema: 1) Versioning of json schema (separate files for each version). 2) Naming syntax with special characters such as '#' and white spaces. 3) Linked / references to other schema via $ref. 4) Odata elements in schema. Given the requirement for python based Redfish *server*, what is the recommendation for validating the content body against the schema ?
|
|
|
Post by j2hilland on Sept 19, 2016 20:20:28 GMT
I personally don't use this set of tools and since nobody else has responded, I can tell you that there are engineers here at HPE that are validating payload. And I know that when we were developing the standard, we had an engineer validate payload against the JSON Schema. In fact, the GitHub repo we use for developing the spec validates our mockups against schema or else it won't let us do the Merge.
That being said, I remember issues with the generic python libraries especially around $ref. The Odata elements should validate because the schema reference copies of them in JSON Schema, so if you have $ref fixed, that shouldn't be an issue. If there are white spaces, those sound like bugs to me and we would like to know about them.
So what is the recommendation for validating the content? That it should be Schema conformant and any errors should be noted and returned in the error response to the request.
|
|
|
Post by hramasub on Sept 21, 2016 12:06:59 GMT
j2hilland: Thanks for taking time to comment. A few followup queries: 1) Do you use *python* based tools to validate the mockups against the schema before git merge ? 2) Would it be feasible to solicit comments from the engineering team ?
|
|
|
Post by j2hilland on Sept 22, 2016 18:53:17 GMT
We do some python validation but not as much as we probably should. We're really validating the CSDL more than anything. Which engineering team in #2? The HPE one? If so, I'll ask them to comment directly.
|
|