Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Afterburner SuperSonicBeanDeserializer does not handle JSON Object valued Object Ids (like json) #54

Closed
headw01 opened this issue Jul 30, 2018 · 2 comments
Milestone

Comments

@headw01
Copy link

headw01 commented Jul 30, 2018

I am attempting to use something like https://github.com/jsog/jsog-jackson so that a .Net client (through a Jackson-using API endpoint) can process references (with "$id" as the @JsonIdentityInfo property value and "$ref" for the JSON Reference). When Afterburner is used, this doesn't work because the SuperSonicBeanDeserializer.deserializeFromObject doesn't check with the _objectIdReader to see if that should be used.

The databind BeanDeserializer has a check for the _objectIdReader (per databind#622 in comment)

public Object deserializeFromObject(JsonParser p, DeserializationContext ctxt) throws IOException
{
    /* 09-Dec-2014, tatu: As per [databind#622], we need to allow Object Id references
     *   to come in as JSON Objects as well; but for now assume they will
     *   be simple, single-property references, which means that we can
     *   recognize them without having to buffer anything.
     *   Once again, if we must, we can do more complex handling with buffering,
     *   but let's only do that if and when that becomes necessary.
     */
    if ((_objectIdReader != null) && _objectIdReader.maySerializeAsObject()) {
        if (p.hasTokenId(JsonTokenId.ID_FIELD_NAME)
                && _objectIdReader.isValidReferencePropertyName(p.getCurrentName(), p)) {
            return deserializeFromObjectId(p, ctxt);
        }

The SuperSonicBeanDeserializer overrides BeanDeserializer.deserializeFromObject and doesn't have a similar check.

@cowtowncoder
Copy link
Member

I believe that issue exists, but what is really needed is matching unit test to verify issue, fix.

@cowtowncoder cowtowncoder removed active need-test-case To work on issue, a reproduction (ideally unit test) needed labels Aug 31, 2018
@cowtowncoder cowtowncoder added this to the 2.9.7 milestone Aug 31, 2018
@cowtowncoder
Copy link
Member

Was able to repurpose test from jackson-databind to reproduce the issue, will fix as suggested.

@cowtowncoder cowtowncoder changed the title Afterburner SuperSonicBeanDeserializer does not handle Object Id references Afterburner SuperSonicBeanDeserializer does not handle JSON Object valued Object Ids (like json) Aug 31, 2018
cowtowncoder added a commit that referenced this issue Aug 31, 2018
stevenschlansker pushed a commit to stevenschlansker/jackson-modules-base that referenced this issue Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants