GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Entity.createFromDiscriminatorValue incorrectly deserializes #microsoft.graph.user as com.microsoft.graph.beta.models.security.User · Issue #1264 · microsoftgraph/msgraph-beta-sdk-java

Entity.createFromDiscriminatorValue incorrectly deserializes #microsoft.graph.user as com.microsoft.graph.beta.models.security.User #1264

New issue
Copy link
New issue
Copy link
Open
Open
Entity.createFromDiscriminatorValue incorrectly deserializes #microsoft.graph.user as com.microsoft.graph.beta.models.security.User#1264
Copy link
Labels
type:bugA broken experienceA broken experience

Description

@clementdenis
Clément Denis (clementdenis)
opened on Nov 27, 2025
Issue body actions

Describe the bug

In current beta version, when trying to deserialize a #microsoft.graph.user from JSON using KiotaJsonSerialization.deserialize(json, Entity::createFromDiscriminatorValue), it's returned as a com.microsoft.graph.beta.models.security.User instance.

This is because only one of com.microsoft.graph.beta.models.User and com.microsoft.graph.beta.models.security.User is imported the latter), and classes are referenced without fully qualified name.

See

msgraph-beta-sdk-java/src/main/java/com/microsoft/graph/beta/generated/models/Entity.java

Line 2075 in 3612a3a

case "#microsoft.graph.security.user": return new User();
and

msgraph-beta-sdk-java/src/main/java/com/microsoft/graph/beta/generated/models/Entity.java

Line 2326 in 3612a3a

case "#microsoft.graph.user": return new User();

There are probably other cases like this one.

Expected behavior

KiotaJsonSerialization.deserialize(json, Entity::createFromDiscriminatorValue) should return a com.microsoft.graph.beta.models.User instance for #microsoft.graph.user objects.

How to reproduce

This test

//passes
assertEquals(com.microsoft.graph.beta.models.User.class, KiotaJsonSerialization.deserialize("""
        {
            "@odata.type": "#microsoft.graph.user"
        }
        """, DirectoryObject::createFromDiscriminatorValue).getClass());
//KO
assertEquals(com.microsoft.graph.beta.models.User.class, KiotaJsonSerialization.deserialize("""
        {
            "@odata.type": "#microsoft.graph.user"
        }
        """, Entity::createFromDiscriminatorValue).getClass());

will fail with

org.opentest4j.AssertionFailedError: 
Expected :class com.microsoft.graph.beta.models.User
Actual   :class com.microsoft.graph.beta.models.security.User

SDK Version

6.51.0

Latest version known to work for scenario above?

No response

Known Workarounds

Pass a more precise ParsableFactory, like DirectoryObject::createFromDiscriminatorValue, like in the reproduction test.

Debug output

Configuration

No response

Other information

I found an old bug in Kiota that might be related (it was marked as fixed though): microsoft/kiota#1801

Activity

  1. Clément Denis (clementdenis)
    added
    type:bugA broken experienceA broken experience
    on Nov 27, 2025
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

    type:bugA broken experienceA broken experience

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.