[Openstack-docs] Validation of JSON files

Diane Fleming diane.fleming at RACKSPACE.COM
Mon Feb 24 16:29:36 UTC 2014


Sam, 

Here is how I code the inclusion of the HTTP header and the JSON file in a
WADL file:

<representation
                mediaType="application/json">
                <wadl:doc xmlns="http://docbook.org/ns/docbook"
                    xml:lang="EN"
                    title="List containers response: HTTP and JSON">
                    <xsdxt:code
                   
href="samples/account_containers_list_http_response_json.txt"
                        /><xsdxt:code
                   
href="samples/account_containers_list_response.json"
                    />
                </wadl:doc>
            </representation>


The contents of these included files are:

account_containers_list_http_response_json.txt -> HTTP header


account_containers_list_response.json -> JSON sample



Diane
----------------------------------------------
Diane Fleming
Software Developer II - US

diane.fleming at rackspace.com
Cell  512.323.6799
Office 512.874.1260
Skype drfleming0227
Google-plus diane.fleming at gmail.com






On 2/24/14 10:19 AM, "Sam Harwell" <sam.harwell at RACKSPACE.COM> wrote:

>Hi Andreas,
>
>In order to resolve the JSON syntax issues consistently, we will need a
>plan for the manner in which we include HTTP header information in the
>examples. Currently, several otherwise-valid JSON files in the
>documentation projects include one or more HTTP headers at the beginning
>of the .json file, which would cause this type of validation to fail.
>Ideally we would have a simple solution for creating two files for the
>example: one for the HTTP headers and a second for the actual JSON body.
>
>One of the patches I submitted a while back corrected the JSON files for
>one of the documentation projects. It was rejected over the concern that
>malformed JSON files in the documentation project could raise larger
>questions regarding the validity of the affected JSON content as a whole,
>and the fix should be performed instead as part of retesting the service
>to obtain a current accurate representation of the resource. I would
>provide a link to the code review request, but it has since fallen off
>the list of Recently closed items and I have no idea how to find it now.
>
>Thanks,
>Sam
>
>-----Original Message-----
>From: Andreas Jaeger [mailto:aj at suse.com]
>Sent: Sunday, February 23, 2014 7:25 AM
>To: openstack-docs at lists.openstack.org
>Subject: [Openstack-docs] Validation of JSON files
>
>After having some conversations with a few rackers, I implemented a
>simple JSON validation (see patch
>https://review.openstack.org/#/c/75680/). This just validates that the
>JSON file is well-formed but does not check any schema.
>
>I fixed a few cases myself:
>https://review.openstack.org/#/c/75682/
>https://review.openstack.org/#/c/75684/
>
>and also filed some bug reports:
>https://bugs.launchpad.net/openstack-api-site/+bug/1283713
>https://bugs.launchpad.net/openstack-api-site/+bug/1283712
>https://bugs.launchpad.net/openstack-api-site/+bug/1283711
>https://bugs.launchpad.net/openstack-api-site/+bug/1283714
>https://bugs.launchpad.net/openstack-manuals/+bug/1283715
>
>I've enabled the check for the non-voting niceness gate - so that it does
>not abort if it fails. Once all the issues are fixed, I'd like to move it
>to the voting syntax check.
>
>Please have a look whether this is doing the right thing and those files
>are indeed wrong and provide feedback.
>
>Btw. to manually valid a JSON file, just run:
>python -mjson.tool FILENAME
>
>Andreas
>--
> Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
>  SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
>   GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
>    GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126
>
>_______________________________________________
>Openstack-docs mailing list
>Openstack-docs at lists.openstack.org
>http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-docs
>
>_______________________________________________
>Openstack-docs mailing list
>Openstack-docs at lists.openstack.org
>http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-docs




More information about the Openstack-docs mailing list