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

Add a range Base-level Constraint #32

Open
wants to merge 1 commit into
base: template-proposal
Choose a base branch
from

Conversation

benhamill
Copy link

This adds a range base-level constraint for use inside the template tag.

The use case I'm thinking of is stuff like this:

<uber>
  <data rel="collection users" url="/users" template="#user_index_template" action="read">
    <data rel="item user" url="/users/8765" action="read">
      <data name="name">Ben</data>
      <!-- ... -->
    </data>
    <!-- ... -->
  </data>

  <template id="user_index_template">
    <data name="page">
      <data name="pattern">\d+</data>
    </data>

    <data name="per_page">
      <data name="range">1-100</data> <!-- The server will only ever return a maximum of 100 users per page. -->
    </data>

    <data name="sort_by">
      <data name="options">
        <data>name</name>
        <data>joined_at</name>
      </data>
    </data>
  </template>
</uber>

I didn't update the html file because when I tried to run asciidoc, there were more differences than just my chance, so I figured there were some configurations I didn't have or something. I've never used asciidoc before, so... Lemme know if you want me to do that.

Also, lemme know if this seems like... too much cruft without commensurate benefit at this early stage in the life of the spec.

@mamund
Copy link
Owner

mamund commented Mar 17, 2014

@benhamill:

I think a "tool-able" range implementation for UBER would look like this:

<template>
  <data name="per_page">
    <data name="range">
      <data name="min">1</data>
      <data name="max">100</data>
    </data>
  </data>
<template>

BTW - I'm OK w/ exploring these constraints now even if all of them don't make it into the first draft. I think trying these out can expose any weaknesses in the basic design and help inform the process of both base-line and extensibility constraint implementation down the line.

As for the PR, if you like, create a new branch (constraint-proposals) and add a new document to the proposals folder. We can start to collect constraints there and work through them without causing problems for the main spec doc.

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

Successfully merging this pull request may close these issues.

2 participants