Skip to content

Managed object API description is dropped for a Nullable relationship attribute (type ["relationship", "null"]) #267

Open

Description

@vharseko

Describe the bug

ManagedObjectApiDescription.build reads the type of a relationship property as a single string. A relationship attribute marked as "Nullable" has the type array ["relationship", "null"]: SchemaUtils.setNullableProperties in the Admin UI saves it that way, and SchemaField accepts it as a nullable relationship. build then throws JsonValueException: /type: Expecting a java.lang.String, logs Failed to generate API Description for managed.json section: <name> and returns null. The whole managed object endpoint is then missing from the API description, with the same symptom as #266.

There are two such reads on master (d3d5567):

  • ManagedObjectApiDescription.java:120, for a singleton relationship: SchemaField.TYPE_RELATIONSHIP.equals(relationshipSchema.get(Constants.TYPE).asString());
  • ManagedObjectApiDescription.java:127, for the items of a relationship collection ("items": {"type": ["relationship", "null"]}): SchemaField.TYPE_RELATIONSHIP.equals(itemsType.asString()).

This is the OpenIDM part of #266. The commons part, where OpenApiTransformer failed on a type array such as ["string", "null"], is fixed in OpenIdentityPlatform/commons#382. The relationship case fails before the transformer runs, so that fix does not reach it.

The missing description also turns off relationship checks. ReverseRelationshipValidator.getReverseReferenceType asks the managed object for its API description. If there is none, it logs "Exception caught determining reverse reference type. This means duplicate assignment and cardinality checks cannot be performed" and returns NA. The singleton and duplicate-assignment checks are then skipped for every relationship whose reverse property belongs to that managed object.

To reproduce

  1. In conf/managed.json, change the type of the manager property of user from "relationship" to ["relationship", "null"].
  2. The log shows Failed to generate API Description for managed.json section: user, and managed/user is missing from the API Explorer (/openidm/?_api).

This was traced by reading the code on master and has not been run on an instance.

Expected behavior

  • A type array that lists "relationship" next to "null" is treated like "relationship". "relationship" is replaced with "object", "null" is kept, and isRelationship: true is added. The schema then reads ["object", "null"], which the transformer from commons#382 describes as object with x-nullable: true.
  • ReverseRelationshipValidator.ReverseReferenceType.parseReverseReferenceType also reads the type of the reverse property with asString() (:64, :66). It has to accept ["object", "null"] as well. Otherwise, a reverse property that is a Nullable singleton relationship still gives NA.

Activity

  1. added
    bugSomething isn't working
    javaPull requests that update Java code
    openapiOpenAPI / Swagger description of the REST API (API Explorer)
    on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingjavaPull requests that update Java codeopenapiOpenAPI / Swagger description of the REST API (API Explorer)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions