Skip to content

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

@mak001

Description

@mak001

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions