Topic
  • 3 replies
  • Latest Post - ‏2013-01-02T01:31:11Z by kenhygh
SystemAdmin
SystemAdmin
6772 Posts

Pinned topic our own JSON schemas with DataPower?

‏2010-10-07T15:24:30Z |
So we've got our own JSON schama. I take it we need to have it converted to JSONx so that we can name it as, let's say, ourJSONschema.xsd ?

Do we do that conversion by hand or should we try and run the JSON schema (now named with a .txt extension) in a request message, coming into an application on DataPower that has the request type as JSON? Will that convert it to JSONx on its own, thus allowing us to then have minor changes on the file, having it as a schema xml format?

Thanks -
Updated on 2013-01-02T01:31:11Z at 2013-01-02T01:31:11Z by kenhygh
  • SystemAdmin
    SystemAdmin
    6772 Posts

    Re: our own JSON schemas with DataPower?

    ‏2010-10-14T16:13:44Z  
    So, after some digging, it is possible to use the JSONx format for one's own schema validation, but NOT the original JSON format. Just run the JSON through the device as normal, using the Query Params Action in one's rule set to JSON, then use the Validate Action to reference one's own JSONx form of schema. You will have to rewrite the original JSON schema to the JSONx form of course, but once it is rewritten to JSONx form, you can reference it with any filename, etc. like "myownschema.xsd", using the ".xsd" extension as usual. Then you can validate your JSON messages with your own JSONx schemas, since the message will be converted to JSONx prior to that point in the processing policy.
  • SystemAdmin
    SystemAdmin
    6772 Posts

    Re: our own JSON schemas with DataPower?

    ‏2013-01-02T00:14:20Z  
    So, after some digging, it is possible to use the JSONx format for one's own schema validation, but NOT the original JSON format. Just run the JSON through the device as normal, using the Query Params Action in one's rule set to JSON, then use the Validate Action to reference one's own JSONx form of schema. You will have to rewrite the original JSON schema to the JSONx form of course, but once it is rewritten to JSONx form, you can reference it with any filename, etc. like "myownschema.xsd", using the ".xsd" extension as usual. Then you can validate your JSON messages with your own JSONx schemas, since the message will be converted to JSONx prior to that point in the processing policy.
    We are trying to achieve something like this but XSD mandates the ordering of elements but JSON standard says nothing about ordering. We don't want consumers to follow any rules for ordering of elements because that is really against JSON usage. So we need a way out so that we can validate JSONx without checking the ordering of elements.

    We have 2 options
    1. Create XSD that doesn't mandates ordering but its a hard job. Most of the tools like XML Spy and Rational doesn't create such XSDs automatically. It need manual efforts.
    2. We don't do validation at all in DataPower but that will put pressure on server systems.

    Any suggestion/help?

    RG
  • kenhygh
    kenhygh
    1577 Posts

    Re: our own JSON schemas with DataPower?

    ‏2013-01-02T01:31:11Z  
    We are trying to achieve something like this but XSD mandates the ordering of elements but JSON standard says nothing about ordering. We don't want consumers to follow any rules for ordering of elements because that is really against JSON usage. So we need a way out so that we can validate JSONx without checking the ordering of elements.

    We have 2 options
    1. Create XSD that doesn't mandates ordering but its a hard job. Most of the tools like XML Spy and Rational doesn't create such XSDs automatically. It need manual efforts.
    2. We don't do validation at all in DataPower but that will put pressure on server systems.

    Any suggestion/help?

    RG
    1.

    Sorry :-)
    Ken