Skip to content

GET poorly handles an entity with a property named "Partition" or "Row" #14

@jleung51

Description

@jleung51

Migrated from GitLab.

As noted in Assignment 1:

Full list of operations implemented in the sample code

  1. [...]
  2. [...]
  3. [...]
  4. [...]
  5. Get all entries in a table
  • HTTP method: GET
  • Operation: (None)
  • Parameters: Table name
  • Response codes:
    • status_codes::BadRequest (400): No parameters specified
    • status_codes::NotFound (404): Table does not exist
    • status_codes::OK (200): Table found, entities returned as JSON array
  • Result: If the table exists, the response body is a JSON array of objects. Each object corresponds to an entity in this table. The entity’s partition is returned as though it were a property named “Partition” and its row is returned as though it were a property named “Row”. The actual properties of the entity are returned as properties of the JSON object.
  • Note: The above design poorly handles the case where an entity has a property “Partition” or “Row”. The simplest solution is to adopt the convention of never assigning an entity those properties.

Because of this, I believe it would be best to check for these property names in handle_put(), and return status_codes::BadRequest (400) (and document this).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions