Skip to content

0.7.0 Release Notes

Gregory Engel edited this page Jun 19, 2018 · 4 revisions

ANS 0.7.0

New Feature: Promo References

A promo reference has the same form as any other reference, but with a few key differences:

  • A promo reference is denormalized into an object with only the following fields:

    • _id
    • version
    • type
    • subtype
    • headlines
    • subheadlines
    • description
    • label
    • promo_items
    • credits
    • taxonomy
    • websites
    • canonical_website
    • canonical_url
    • short_url
    • display_date
    • publish_date
    • language
    • alignment
    • (...additional fields may be added at a later time.)
  • Promo references are resolved against an already-denormalized document.

  • Promo references only reference story, gallery and video documents. Additional reference types may be added at a later time.

  • Promo references have the same form as a regular reference in most other respects, but their type is promo_reference.

  • Promo references will not count against the normal reference limit. A single document will be limited to 500 promo references.

Schema: https://github.com/washingtonpost/ans-schema/blob/master/src/main/resources/schema/ans/0.7.0/utils/promo_reference.json

New Content Type: Collections

A new document type collection represents in ANS a curated sequence of content. A collection has the same ANS fields as a story. However, collections have some significant behavioral differences.

  • content_elements in a collection may only consist of promo references

  • When fetching a single collection via the Content API, a maximum of 10 items from content_elements may be returned in a denormalized view. Pagination parameters (the same as the current /search endpoint) will also be supported.

  • When a collection object is returned as part of search results, content_elements may be omitted entirely.

Schema: https://github.com/washingtonpost/ans-schema/blob/master/src/main/resources/schema/ans/0.7.0/collection.json

New Feature: Content Aliases

A new field in ANS content_aliases represents alternate names by which a document may be fetched. A single document can have multiple content aliases, which are arbitrary strings that conform to /^(a-z)(a-z0-9-)$/.

Documents can therefore be fetched by alias and website, or alias, type and website. E.g. /?alias=foo-bar&website=chicago-tribune or ?alias=foo-bae&website=chicago-tribune&type=collection. Multiple distinct documents can exist with the same alias. In this way, users can simulate having variations on a single document across websites. Searching for multiple documents with the same alias will also be supported.

{
  "content_aliases": ["my-homepage-collection", "johns-hot-takes"],
}

Schema: https://github.com/washingtonpost/ans-schema/blob/master/src/main/resources/schema/ans/0.7.0/traits/trait_content_aliases.json

Example of three features in unison (input document)

{
  "_id": "ABCDEFGHIJKLMNOPQRSTUVWZYZ",
  "type": "collection",
  "version": "0.7.0",

  "credits": {
    "by": [
      {
        "type": "reference",
        "referent": {
          "type": "author",
          "id": "engelg",
          "provider": ""
        }
      }
    ]
  },

  "headlines": {
    "basic": "My Awesome Stories"
  },

  "subheadlines": {
    "basic": "The best stories, the best collection."
  },

  "description": {
    "basic": "I wonder why the wonder falls."
  },

  "promo_items": {
    "basic": {
      "type": "image",
      "version": "0.7.0",
      "url": "http://www.washingtonpost.com/logo.jpg"
    }
  },

  "content_aliases": ["my-homepage-collection"],

  "websites": {
    "a": {}
  },

  "content_elements": [
    {
      "type": "promo_reference",
      "referent": {
        "id": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
        "type": "story",
        "referent_properties": {
          "headlines": {
            "basic": "Overridden Headline"
          }
        }
      }
    },

    {
      "type": "promo_reference",
      "referent": {
        "id": "BBCDEFGHIJKLMNOPQRSTUVWXYZ",
        "type": "gallery",
        "referent_properties": {
          "credits": {
            "by": [
              {
                "type": "author",
                "verion": "0.6.1",
                "byline": "Greg"
              }
            ]
          }
        }
      }
    }
  ]
}