Skip to content

YAML Anchors / References #98

@marcoslopes

Description

@marcoslopes

Hi there, first of all thanks heaps for your awesome work with Jackson.

I am trying to get a concise configuration out of a yaml file, but I am pretty stuck at the moment.

I have followed many issues and still did not managed to get it working using only @JsonIdentityInfo
By the this tests it should be as simple as annotating Environment class with @JsonIdentityInfo(generator = ObjectIdGenerators.StringIdGenerator.class) but that also did not work.

After reading this issue i thought it could be the scope, so I have annotated the environment and bundle1 properties adding the main Configuration class as scope but that also yield not success.
Is this possible today, if it is how can it be achieved, and if not what do you recommend?

As the issue 266 suggests, I should write my own DeserializationContext, and figure out a way to find the references. But "you" --I believe it is you-- recommended this before.

Which of these two should I follow if there is no simple way to get it working with the current 2.9.6 version?

Trying to debug I did not see any calls to bindItem which means that SimpleObjectIdResolver._items are always null, even though I can see the references being set what would trigger that line to be called? Please keep in mind that I don't claim to know anything about jackson, that was what I could gather from trying to debug it.

name: "dropwizard-app"

environment: &environment 
    profile: "dev"
    provider: "aws"
    segment: "segment"
    security-context: "test"
    region: "us-east-1"

bundle-1: &bundle1
    environment: *environment
    path: "x/y/z"

bundle-2:
    # property-config-1: (optional)
    endpoint: "https://my-service-1"
    bundle-1-configuration: *bundle1

PS. Like the tests I have also tried the anchoring as a prefix, but it seems that the library have no issues finding both ways.

Thanks again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    yamlIssue related to YAML format backend

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions