Skip to content

Commit 718c1b3

Browse files
committed
update docs -1
1 parent 550dcdd commit 718c1b3

File tree

20 files changed

+279
-58
lines changed

20 files changed

+279
-58
lines changed

docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_site/

docs/GET_Articles_Response

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"data":[]}

docs/api/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
###############
2+
# temp file #
3+
###############
4+
*.yml

src/JsonApiDotNetCore/api/.manifest renamed to docs/api/.manifest

Lines changed: 143 additions & 46 deletions
Large diffs are not rendered by default.
File renamed without changes.

src/JsonApiDotNetCore/docfx.json renamed to docs/docfx.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
{
44
"src": [
55
{
6-
"files": [ "**.csproj" ],
7-
"src": "C:\\Users\\jnance\\dev\\json-api-dotnet-core\\src\\JsonApiDotNetCore"
6+
"files": [ "**/JsonApiDotNetCore.csproj" ],
7+
"src": "../"
88
}
99
],
1010
"dest": "api",
@@ -21,8 +21,9 @@
2121
},
2222
{
2323
"files": [
24-
"articles/**.md",
25-
"articles/**/toc.yml",
24+
"getting-started/**.md",
25+
"getting-started/**/toc.yml",
26+
"request-examples/**.md",
2627
"toc.yml",
2728
"*.md"
2829
]

docs/generate.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
# generates ./request-examples documents
3+
4+
function cleanup() {
5+
kill -9 $(lsof -ti tcp:5001) &2>/dev/null
6+
}
7+
8+
cleanup
9+
dotnet run -p ../src/Examples/GettingStarted/GettingStarted.csproj &
10+
app_pid=$!
11+
12+
13+
{ # try
14+
echo "Started app with PID $app_pid"
15+
16+
sleep 5
17+
18+
echo "sleep over"
19+
20+
for path in ./request-examples/*.sh; do
21+
op_name=$(basename "$path" .sh | sed 's/.*-//')
22+
echo $op_name
23+
bash $path | jq . > "./request-examples/$op_name-Response.json"
24+
done
25+
}
26+
27+
# docfx metadata
28+
29+
cleanup

docs/generators/index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## Installing
2+
3+
...
4+
5+
## Creating a project template
6+
7+
```
8+
dotnet new jadnc
9+
```

docs/getting-started/intro.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Introduction
2+
3+
What is this
4+
5+
[!code-csharp[Main](../../src/Examples/OperationsExample/Program.cs)]
File renamed without changes.

docs/index.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# JSON API .Net Core
2+
3+
A [{ json:api }](https://jsonapi.org) web application framework for .Net Core.
4+
5+
## Objectives
6+
7+
### 1. Eliminate Boilerplate
8+
9+
The goal of this package is to facility the development of json:api applications that leverage the full range
10+
of features provided by the specification.
11+
12+
Eliminate CRUD boilerplate and provide the following features across all your resource endpoints:
13+
14+
- Relationship inclusion and navigation
15+
- Filtering
16+
- Sorting
17+
- Pagination
18+
- Sparse field selection
19+
- And more...
20+
21+
As an example, with just the following model and controller definitions, you can service all of the following requests:
22+
23+
```http
24+
GET /articles HTTP/1.1
25+
Accept: application/vnd.api+json
26+
```
27+
28+
[!code-csharp[Article](../src/Examples/GettingStarted/Models/Article.cs)]
29+
30+
[!code-csharp[ArticlesController](../src/Examples/GettingStarted/Controllers/ArticlesController.cs)]
31+
32+
### 2. Extensibility
33+
34+
This library relies heavily on an open-generic-based dependency injection model which allows for easy per-resource customization.
35+
36+

docs/request-examples/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.json
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
curl http://localhost:5001/api/articles \
2+
-H "Accept: application/vnd.api+json" \
3+
-H "Content-Type: application/vnd.api+json" \
4+
-d '{
5+
"data": {
6+
"type": "articles",
7+
"attributes": {
8+
"title": "test"
9+
}
10+
}
11+
}'
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
curl http://localhost:5001/api/articles \
2+
-H "Accept: application/vnd.api+json"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
curl http://localhost:5001/api/articles/1 \
2+
-H "Accept: application/vnd.api+json"

docs/request-examples/index.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Examples
2+
3+
These requests have been generated against the "GettingStarted" application and are updated on every deployment.
4+
5+
## Create Article
6+
7+
[!code-sh[CREATE](000-CREATE_Article.sh)]
8+
[!code-json[CREATE](CREATE_Article-Response.json)]
9+
10+
11+
## Get All Articles
12+
13+
[!code-sh[GET Request](001-GET_Articles.sh)]
14+
[!code-json[GET Response](GET_Articles-Response.json)]
15+
16+
## Get Article By Id
17+
18+
[!code-sh[GET Request](002-GET_Article.sh)]
19+
[!code-json[GET Response](GET_Article-Response.json)]

docs/toc.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
- name: Getting Started
2+
href: getting-started/
3+
4+
- name: API
5+
href: api/
6+
homepage: api/index.md
7+
8+
- name: Request Examples
9+
href: request-examples/
10+
homepage: request-examples/index.md

src/Examples/GettingStarted/Models/Article.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
using JsonApiDotNetCore.Models;
2-
32
namespace GettingStarted.Models
43
{
54
public class Article : Identifiable
65
{
76
[Attr("title")]
87
public string Title { get; set; }
9-
8+
109
[HasOne("author")]
1110
public Person Author { get; set; }
1211
public int AuthorId { get; set; }

src/JsonApiDotNetCore/articles/intro.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/JsonApiDotNetCore/toc.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)