Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
linclark authored Mar 31, 2023
0 parents commit 5c74333
Show file tree
Hide file tree
Showing 8 changed files with 288 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# A hack to enable some degree of syntax highlighting on GitHub. Should be removed if GitHub ever receives native support for Wit files.
*.wit linguist-language=Rust
16 changes: 16 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
abi-up-to-date:
name: Check ABI files are up-to-date
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: WebAssembly/wit-abi-up-to-date@v12
with:
wit-abi-tag: wit-abi-0.10.0
112 changes: 112 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# [Example WASI proposal]

This template can be used to start a new proposal, which can then be proposed in the WASI Subgroup meetings.

The sections below are recommended. However, every proposal is different, and the community can help you flesh out the proposal, so don't block on having something filled in for each one of them.

Thank you to the W3C Privacy CG for the [inspiration](https://github.com/privacycg/template)!

# [Title]

A proposed [WebAssembly System Interface](https://github.com/WebAssembly/WASI) API.

### Current Phase

[Fill in the current phase, e.g. Phase 1]

### Champions

- [Champion 1]
- [Champion 2]
- [etc.]

### Phase 4 Advancement Criteria

TODO before entering Phase 2.

## Table of Contents [if the explainer is longer than one printed page]

- [Introduction](#introduction)
- [Goals [or Motivating Use Cases, or Scenarios]](#goals-or-motivating-use-cases-or-scenarios)
- [Non-goals](#non-goals)
- [API walk-through](#api-walk-through)
- [Use case 1](#use-case-1)
- [Use case 2](#use-case-2)
- [Detailed design discussion](#detailed-design-discussion)
- [[Tricky design choice 1]](#tricky-design-choice-1)
- [[Tricky design choice 2]](#tricky-design-choice-2)
- [Considered alternatives](#considered-alternatives)
- [[Alternative 1]](#alternative-1)
- [[Alternative 2]](#alternative-2)
- [Stakeholder Interest & Feedback](#stakeholder-interest--feedback)
- [References & acknowledgements](#references--acknowledgements)

### Introduction

[The "executive summary" or "abstract". Explain in a few sentences what the goals of the project are, and a brief overview of how the solution works. This should be no more than 1-2 paragraphs.]

### Goals [or Motivating Use Cases, or Scenarios]

[What is the end-user need which this project aims to address?]

### Non-goals

[If there are "adjacent" goals which may appear to be in scope but aren't, enumerate them here. This section may be fleshed out as your design progresses and you encounter necessary technical and other trade-offs.]

### API walk-through

The full API documentation can be found [here](wasi-proposal-template.md).

[Walk through of how someone would use this API.]

#### [Use case 1]

[Provide example code snippets and diagrams explaining how the API would be used to solve the given problem]

#### [Use case 2]

[etc.]

### Detailed design discussion

[This section should mostly refer to the .wit.md file that specifies the API. This section is for any discussion of the choices made in the API which don't make sense to document in the spec file itself.]

#### [Tricky design choice #1]

[Talk through the tradeoffs in coming to the specific design point you want to make.]

```
// Illustrated with example code.
```

[This may be an open question, in which case you should link to any active discussion threads.]

#### [Tricky design choice 2]

[etc.]

### Considered alternatives

[This section is not required if you already covered considered alternatives in the design discussion above.]

#### [Alternative 1]

[Describe an alternative which was considered, and why you decided against it.]

#### [Alternative 2]

[etc.]

### Stakeholder Interest & Feedback

TODO before entering Phase 3.

[This should include a list of implementers who have expressed interest in implementing the proposal]

### References & acknowledgements

Many thanks for valuable feedback and advice from:

- [Person 1]
- [Person 2]
- [etc.]
72 changes: 72 additions & 0 deletions example-world.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<h1><a name="example_world">World example-world</a></h1>
<ul>
<li>Imports:
<ul>
<li>interface <a href="#example_dep_interface"><code>example-dep-interface</code></a></li>
<li>interface <a href="#example_interface"><code>example-interface</code></a></li>
</ul>
</li>
</ul>
<h2><a name="example_dep_interface">Import interface example-dep-interface</a></h2>
<hr />
<h3>Types</h3>
<h4><a name="example_dep_type"><code>type example-dep-type</code></a></h4>
<p><code>u32</code></p>
<p>
## <a name="example_interface">Import interface example-interface</a>
<p>Short interface description.</p>
<p>Explanation for developers using the interface API. It should include an
overview of the API as a whole as well as call out notable items in it,
for example <a href="#example_api_type"><code>example-api-type</code></a> and <a href="#example_api_function"><code>example-api-function</code></a>.</p>
<hr />
<h3>Types</h3>
<h4><a name="example_dep_type"><code>type example-dep-type</code></a></h4>
<p><a href="#example_dep_type"><a href="#example_dep_type"><code>example-dep-type</code></a></a></p>
<p>
#### <a name="example_api_type">`record example-api-type`</a>
<p>Short type description</p>
<p>Explanation for developers using this type. It may be useful to give
some examples of places in the API where the type is used, such as in
the arguments and return type of <a href="#example_api_function"><code>example-api-function</code></a>.</p>
<details>
<summary>Detailed specification</summary>
More rigorous specification details for implementers go here, if needed.
The intention is to keep the developer-oriented docs focused on things that
most developers will need to be aware of, while putting bulkier descriptions
of precise behavior here.
</details>
<h5>Record Fields</h5>
<ul>
<li>
<p><a name="example_api_type.field0"><code>field0</code></a>: <code>u64</code></p>
<p>A description of a field.
</li>
<li>
<p><a name="example_api_type.field1"><code>field1</code></a>: <code>string</code></p>
<p>A description of another field.
</li>
</ul>
<hr />
<h3>Functions</h3>
<h4><a name="example_api_function"><code>example-api-function: func</code></a></h4>
<p>Short function description</p>
<p>Explanation for developers using the API. This should describe the
arguments which in this function are <code>arg0</code>, <code>arg1</code>, and <code>arg2</code>, and the
return value.</p>
<details>
<summary>Detailed specification</summary>
Similar to the details section above, this is meant for more rigorous
specification details for implementors. This may explain what a compliant
implementation MUST do, such as never returning an earlier result from a
later call, for example.
</details>
<h5>Params</h5>
<ul>
<li><a name="example_api_function.arg0"><code>arg0</code></a>: <a href="#example_api_type"><a href="#example_api_type"><code>example-api-type</code></a></a></li>
<li><a name="example_api_function.arg1"><code>arg1</code></a>: <code>string</code></li>
<li><a name="example_api_function.arg2"><code>arg2</code></a>: <a href="#example_dep_type"><a href="#example_dep_type"><code>example-dep-type</code></a></a></li>
</ul>
<h5>Return values</h5>
<ul>
<li><a name="example_api_function.0"></a> result&lt;<a href="#example_api_type"><a href="#example_api_type"><code>example-api-type</code></a></a>&gt;</li>
</ul>
11 changes: 11 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Testing guidelines

TK fill in testing guidelines

## Installing the tools

TK fill in instructions

## Running the tests

TK fill in instructions
6 changes: 6 additions & 0 deletions wit/deps/example-dep/example-api.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// An example dependency, showing how these look. Actual proposals should
// delete this file and add their actual dependencies in the `deps` directory.

interface example-dep-interface {
type example-dep-type = u32
}
59 changes: 59 additions & 0 deletions wit/example.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Instructions for filling in this file:
//
// - Delete all these `//` comments, up to the first `///` comment.
//
// - Replace the remaining contents below with [Wit] code describing
// `interface`s and/or `world`s, using the same formatting style.
//
// If you want to include examples of the API in use, these should be in the
// README.md at the root of the repository and linked to from this file.
//
// [Wit]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md

/// Short interface description.
///
/// Explanation for developers using the interface API. It should include an
/// overview of the API as a whole as well as call out notable items in it,
/// for example `example-api-type` and `example-api-function`.
default interface example-interface {
use example-dep.example-api.example-dep-interface.{example-dep-type}

/// Short type description
///
/// Explanation for developers using this type. It may be useful to give
/// some examples of places in the API where the type is used, such as in
/// the arguments and return type of `example-api-function`.
///
/// <details>
/// <summary>Detailed specification</summary>
/// More rigorous specification details for implementers go here, if needed.
/// The intention is to keep the developer-oriented docs focused on things that
/// most developers will need to be aware of, while putting bulkier descriptions
/// of precise behavior here.
/// </details>
record example-api-type {
/// A description of a field.
field0: u64,
/// A description of another field.
field1: string,
}

/// Short function description
///
/// Explanation for developers using the API. This should describe the
/// arguments which in this function are `arg0`, `arg1`, and `arg2`, and the
/// return value.
///
/// <details>
/// <summary>Detailed specification</summary>
/// Similar to the details section above, this is meant for more rigorous
/// specification details for implementors. This may explain what a compliant
/// implementation MUST do, such as never returning an earlier result from a
/// later call, for example.
/// </details>
example-api-function: func(
arg0: example-api-type,
arg1: string,
arg2: example-dep-type,
) -> result<example-api-type>
}
10 changes: 10 additions & 0 deletions wit/world.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// If the repository defines `interface`s, this file can define a minimal world
// which contains those interfaces, to allow documentation to be generated for
// them.
//
// Proposals should remove these `//` commments, and edit the `world` name and
// imports below to pull in their own `interface`s.

default world example-world {
import example-interface: pkg.example.example-interface
}

0 comments on commit 5c74333

Please sign in to comment.