Skip to content

API Hard Patch

Fabian Muff edited this page Jan 8, 2025 · 1 revision

Introduction

The Meta2-Model's PATCH routes serve to update the properties of an object as defined in the payload. Beyond updating the main object, PATCH can also modify associated sub-objects. Specifically, different meta-objects have varied sub-objects which can be modified:

  • Scene:
    • Attributes
    • Ports
    • Classes
    • Relationclasses
  • Class:
    • Attributes
    • Ports
  • Relationclass:
    • Attributes
    • Ports
  • Ports:
    • Attributes
    • Ports

New Feature: hardpatch URL Parameter for PATCH routes

We're thrilled to introduce a substantial upgrade to our API. Now, while using the PATCH route for metaobjects, users have the option to employ the hardpatch URL parameter.

Distinct Functionalities:

  • Normal PATCH: Facilitates the creation and modification of sub-objects.
  • Hardpatch (with hardpatch=true): Offers an expanded capability allowing users to create, modify, and delete sub-objects based on the provided data.

With the hardpatch feature enabled, any sub-objects absent in the payload will be unlinked from the main or parent object. This enhancement bestows greater precision and control upon users when managing meta and instance objects in their metamodels.

Example:

PATCH https://localhost:8000//metamodel/sceneTypes/fd25ddf6-3f6b-4ec1-9095-34509820a40d?hardpatch=true

payload:

{
          uuid: sceneTypeUuidPatch,
          name: "test patch scene",
          description: "This is the test scene to patch",
          classes: [
            {
              uuid: classUuidAdded,
              name: "class added",
              description: "class added",
            },
            {
              uuid: classUuidModified,
              name: "class modified",
              description: "class modified",
            },
          ],
          relationclasses: [
            {
              uuid: relationClassUuidAdded,
              name: "relation class added",
              description: "relation class added",
              role_from: {
                uuid: roleFromUuid,
              },
              role_to: {
                uuid: roleToUuid,
              },
            },
            {
              uuid: relationClassUuidModified,
              name: "relation class modified",
              description: "relation class modified",
              role_from: {
                uuid: roleFromUuid,
              },
              role_to: {
                uuid: roleToUuid,
              },
            },
          ],
          attributes: [
            {
              uuid: attributeUuidAdded,
              name: "Attribute added",
              description: "Attribute added",
              attribute_type: {
                uuid: attributeTypeUuid,
                name: "String",
                pre_defined: true,
                regex_value:
                  "^([\\x09\\x0A\\x0D\\x20-\\x7E]|[\\xC2-\\xDF][\\x80-\\xBF]|\\xE0[\\xA0-\\xBF][\\x80-\\xBF]|[\\xE1-\\xEC\\xEE\\xEF][\\x80-\\xBF]{2}|\\xED[\\x80-\\x9F][\\x80-\\xBF]|\\xF0[\\x90-\\xBF][\\x80-\\xBF]{2}|[\\xF1-\\xF3][\\x80-\\xBF]{3}|\\xF4[\\x80-\\x8F][\\x80-\\xBF]{2})*$",
              },
            },
            {
              uuid: attributeUuidModified,
              name: "Attribute modified",
              description: "Attribute modified",
              attribute_type: {
                uuid: attributeTypeUuid,
              },
            },
          ],
          ports: [
            {
              uuid: portUuidAdded,
              name: "port added",
              uuid_class: classUuid,
            },
            {
              uuid: portUuidModified,
              name: "port modified",
              uuid_class: classUuid,
            },
          ],
        }

Wrapping Up

This strategic addition to our API, specifically the hardpatch feature, is a testament to our ongoing commitment to providing users with tools that empower them to navigate and shape the evolving digital realm of metamodeling.

Clone this wiki locally