zcap-spec-examples

Extracts the examples from the Authorization Capabilities (zcap) spec (or any ReSpec document) and prints them as NDJSON, so every example can be checked and built on. This page extracts them live, in your browser: each example below is its own section.

Snapshot examples · Diff versions · API docs · Repository · Usage

About this page

This page documents the zcap-spec-examples library; it is not a specification.

Examples

Each example extracted from the spec, in document order.

Usage

On the command line

curl -sS https://w3c-ccg.github.io/zcap-spec/v0.4.0-draft/ | npx zcap-spec-examples

In a web page

The library is hosted here as ES modules, so any page can import it with no install and no build step. Paste this into an HTML file and open the console:

<script type="module">
  import { extractExamples } from "https://gobengo.github.io/zcap-spec-examples/lib/examples.js";

  const response = await fetch("https://w3c-ccg.github.io/zcap-spec/v0.4.0-draft/");
  for await (const example of extractExamples(response)) {
    console.log(example.name, example);
  }
</script>

Hosted modules: lib/examples.js (extraction and parsing) and lib/fixtures.js (a bundled snapshot of the spec, for use offline), each with .d.ts types. See the API docs.