GithubHelp home page GithubHelp logo

unable to issue addEntity about egeria HOT 6 CLOSED

odpi avatar odpi commented on June 15, 2024
unable to issue addEntity

from egeria.

Comments (6)

mandy-chessell avatar mandy-chessell commented on June 15, 2024

What is the request body sent?

from egeria.

planetf1 avatar planetf1 commented on June 15, 2024

Adding the body below in my editor right now - it's pulled from swagger. It's clearly invalid, but being unclear as to what was required I was going to step through the validation checks with the debugger to understand how the code worked.

It also affects create relationship & create entity proxy. It's something to do with jackson/spring serialization/deserialization I think, and the way class mapping is done.

{
  "entityTypeGUID": "string",
  "initialClassifications": [
    {
      "createTime": "2018-09-17T14:48:22.537Z",
      "createdBy": "string",
      "status": "InstanceStatus{ordinal=0, name='<Unknown>', description='Unknown instance status.'}",
      "statusOnDelete": "InstanceStatus{ordinal=0, name='<Unknown>', description='Unknown instance status.'}",
      "type": {
        "typeDefCategory": "TypeDefCategory{typeCode=0, typeName='<Unknown>', typeDescription='Uninitialized TypeDef object.'}",
        "typeDefDescription": "string",
        "typeDefDescriptionGUID": "string",
        "typeDefGUID": "string",
        "typeDefName": "string",
        "typeDefSuperTypes": [
          {
            "guid": "string",
            "name": "string"
          }
        ],
        "typeDefVersion": 0,
        "validInstanceProperties": [
          "string"
        ],
        "validStatusList": [
          "InstanceStatus{ordinal=0, name='<Unknown>', description='Unknown instance status.'}"
        ]
      },
      "updateTime": "2018-09-17T14:48:22.537Z",
      "updatedBy": "string",
      "version": 0,
      "classificationName": "string",
      "systemAttributes": {
        "createTime": "2018-09-17T14:48:22.537Z",
        "createdBy": "string",
        "guid": "string",
        "status": "ACTIVE",
        "updateTime": "2018-09-17T14:48:22.537Z",
        "updatedBy": "string",
        "version": 0
      }
    }
  ],
  "initialProperties": {
    "effectiveFromTime": "2018-09-17T14:48:22.537Z",
    "effectiveToTime": "2018-09-17T14:48:22.537Z",
    "instanceProperties": {},
    "propertyCount": 0,
    "propertyNames": {}
  },
  "initialStatus": "InstanceStatus{ordinal=0, name='<Unknown>', description='Unknown instance status.'}"
}

from egeria.

mandy-chessell avatar mandy-chessell commented on June 15, 2024

You are right, this request body is incorrect - it does not have the class information for the request body in it. Our JSON should look like this ... this is a GET response for an entity ... notice it begins with the "class" tag - this is required to allow Jackson to process subclasses:

{
    "class": "EntityDetailResponse",
    "relatedHTTPCode": 200,
    "entity": {
        "class": "EntityDetail",
        "type": {
            "class": "InstanceType",
            "typeDefCategory": "ENTITY_DEF",
            "typeDefGUID": "578a3510-9ad3-45fe-8ada-e4e9572c37c8",
            "typeDefName": "GovernanceOfficer",
            "typeDefVersion": 1,
            "typeDefDescription": "Person responsible for a governance domain.",
            "typeDefSuperTypes": [
                {
                    "guid": "a32316b8-dc8c-48c5-b12b-71c1b2a080bf",
                    "name": "Referenceable"
                }
            ],
            "validInstanceProperties": [
                "qualifiedName",
                "additionalProperties",
                "title",
                "scope",
                "domain"
            ]
        },
        "createdBy": "julesk",
        "createTime": "2018-09-11T13:01:20.139+0000",
        "version": 1,
        "instanceProvenanceType": "LOCAL_COHORT",
        "metadataCollectionId": "87b06ffe-9db2-4ef5-ba6e-8127480cf30d",
        "guid": "fd7d41e7-70f5-42ec-86d3-88683e599494",
        "instanceURL": "http://localhost:8080/instances/entity/fd7d41e7-70f5-42ec-86d388683e599494",
        "properties": {
            "class": "InstanceProperties",
            "instanceProperties": {
                "title": {
                    "class": "PrimitivePropertyValue",
                    "instancePropertyCategory": "PRIMITIVE",
                    "primitiveDefCategory": "OM_PRIMITIVE_TYPE_STRING",
                    "primitiveValue": "Chief Data Officer (CDO)"
                },
                "qualifiedName": {
                    "class": "PrimitivePropertyValue",
                    "instancePropertyCategory": "PRIMITIVE",
                    "primitiveDefCategory": "OM_PRIMITIVE_TYPE_STRING",
                    "primitiveValue": "EXEC-CDO"
                },
                "domain": {
                    "class": "EnumPropertyValue",
                    "instancePropertyCategory": "ENUM",
                    "ordinal": 1,
                    "symbolicName": "Data",
                    "description": "The data (information) governance domain."
                }
            },
            "propertyNames": [
                "qualifiedName",
                "domain",
                "title"
            ],
            "propertyCount": 3
        },
        "status": "ACTIVE"
    }
}

All of our JSON uses this format. Also note that the OMRS REST API is not designed for general use - it is typically used only by the OMRS REST Repository Connector for managing metadata in remote repositories.

from egeria.

mandy-chessell avatar mandy-chessell commented on June 15, 2024

I think you have this working now?

from egeria.

planetf1 avatar planetf1 commented on June 15, 2024

Correct, I am able to successfully add an entity and relationship using a very simple body. I think the most useful way to mitigate against similar issues in future would be to fix up/correct the swagger docs, though that will only cover REST (which applies here) - not configuration or messaging. In part that's addressed by #213 though that is purely the 'class' aspect, and there's a lot more here to look at.

Happy for you to track that as you feel makes sense. No code changes needed on creating an entity

from egeria.

mandy-chessell avatar mandy-chessell commented on June 15, 2024

I agree we need to fix the swagger and #213 covers it. Trying to keep the OMRS REST API quite hidden as do not want it used outside of the OMRS - however if we publish somthing it should be right :)

from egeria.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.