{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/chemaxon/json-schema/chemaxon-search-request-schema.json",
  "title": "SearchRequest",
  "x-generated": "2026-11-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/chemaxon-compound-registration-openapi.yml#/components/schemas/SearchRequest",
  "type": "object",
  "properties": {
    "queryStructure": {
      "type": "string",
      "description": "Chemical structure within the structure search criteria"
    },
    "resultFormat": {
      "type": "string",
      "description": "Structure file format in the response object"
    },
    "exportFormat": {
      "type": "string",
      "description": "Exported document format",
      "enum": [
        "JSON",
        "SDF",
        "CSV"
      ]
    },
    "options": {
      "$ref": "#/$defs/SearchOption",
      "description": "Structure-related search options"
    },
    "resultFields": {
      "type": "array",
      "description": "List of fields included in the results",
      "items": {
        "$ref": "#/$defs/FieldId"
      }
    },
    "conditions": {
      "type": "array",
      "description": "List of field-related criteria",
      "items": {
        "$ref": "#/$defs/SearchCondition"
      }
    },
    "pagination": {
      "$ref": "#/$defs/PaginationRequestParams",
      "description": "Pagination"
    },
    "ordering": {
      "$ref": "#/$defs/OrderingParams",
      "description": "Ordering parameters"
    },
    "structuralClass": {
      "type": "string",
      "description": "Structural class: COMPOUND or MONOMER, if not provided COMPOUND will be used",
      "enum": [
        "MONOMER",
        "COMPOUND"
      ]
    }
  },
  "required": [
    "conditions",
    "ordering",
    "pagination",
    "resultFields",
    "resultFormat"
  ],
  "$defs": {
    "FieldId": {
      "type": "object",
      "properties": {
        "fieldName": {
          "type": "string"
        },
        "additional": {
          "type": "boolean",
          "description": "True in case of additional data field, false otherwise"
        }
      },
      "required": [
        "additional",
        "fieldName"
      ]
    },
    "FieldMetadata": {
      "type": "object",
      "properties": {
        "fieldId": {
          "$ref": "#/$defs/FieldId"
        },
        "displayName": {
          "type": "string"
        },
        "required": {
          "type": "boolean"
        },
        "type": {
          "type": "string",
          "enum": [
            "INT",
            "DOUBLE",
            "FLOAT",
            "DECIMAL",
            "STRING",
            "DATETIME"
          ]
        },
        "idBased": {
          "type": "boolean"
        },
        "requiredForSearch": {
          "type": "boolean"
        },
        "sortable": {
          "type": "boolean"
        },
        "operators": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "=",
              "<>",
              "<",
              "<=",
              ">",
              ">=",
              "LIKE",
              "NOT LIKE",
              "IN",
              "AND",
              "BETWEEN",
              "=",
              "CONTAINS",
              "<",
              ">"
            ]
          }
        },
        "options": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Option"
          }
        },
        "list": {
          "type": "boolean"
        }
      }
    },
    "Option": {
      "type": "object",
      "properties": {
        "label": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      }
    },
    "OrderingParam": {
      "type": "object",
      "properties": {
        "field": {
          "$ref": "#/$defs/FieldId"
        },
        "direction": {
          "type": "string",
          "enum": [
            "ASC",
            "DESC"
          ]
        },
        "fieldFromMetadata": {
          "$ref": "#/$defs/FieldMetadata",
          "writeOnly": true
        }
      },
      "required": [
        "direction",
        "field"
      ]
    },
    "OrderingParams": {
      "type": "object",
      "properties": {
        "orderingParams": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/OrderingParam"
          }
        }
      }
    },
    "PaginationRequestParams": {
      "type": "object",
      "properties": {
        "offset": {
          "type": "integer",
          "format": "int32"
        },
        "limit": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "SearchCondition": {
      "type": "object",
      "properties": {
        "fieldId": {
          "$ref": "#/$defs/FieldId"
        },
        "operator": {
          "type": "string",
          "enum": [
            "Equals, NotEquals, LessThan, GreaterThan, Like, NotLike, In, And, Range, SimilarTo, Contains, Before, After"
          ]
        },
        "value": {
          "type": "string"
        }
      }
    },
    "SearchOption": {
      "type": "object",
      "properties": {
        "searchType": {
          "type": "string",
          "description": "Structure search type",
          "enum": [
            "FULL",
            "SUBSTRUCTURE",
            "DUPLICATE",
            "SIMILARITY"
          ]
        },
        "searchLevel": {
          "type": "string",
          "description": "Search level",
          "enum": [
            "PARENT",
            "VERSION",
            "LOT"
          ]
        },
        "tautomer": {
          "type": "string",
          "description": "Include tautomer matches",
          "enum": [
            "ON",
            "OFF",
            "DEFAULT"
          ]
        },
        "stereo": {
          "type": "string",
          "description": "Include stereo matches",
          "enum": [
            "ON",
            "OFF",
            "DEFAULT"
          ]
        },
        "markush": {
          "type": "string",
          "description": "Markush search enabled",
          "enum": [
            "ON",
            "OFF",
            "DEFAULT"
          ]
        },
        "dissimilarityMetric": {
          "type": "string",
          "description": "Dissimilarity metric used in case of similarity search",
          "enum": [
            "Tanimoto",
            "Tversky",
            "Euclidean",
            "Normalized_euclidean",
            "Dice",
            "Substructure",
            "Superstucture",
            "Markush_overlap"
          ]
        },
        "dissimilarityThreshold": {
          "type": "number",
          "format": "float",
          "description": "Dissimilarity treshold in case of similarity search"
        },
        "searchDeleted": {
          "type": "string",
          "description": "Search for deleted, or non-deleted records (by default)",
          "enum": [
            "YES",
            "NO"
          ]
        }
      },
      "required": [
        "markush",
        "searchLevel"
      ]
    }
  }
}