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

Ability to manually override field names #40

Closed
alexanderdean opened this issue Nov 30, 2011 · 1 comment
Closed

Ability to manually override field names #40

alexanderdean opened this issue Nov 30, 2011 · 1 comment

Comments

@alexanderdean
Copy link
Contributor

At the moment there is no way to unmarshal the following JSON using DictShield:

{
  "code" : "GBP",
  "self" : "http://localhost:8080/currencies/GBP" # Replacing with "link": works fine
}

... because the self key can't be defined as a field in a Document subclass. And similarly it's hard to work with the following:

{
    "customer" : "Bob",
    "email" : "bob@test.com",
    "link" : {
      "rel" : "self",
      "href" : "http://localhost:8080/customer/2",
      "type" : "text/xml"
    },
    "link" : {
      "rel" : "next",
      "href" : "http://localhost:8080/customer/3",
      "type" : "text/xml"
    },
    "link" : {
      "rel" : "prev",
      "href" : "http://localhost:8080/customer/1",
      "type" : "text/xml"
    },
}

... because there are three elements with the same name.

It would be nice to have some sort of Jackson @JsonProperty-style naming override, like this:

self_link = URLField(property_name="self", required=True)

self_atom = EmbeddedDocumentField(AtomLink, property_name="link")
next_atom = EmbeddedDocumentField(AtomLink, property_name="link")
prev_atom = EmbeddedDocumentField(AtomLink, property_name="link")
@j2labs
Copy link

j2labs commented Nov 26, 2012

Closing due to age. Can reopen if this is still requested.

@j2labs j2labs closed this as completed Nov 26, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants