-
Notifications
You must be signed in to change notification settings - Fork 1
Template JSON Models
Tip
When you inspect the GitHub Markdown for this template, you'll spot ```javascript
code fences.
Technically the code blocks are JSON in the API, however Javascript supports
inline comments for documentation so is a better choice for documentation.
You will see JSON for Pizza in various contexts:
JSON type | Context | Side effects |
---|---|---|
Pie | Responses to calls for that alter toppings | All changes to pie context publish pie JSON to your messaging system. Updates the PIES table in a reporting database, and your UI views update |
Toppings Each payload is for a specific topping type (Or for DELETE is simply the URL) |
Integrations post to Pizza API REST endpoint to change a specific topping. Pizza UI uses the same REST calls | All changes to pie context publish pie JSON to your messaging system. Updates the affected "topping" tables in your reporting database (Onion, etc), and views update |
Note
This table is an upfront way of setting expectations for your API consumers, and helps them jump to information quickly.
- Toppings — Integrations post these to the Pizza API to change toppings. These are published back through your messaging system, and seen by all integrations and your reporting database
Note
Here you break out the same information into shorter parts, again to ease understanding and to provide quick internal links.
When sending JSON responses to API calls, or publishing to your messaging system, the data payload should be wrapped JSON:
{
"apiVersion": "v1",
"effectiveTime": "1970-01-01T00:00:00.000000Z", // "now"
"data": { } // or [ ] depending on payload
}
Note
See (Template-REST-API#response-shapes) for more details.
In this template I omit the section on pie JSON as the REST API template focuses on the topping endpoints, and not the pie endpoints. Every change to toppings returns pie JSON to show the full context.
Purpose | Endpoints | Client |
---|---|---|
Express an Onion topping | Subpart of pie JSON | All integrations |
Create/edit/delete one Onion topping | Pizza UI |
{
"startTime": "1970-01-01T00:00:00.000000Z",
"pizzaId": "UUID", // Generated by Pizza
"toppingId": "UUID", // Generated by Pizza
"type": "ONION", // Always ONION for this topping
"color": "<GREEN, RED, or WHITE>",
"style": "<FRESH or GRILLED>",
"comments": "free text, else null"
}
See ONION_COLOR
and
ONION_STYLE
.
This is an example sidebar for your GitHub wiki (GitHub by default shows this on the right top of all wiki pages). By default GitHub simply lists your pages in alphabetical order.
This side bar is named _Sidebar.md
in the source files when you clone the
wiki, or you can use the "crayon" icon to edit in the UI.
Note
When you use the "Wiki" option on GitHub's top bar, it takes you to the
"Home" page (Home.md
): you cannot rename this page, and GitHub uses the
page name for the title at the page top.
Use [[some page title]]
with double brackets when referencing pages here in
the sidebar or elsewhere in your wiki pages.
And use the #
, ##
, etc. style in Markdown to format the sidebar.
Important
Delete this callout and all of the above, but keep the below explanation to help new readers use the "Pages" UI control.
You can always use the "Pages" UI control above this sidebar ☝ to navigate around all pages alphabetically (even pages not in this sidebar), to navigate the outline for each page, or for a search box.
Note
Markdown works in sidebars, such as headings (#
, ##
, etc) to organize
structure in the sidebar, illustrated below.
Here is the suggested reading order: