Configuring an API schema

An API schema defines the configuration for how to schema-validate messages.

About this task

When you configure an API schema object, you specify the schemas to use to validate JSON, GraphQL, XML, WSDL, and SOAP messages.

When you define the schema for these messages, you have the following choices to specify validation for each message type.
  • The URL to schema location that is used to validate the message. Only the following protocol identifiers are supported.
    • http://
    • local:///
    • store:///
  • The accept keyword to accept all messages.
  • The reject keyword to reject all messages.
When the XML type is XML or WSDL, there are additional properties available. The default XML type is XML.
Set to XML.
The mode to validate XML messages.
SOAP Body
Validate only the soap:Body element of a SOAP message against the XML schema.
XSD
Validate the entire message against the XML schema. This setting is the default value.
Set to WSDL.
The QName of the WSDL port that defines the service traffic to validate. The value is a QName of the form "{namespace-uri}local-part" or "*" for all ports that are defined in the WSDL file. If specified and not "*", only messages that are defined for the named port are considered valid.
The name of the WSDL operation that defines the service traffic to validate. The value is the unqualified name of the WSDL operation or "*" for all operations that are defined in the WSDL file. If specified and not "*", only messages that are defined for WSDL operations that match the specified name are considered valid.
The name or direction of the WSDL input, output, or fault that defines the service traffic to validate.
When specified and not "*"
Only messages that are defined for inputs, outputs, and faults that match the specified name or direction are considered valid. Faults are considered valid for the response direction.
When "*"
The root MIME part is validated. The root MIME part is the part that is bound to a soap:Body.
  • The name of one or more WSDL input, output, or fault components.
    • Enter "operationRequest" for a specific request.
    • Enter "operationResponse" for a specific response.
    • Enter the value of the name attribute for the <fault> element.
  • Enter "#input" for all requests in the WSDL file.
  • Enter "#output" for all responses in the WSDL file.
  • Enter "*" for all inputs, outputs, and faults in the WSDL file.
The name of the WSDL message part that defines the content of a MIME attachment. The value is the unqualified name of the message part. This name is the same as the part attribute on the corresponding mime:content component in the WSDL file.

Schemas are compiled before they are used for validation. Because the compilation process is longer than the validation process, the compiled schema artifacts are stored in a cache. The limited capacity of the cache can cause older entries to be evicted from the cache when newer entries are added. Schemas whose artifacts have been evicted from the cache must be recompiled, which can cause significant delays in validation. You can specify the capacity of the stylesheet cache in the API Gateway. For more information, see Configuring an API gateway.

Procedure

  1. In the search field, enter api.
  2. From the search results, click API schema.
  3. Click Add.
  4. Define the basic properties - Name, administrative state, and comments.
  5. Optional: Specify one of the validation options for JSON messages.
  6. Optional: Specify one of the validation options for GraphQL messages.
  7. Optional: Specify the XML message type.
  8. Optional: If the XML message type is XML, specify the following settings.
    1. Specify an XML validation mode.
    2. Enter an XML validation option.
  9. If the XML message type is WSDL, specify the following settings.
    1. Enter a validation option for WSDL messages.
    2. Enter the QName of the WSDL port that defines the service traffic to validate.
    3. Enter the name of the WSDL operation that defines the service traffic to validate.
    4. Enter the name or direction of the WSDL input, output, or fault that defines the service traffic to validate.
    5. Enter the name of the WSDL message part that defines the content of a MIME attachment.
  10. Click Apply to save changes to the running configuration.
  11. Click Save to save changes to the persisted configuration.