Creating parse settings
Parse settings specify the constraints of the input document that a parse action accepts. A document is rejected when a defined value exceeds a specified limit.
About this task
Tip: The equivalent entry point in the CLI is the global parse-settings
command.
By default, the document type is detected and the parsing is based on the detected document type. Instead of detecting the document type, you can define settings to parse the payload based on document type. The supported document types are binary, XML, JSON, and GraphQL.
Parse settings are used when you configure the following objects.
- An API collection
- A GatewayScript policy in an assembly
- A parse policy in an assembly
- A map policy in an assembly
- An XSLT policy in an assembly
- A parse action in a processing policy
Note: Only policies in the assembly support the GraphQL document type.
The checks that apply when you create a type-specific parse settings differ. The following list
states the checks that apply for each supported document type.
- Binary
- For a binary large object (BLOB) document, the following checks apply.
- Document size
- XML
- For an XML document, the following checks apply.
- Document size
- Nesting depth
- Width
- Name length
- Value length
- Unique names
- Unique prefixes
- Unique namespaces
- JSON
- For a JSON document, the following checks apply.
- Document size
- Nesting depth
- Width
- Name length
- Value length
- Number length
- Unique names
- Entire document in valid UTF-8 encoding
- GraphQL
- For a GraphQL document, the following checks apply.
- Document size
- Nesting depth
- Width
- Name length
- Value length
The parsing for GraphQL happens in one of the following ways.
- GraphQL in the body of a POST request
- The GraphQL is in the following format.
{ me { name } } - A JSON string in the body of a POST request that contains a GraphQL query
- Query variables in the request can be sent as a JSON string in a
variablesquery parameter. When the query contains several named operations, aoperationNamequery parameter is needed to determine which operation to run. The JSON object is in the following format.{ "query": "query MyData ($idVar: Int!) { user (id: $idVar) { name }}", "operationName": "MyData", "variables": {"idVar": 123} }When a GraphQL query is parsed, it is recognized as one of the following types.- Standard introspection
- A query that contains only introspection fields that are part of the GraphQL introspection
system, such as
__schemaand__type. - Custom introspection
- A query that contains introspection fields and one or more nonintrospection fields.
- No introspection
- A query that does not contain introspection fields.
- The URL query of a GET request
- The URL is in the following
format.
http://myapi/graphql?query={me{name}}
Procedure
Define common settings.
Define settings specific to XML messages.
Define settings specific to JSON messages.