Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Validation JSON file types



Introduction


This function is designed to validate data according by processing the received data according to the designated rules and conventions in UDP. Regarding the JSON file types and objects, they are to be checked according the official JSON Schema Validation definitions, approved by the IETF Trust. Each JSON schema object is to be independently examined by the built-in engine for validity.

 

Interoperability Considerations


For the purpose of maintaining interoperability and according to the official JSON Schema regulations, several considerations are accounted for during validation. All of the listed conditions are implemented by following the official regulations. No exceptions or special cases are made, unless they are explicitly specified in the official UDP documentation.


A list of the prescribed considerations is the following:

  • Validation of String Instances – The null character (\u0000) is considered a valid JSON string.
  • Validation of Numeric Instances – The JSON schema will not add any bounds to numbers with arbitrary precision. Such instances can be arbitrarily large and/or can contain long decimal part.
  • Regular Expressions – Use of keywords that use regular expressions or constrain the value to such an expression should confront to the core JSON Schema specifications.
  • Meta-Schemes – The latest JSON Schema dialect meta-schema release specifications are supported.


It is important to note that at all times JSON schema data should be entered in accordance with the official specifications.


Validation keywords for all instance types


Validation for keywords for all instance types are governed by the following rules for each JSON file type object:


  • type – The entered value must be string or an array. If an array type is entered, its elements must be strings and should be unique. Values of the string type must be one of the listed primitive types: “null”, ‘boolean”, “array”, “number”, or “string”. Values that are integers are validated when they match any number with a zero fractional part.
  • enum – The entered value of this keyword must be an array with at least one element. All listed elements should be unique and can be of any type (including “null”). Successful validation is done when the entered value is matched to one of the array values belonging to the enum keyword.
  • const – The entered value of this keyword must be in an array with at least one element. If more than one element is present, they should all be uniquely named. All array element types can be used, including “null”. Successful validation is done when the entered value is matched to one of the

values belonging to the const keyword.


Validation keywords for Numeric Instance Types


This section lists the validation framework for the JSON numeric instance types:

  • multipleOf – The entered value must be a number greater than 0. Validation is performed when the division of the entered value results in an integer.
  • maximum – The entered value must be a number, representing an upper limit for the given numeric instance. Validation is performed when the instance is less or equal to the “maximum” value.
  • exclusiveMaximum -- The entered value must be a number, representing an upper limit for the given numeric instance. Validation is performed when the instance is less than the “exclusive maximum” value. It will not validate if it is equal to the value.
  • minimum – The entered value must be a number, representing an inclusive lower limit for the given numeric instance. Validation is performed if the instance is greater or equal to the “minimum” value.
  • exclusiveMinimum – The entered value must be a number, representing an exclusive lower limited for the given numeric instance. Validation is performed when the instance is greater than the “exclusive Minimum” value.


Validation keywords for String Instance Types


This section lists the validation framework for the JSON string instance types:

  • maxLength – The entered value must be a non-negative integer. Validation is performed when the string instance is equal to a length that is less than, or equal to the designated keyword value.
  • minLength – The entered value must be a non-negative integer. Validation is performed when the string instance is greater than, or equal to the designated keyword value. When this keyword is omitted, the UDP service will treat it as being a value with “0” length.
  • pattern – The entered value must be a valid string expression. Validation is performed if the expression matches the defined instance.

Validation keywords for Array Instance Types

This section lists the validation framework for the JSON array instance types:

  • maxItems – The entered value must be a non-negative integer. Validation is performed when the array size is less than, or equal to the value of the input keyword.
  • minItems – The entered value must be a non-negative integer. Validation is performed when the array size is greater than, or equal to the value of the input keyword. When this keyword is omitted, the UDP service will treat it as being a value with “0” length.
  • uniqueItems
  • maxCointains
  • minContains

Validation keywords for Object Instance Types

This section lists the validation framework for the JSON object instance types:

  • maxProperties
  • minProperties
  • required
  • dependentRequired

Validation keywords for Semantic content with “format”


Validation for string-encoded data contents


This section lists the validation requirements for the contents that comprise of string-encoded data. There are specific implementation rules that need to be followed to perform a successful validation.

  • contentEncoding
  • contentMediaType
  • contentSchema


Meta-Data Annotations Considerations


[Section summary]


  • “title” and “description”
  • “default”
  • “deprecated”
  • “readOnly” and “writeOnly”
  • “examples”


Security Considerations





For additional information see the following documents:

JSON Schema Core Specifications

JSON Schema Dialect Meta-Scheme Specifications


  • No labels