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

BUG - Missing fields on custom locations cause json errors #221

Open
mak001 opened this issue Jan 22, 2020 · 0 comments
Open

BUG - Missing fields on custom locations cause json errors #221

mak001 opened this issue Jan 22, 2020 · 0 comments

Comments

@mak001
Copy link
Contributor

mak001 commented Jan 22, 2020

Describe the bug
When using a custom object as a location if Featured is not a field on the object the json endpoint generates invalid json.

To Reproduce
Steps to reproduce the behavior:

  1. Create a custom location object without a Featured field
  2. Set locator to use new class as location
  3. run a dev/build?flush=all
  4. visit the locator page and add the json action

Expected behavior
Valid json is generated

This is what is generated currently without a Featured field of getter

{
   "locations":[
      {
         "ID":1,
         "Title":"#1",
         "Featured":,
         "Website":"",
         "Phone":"",
         "Fax":"",
         "Email":"",
         "Address":"",
         "Address2":"",
         "City":"Sheboygan",
         "State":"WI",
         "PostalCode":"53081",
         "Country":"us",
         "Distance":-1,
         "Lat":43.7013054,
         "Lng":-87.7271123
      }
   ]
}

Possible solutions
Make data templates try to find location object specific templates. Possibly add fall back support to a basic template with bare minimum field requirements.

The fix should also be implemented to the XML feed to keep everything consistent.

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

1 participant