{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/trimble/json-schema/trimble-upsert-library-request-schema.json",
  "title": "The library update or create request",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/trimble-connect-property-set-openapi.yml#/components/schemas/UpsertLibraryRequest",
  "type": "object",
  "properties": {
    "v": {
      "type": "integer",
      "description": "The optional last seen version number. If non-negative, the concurrency is checked, and the request is executed as an update only. If negative the request is executed with insert only semantic."
    },
    "policy": {
      "type": "object",
      "properties": {},
      "description": "The optional access control policy document (see the Policy data model) to be attached to the library. If this property is provided caller must have a pset:UpdateLibraryPolicy right."
    },
    "name": {
      "type": "string",
      "description": "The optional name."
    },
    "description": {
      "type": "string",
      "description": "The optional description."
    },
    "defs": {
      "type": "array",
      "description": "The optional collection of definitions to set as a new collection of definitions in the library in snapshot mode. This collection if given will replace all the current definitions in the library. If you want to leave some definition unchanged mention it with a single `id` property in this collection. All not mentioned existing definitions will be marked as deleted. If you want to make incremental changes to the current state use `defs.delta` property to describe the increment.",
      "items": {
        "$ref": "#/$defs/ChangePSetDefRequest"
      }
    },
    "defs.delta": {
      "type": "array",
      "description": "The optional collection of definitions to update in the library in incremental mode. This collection if given describes the changes to be applied to current definitions in the library. All not mentioned existing definitions will not be touched. If you want to make changes in snapshot mode, use the `defs` property instead to describe the new collection of definitions to set for the library.",
      "items": {
        "$ref": "#/$defs/ChangePSetDefRequest"
      }
    }
  },
  "$defs": {
    "ChangePSetDefRequest": {
      "title": "The operation to apply to pset definition in incremental (delta) mode.",
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "description": "The identifier of the definition. The identifier to assign to the new definition. If not the present server will generate a random identifier and execute the insert only semantic for this operation. If present it will refer to existing definition or give an instruction to create a definition with this client assigned identifier."
        },
        "v": {
          "type": "integer",
          "description": "The optional last seen version number. If non-negative, the concurrency is checked, and the request is executed as an update only. If negative the request is executed with insert only semantic."
        },
        "deleted": {
          "type": "boolean",
          "description": "The deletion flag. If present and `true` the operation is interpreted as an instruction to delete the definition."
        },
        "name": {
          "type": "string",
          "description": "The optional name."
        },
        "description": {
          "type": "string",
          "description": "The optional description."
        },
        "types": {
          "type": "array",
          "description": "The optional collection of object types the pset applies to. If empty the pset can be attached to any object type.",
          "items": {
            "type": "string",
            "description": "The type of object."
          }
        },
        "schema": {
          "$ref": "#/$defs/PSetSchemaRequest"
        },
        "i18n": {
          "type": "object",
          "properties": {},
          "description": "The optional translation table for pset name, description, property names and values."
        }
      },
      "description": "The operation to apply to pset definition in incremental (delta) mode. The operation could be inserted, update, upsert, or delete. If schema property is sent in the requested service will increment the schema version. The client should take care not to send this property when it does not want the schema version to be incremented."
    },
    "PSetSchemaRequest": {
      "title": "The pset schema.",
      "required": [
        "props"
      ],
      "type": "object",
      "properties": {
        "open": {
          "type": "boolean",
          "description": "Optional. The default is false. If true, the pset is open, meaning any number of unknown properties can be added."
        },
        "props": {
          "type": "object",
          "properties": {},
          "description": "The individual properties definitions (similar to Open API data model definition https://swagger.io/docs/specification/data-models/)."
        }
      },
      "description": "The pset schema that describes all possible properties in the pset. Please refer to the pset schema specification https://drive.google.com/open?id=1sDVdKpLesdnxzU6-KQuaGRWmMSO9DGrS."
    }
  }
}