{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/trimble/json-schema/trimble-upsert-library-response-schema.json",
  "title": "The created or updated library descriptor",
  "description": "The library descriptor returned from the `CreateLibrary` or `UpsertLibrary` APIs. Might include the collection of deep definitions operations if were requested. If some definitions operations failed with errors or because of throttling they are returned in `defs.unprocessed` collection with error codes.",
  "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/UpsertLibraryResponse",
  "required": [
    "createdAt",
    "createdBy",
    "id",
    "modifiedAt",
    "modifiedBy",
    "v"
  ],
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "The identifier."
    },
    "createdAt": {
      "type": "string",
      "description": "The creation timestamp.",
      "format": "date-time"
    },
    "createdBy": {
      "type": "string",
      "description": "The identifier of the user created the library."
    },
    "modifiedAt": {
      "type": "string",
      "description": "The last update timestamp.",
      "format": "date-time"
    },
    "modifiedBy": {
      "type": "string",
      "description": "The identifier of the user updated the library last time."
    },
    "deleted": {
      "type": "boolean",
      "description": "The deletion flag."
    },
    "v": {
      "type": "integer",
      "description": "The version number."
    },
    "name": {
      "type": "string",
      "description": "The name."
    },
    "description": {
      "type": "string",
      "description": "The optional description."
    },
    "defs": {
      "type": "array",
      "description": "The collection of definitions have been inserted or updated as part of the request if any.",
      "items": {
        "$ref": "#/$defs/DefinitionResponse"
      }
    },
    "defs.unprocessed": {
      "type": "array",
      "description": "The collection of definitions requested to be inserted or updated but were not unprocessed by some reason. The typical reason in THROTTLING means the service usage capacity is exceeded and the request for these definitions should be retried. But there might be other errors, e.g. FORBIDDEN, those should not be retried without correcting the AC policy.",
      "items": {
        "$ref": "#/$defs/UnprocessedChangePSetDefRequest"
      }
    },
    "policy": {
      "type": "object",
      "properties": {},
      "description": "The access control policy document (see the Policy data model) attached to the library. Returned only if the user has the right to see the policy (pset:GetLibraryPolicy action)."
    },
    "_actions": {
      "type": "array",
      "description": "Metadata. The list of context actions caller is allowed to perform on the resource. Please see the explanation with a warning about the use of this information in the introduction section.",
      "items": {
        "type": "string",
        "description": "The action."
      }
    }
  },
  "$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."
    },
    "DefinitionResponse": {
      "title": "The pset definition.",
      "required": [
        "createdAt",
        "createdBy",
        "id",
        "libId",
        "modifiedAt",
        "modifiedBy",
        "schema",
        "v"
      ],
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "The definition identifier. This identifier is valid in the scope of the parent library only. Definition with the same identifier might exist in another library."
        },
        "libId": {
          "type": "string",
          "description": "The parent library identifier."
        },
        "createdAt": {
          "type": "string",
          "description": "The creation timestamp.",
          "format": "date-time"
        },
        "createdBy": {
          "type": "string",
          "description": "The identifier of the user created the pset definition."
        },
        "modifiedAt": {
          "type": "string",
          "description": "The last update timestamp.",
          "format": "date-time"
        },
        "modifiedBy": {
          "type": "string",
          "description": "The identifier of the user updated the pset definition last time."
        },
        "deleted": {
          "type": "boolean",
          "description": "The deletion flag."
        },
        "v": {
          "type": "integer",
          "description": "The version number."
        },
        "name": {
          "type": "string",
          "description": "The name."
        },
        "description": {
          "type": "string",
          "description": "The optional description."
        },
        "types": {
          "type": "array",
          "description": "The collection of object types the pset is applicable to. If empty the pset can be attached to any object type.",
          "items": {
            "type": "string",
            "description": "The type of object."
          }
        },
        "schema": {
          "$ref": "#/$defs/PSetSchemaResponse"
        },
        "i18n": {
          "type": "object",
          "properties": {},
          "description": "The translation table for pset name, description, property names and values."
        },
        "_actions": {
          "type": "array",
          "description": "Metadata. The list of context actions caller is allowed to perform on the resource. Please see explanation with warning about use of this information in the introduction section.",
          "items": {
            "type": "string",
            "description": "The action."
          }
        }
      }
    },
    "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."
    },
    "PSetSchemaResponse": {
      "title": "The pset schema.",
      "required": [
        "props",
        "v"
      ],
      "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."
        },
        "v": {
          "type": "integer",
          "description": "The version number of the schema."
        },
        "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."
    },
    "UnprocessedChangePSetDefRequest": {
      "title": "The unprocessed create definition request with error.",
      "required": [
        "code",
        "message"
      ],
      "type": "object",
      "properties": {
        "item": {
          "$ref": "#/$defs/ChangePSetDefRequest"
        },
        "code": {
          "type": "string",
          "description": "The error code."
        },
        "message": {
          "type": "string",
          "description": "The error message."
        }
      }
    }
  }
}