question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dot-notation not working

See original GitHub issue

Based on https://github.com/rsinger86/drf-flex-fields#dynamically-setting-fields,

Here are my serializers:

class AddressBookSerializer(FlexFieldsModelSerializer):
    class Meta:
        model = SellerAddressBook
        fields = ('id', 'address', 'city', 'state', )
class OrderSerializer(FlexFieldsModelSerializer):
    address = AddressBookSerializer(many=False)

    class Meta:
        model = Order
        fields = ('id', 'order_name', 'address',)

On Get, /orders/123/?fields=id,order_name,address.city

ACTUAL RESULT

{
  "id" : 123
  "order_name" : "Order Name",
  "address" : {
    "id" : "1",
    "address": "my add",
    "city": "my_city",
    "state": " my state"
}

EXPECTED RESULT

{
  "id" : 13322
  "order_name" : "Order Name",
  "address" : {
      "city": "my_city"
 }

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:3
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
cdrxcommented, Jul 19, 2018

@rsinger86 this is something I need. I will gladly work up a PR, but could you please give me some guidance on the best way to implement it?

1reaction
russian-developercommented, Nov 8, 2022

Everybody wants it but nobody what to do anything 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Testing Objects for Properties dot notation not working
Tell us what's happening: This code works, but I don't know why dot notation doesn't work in this instance. Can anyone explain?
Read more >
JavaScript property access: dot notation vs. brackets?
Dot notation does not work with some keywords (like new and class ) in internet explorer 8. I had this code: //app.users is...
Read more >
JavaScript Dot Notation vs. Bracket Notation: Which to Use ...
Dot notation is faster to write and easier to read than bracket notation. However, you can use variables with bracket notation, but not...
Read more >
JS dot-notation vs. bracket notation | by code_thoughts - Medium
Dot notation only lets you access the explicit key name of a property. You can't use dot notation with variables (or numbers either)....
Read more >
Dot notation not working on this simple list of text
Hi Appian community,. Please could I get your help on a data issue with an integration I have made? For simplicity's sake, this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found