Skip to content

Commit cd14bcf

Browse files
docs: rename repo URLs and restructure README for OSS
1 parent a1d296d commit cd14bcf

11 files changed

Lines changed: 79 additions & 161 deletions

File tree

.github/CODEOWNERS

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
# Default owner for everything
21
* @erlendellefsen
3-
4-
# Security-sensitive files require extra review
5-
.github/workflows/** @erlendellefsen

.github/dependabot.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ updates:
1414
commit-message:
1515
prefix: "build(nuget)"
1616
groups:
17-
# Group minor/patch updates to reduce PR noise
1817
microsoft:
1918
patterns:
2019
- "Microsoft.*"

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ Set `"JsonApiToolkit": "Debug"` in appsettings.json to enable detailed query pro
1717
- **Pagination clamping**: Invalid page numbers are silently clamped (negative/zero -> page 1, overflow -> last page).
1818
- **Malformed query params**: Bad filter/sort/include syntax is logged and skipped, not thrown as exceptions.
1919
- **Filtered includes**: Dot notation in filters (e.g. `filter[author.name]=John`) applies to included resources when `include=author` is also set.
20-
- **Include whitelisting**: `AllowedIncludesAttribute` on controller actions restricts which relationships can be requested via `include=`, preventing unauthorized data exposure.
20+
- **Include allowlisting**: `AllowedIncludesAttribute` on controller actions restricts which relationships can be requested via `include=`, preventing unauthorized data exposure.
2121
- **Sparse fieldsets**: `fields[type]=field1,field2` works for both primary and included resources. `id` and `type` are always returned.

JsonApiToolkit/Attributes/AllowedIncludesAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace JsonApiToolkit.Attributes;
1010

1111
/// <summary>
1212
/// Restricts which relationships can be included in responses.
13-
/// Returns 403 Forbidden if requested includes don't match the whitelist.
13+
/// Returns 403 Forbidden if requested includes don't match the allowlist.
1414
/// </summary>
1515
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
1616
public class AllowedIncludesAttribute : ActionFilterAttribute

JsonApiToolkit/Helpers/ReflectionMethodCache.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ internal static MethodInfo GetEnumerableAnyWithPredicate(Type elementType)
5050
?? throw new InvalidOperationException(
5151
"Could not find Enumerable.Any<T>(IEnumerable<T>, Func<T, bool>) method. "
5252
+ "This is a core .NET method that should always exist. "
53-
+ "Please report this issue at https://github.com/Intility/Intility.JsonApiToolkit/issues"
53+
+ "Please report this issue at https://github.com/intility/json-api-toolkit/issues"
5454
);
5555
}
5656
}
@@ -74,7 +74,7 @@ internal static MethodInfo GetEnumerableContains(Type elementType)
7474
?? throw new InvalidOperationException(
7575
"Could not find Enumerable.Contains<T>(IEnumerable<T>, T) method. "
7676
+ "This is a core .NET method that should always exist. "
77-
+ "Please report this issue at https://github.com/Intility/Intility.JsonApiToolkit/issues"
77+
+ "Please report this issue at https://github.com/intility/json-api-toolkit/issues"
7878
);
7979
}
8080
}
@@ -98,7 +98,7 @@ internal static MethodInfo GetEnumerableWhere(Type elementType)
9898
?? throw new InvalidOperationException(
9999
"Could not find Enumerable.Where<T>(IEnumerable<T>, Func<T, bool>) method. "
100100
+ "This is a core .NET method that should always exist. "
101-
+ "Please report this issue at https://github.com/Intility/Intility.JsonApiToolkit/issues"
101+
+ "Please report this issue at https://github.com/intility/json-api-toolkit/issues"
102102
);
103103
}
104104
}
@@ -126,7 +126,7 @@ Type propertyType
126126
?? throw new InvalidOperationException(
127127
$"Could not find Queryable.{methodName} method. "
128128
+ "This is a core .NET method that should always exist. "
129-
+ "Please report this issue at https://github.com/Intility/Intility.JsonApiToolkit/issues"
129+
+ "Please report this issue at https://github.com/intility/json-api-toolkit/issues"
130130
);
131131

132132
return method.MakeGenericMethod(entityType, propertyType);
@@ -154,7 +154,7 @@ internal static MethodInfo GetEfCoreIncludeMethod(Type entityType, Type property
154154
?? throw new InvalidOperationException(
155155
"Could not find EntityFrameworkQueryableExtensions.Include<TEntity, TProperty> method. "
156156
+ "Ensure Microsoft.EntityFrameworkCore is properly referenced. "
157-
+ "Please report this issue at https://github.com/Intility/Intility.JsonApiToolkit/issues"
157+
+ "Please report this issue at https://github.com/intility/json-api-toolkit/issues"
158158
);
159159
}
160160
}
@@ -195,7 +195,7 @@ internal static MethodInfo GetQueryableSelectMethod(Type sourceType, Type projec
195195
?? throw new InvalidOperationException(
196196
"Could not find Queryable.Select<TSource, TResult>(IQueryable<TSource>, Expression<Func<TSource, TResult>>) method. "
197197
+ "This is a core .NET method that should always exist. "
198-
+ "Please report this issue at https://github.com/Intility/Intility.JsonApiToolkit/issues"
198+
+ "Please report this issue at https://github.com/intility/json-api-toolkit/issues"
199199
);
200200
}
201201
}
@@ -232,7 +232,7 @@ internal static MethodInfo GetEfCoreToListAsyncMethod(Type elementType)
232232
?? throw new InvalidOperationException(
233233
"Could not find EntityFrameworkQueryableExtensions.ToListAsync<T>(IQueryable<T>, CancellationToken) method. "
234234
+ "Ensure Microsoft.EntityFrameworkCore is properly referenced. "
235-
+ "Please report this issue at https://github.com/Intility/Intility.JsonApiToolkit/issues"
235+
+ "Please report this issue at https://github.com/intility/json-api-toolkit/issues"
236236
);
237237
}
238238
}
@@ -297,7 +297,7 @@ Type newPropertyType
297297
throw new InvalidOperationException(
298298
"Could not find EntityFrameworkQueryableExtensions.ThenInclude method. "
299299
+ "Ensure Microsoft.EntityFrameworkCore is properly referenced. "
300-
+ "Please report this issue at https://github.com/Intility/Intility.JsonApiToolkit/issues"
300+
+ "Please report this issue at https://github.com/intility/json-api-toolkit/issues"
301301
);
302302

303303
foreach (var candidate in candidates)
@@ -322,7 +322,7 @@ Type newPropertyType
322322
?? throw new InvalidOperationException(
323323
"Could not find EntityFrameworkQueryableExtensions.ThenInclude method. "
324324
+ "Ensure Microsoft.EntityFrameworkCore is properly referenced. "
325-
+ "Please report this issue at https://github.com/Intility/Intility.JsonApiToolkit/issues"
325+
+ "Please report this issue at https://github.com/intility/json-api-toolkit/issues"
326326
);
327327
s_thenIncludeReference ??= s_thenIncludeCollection;
328328
}

JsonApiToolkit/JsonApiToolkit.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Company>Intility</Company>
1212
<Description>A toolkit for implementing JSON:API specification in .NET applications</Description>
1313
<PackageTags>jsonapi;api;rest;dotnet</PackageTags>
14-
<RepositoryUrl>https://github.com/intility/Intility.JsonApiToolkit</RepositoryUrl>
14+
<RepositoryUrl>https://github.com/intility/json-api-toolkit</RepositoryUrl>
1515
<RepositoryType>git</RepositoryType>
1616
<PackageReadmeFile>README.md</PackageReadmeFile>
1717
<PackageLicenseExpression>MIT</PackageLicenseExpression>

README.md

Lines changed: 58 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,77 @@
1-
[![CI/CD Pipeline](https://github.com/intility/Intility.JsonApiToolkit/actions/workflows/ci-cd.yml/badge.svg)](https://github.com/intility/Intility.JsonApiToolkit/actions/workflows/ci-cd.yml)
2-
[![Docs](https://github.com/intility/Intility.JsonApiToolkit/actions/workflows/docs.yml/badge.svg)](https://github.com/intility/Intility.JsonApiToolkit/actions/workflows/docs.yml)
3-
4-
# Intility.JsonApiToolkit
5-
6-
JsonApiToolkit is a lightweight toolkit for implementing the [JSON:API specification](https://jsonapi.org/) in .NET applications.
1+
<h1 align="center">
2+
<img src="https://avatars.githubusercontent.com/u/35199565" width="124px"/><br/>
3+
JsonApiToolkit
4+
</h1>
5+
6+
<p align="center">
7+
<em>A .NET toolkit for implementing the JSON:API specification.</em>
8+
</p>
9+
<p align="center">
10+
<a href="https://dotnet.microsoft.com/">
11+
<img src="https://img.shields.io/badge/.NET-10.0-blue.svg?logo=dotnet&logoColor=white&label=.NET" alt=".NET version">
12+
</a>
13+
<a href="https://www.nuget.org/packages/Intility.JsonApiToolkit">
14+
<img src="https://img.shields.io/nuget/v/Intility.JsonApiToolkit.svg?logo=nuget&logoColor=white&label=NuGet" alt="NuGet">
15+
</a>
16+
<a href="https://jsonapi.org/">
17+
<img src="https://img.shields.io/badge/JSON%3AAPI-1.1-blue.svg" alt="JSON:API version">
18+
</a>
19+
<a href="https://github.com/intility/json-api-toolkit/blob/main/LICENSE">
20+
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License">
21+
</a>
22+
<a href="https://github.com/intility/json-api-toolkit/actions/workflows/ci-cd.yml">
23+
<img src="https://github.com/intility/json-api-toolkit/actions/workflows/ci-cd.yml/badge.svg" alt="CI/CD">
24+
</a>
25+
</p>
26+
27+
## Description
28+
29+
JsonApiToolkit makes ASP.NET Core APIs speak the [JSON:API specification](https://jsonapi.org/). It translates standard query parameters (`filter[]`, `sort`, `include`, `fields[]`, `page[]`) into typed EF Core queries and returns spec-compliant response documents, so your controllers stay short and predictable.
730

831
## Installation
932

10-
To install this package from Intility's GitHub Packages, add this to your NuGet.config file:
11-
12-
```xml
13-
<?xml version="1.0" encoding="utf-8"?>
14-
<configuration>
15-
<packageSources>
16-
<add key="github" value="https://nuget.pkg.github.com/Intility/index.json" />
17-
</packageSources>
18-
<packageSourceCredentials>
19-
<github>
20-
<add key="Username" value="YOUR_GITHUB_USERNAME" />
21-
<add key="ClearTextPassword" value="YOUR_GITHUB_PAT" />
22-
</github>
23-
</packageSourceCredentials>
24-
</configuration>
25-
```
26-
27-
Then install the package via NuGet:
28-
2933
```bash
3034
dotnet add package Intility.JsonApiToolkit
3135
```
3236

33-
## Setup
37+
## Usage
3438

35-
1. **Register services:**
36-
In your `Program.cs` or `Startup.cs`, add the toolkit services to your dependency injection container:
39+
Register the toolkit in `Program.cs`:
3740

38-
```csharp
39-
builder.Services.AddJsonApiToolkit();
40-
```
41-
42-
2. **Inheritance:**
43-
Derive your API controllers from the provided `JsonApiController` to leverage helper methods that return JSON:API compliant responses.
41+
```csharp
42+
builder.Services.AddJsonApiToolkit();
43+
```
4444

45-
```csharp
46-
public class BooksController : JsonApiController
47-
{
48-
// Your endpoint implementations here
49-
}
50-
```
45+
Derive controllers from `JsonApiController` and let `JsonApiQueryAsync` handle the request:
5146

52-
3. **Configuration:**
53-
The toolkit automatically configures JSON serialization settings (camelCase properties, ignoring nulls, etc.) and adds the JSON:API media type to the supported output formatters.
47+
```csharp
48+
public class BooksController : JsonApiController
49+
{
50+
[HttpGet]
51+
[AllowedIncludes("author", "publisher")]
52+
public Task<IActionResult> GetBooks() =>
53+
JsonApiQueryAsync(_dbContext.Books.AsQueryable(), "book");
54+
}
55+
```
5456

55-
## GitHub Actions
56-
To get fetch the package in your GitHub Actions workflow, add the following to your workflow file:
57+
Then call the endpoint with JSON:API query parameters:
5758

58-
```yaml
59-
- name: Add Intility NuGet Package Source
60-
run: |
61-
dotnet nuget add source https://nuget.pkg.github.com/Intility/index.json \
62-
--name Intility \
63-
--username ${{ github.actor }} \
64-
--password ${{ secrets.GITHUB_TOKEN }} \
65-
--store-password-in-clear-text
59+
```
60+
GET /api/books?filter[title]=javascript&include=author&fields[book]=title,published&page[size]=10&sort=-published
6661
```
6762

68-
> [!IMPORTANT]
69-
> Your Github token must have the `read:packages` scope to access the package.
70-
71-
## Endpoint Example
63+
## What it provides
7264

73-
```csharp
74-
// GET: api/books
75-
[HttpGet]
76-
public async Task<IActionResult> GetBooks()
77-
{
78-
var query = _dbContext.Books.AsQueryable();
65+
- **JSON:API documents** - compliant `data` / `included` / `meta` / `links` / `errors` envelope on every response
66+
- **Filtering** - `filter[field]=value` with operators, nested paths, and filtering on included resources
67+
- **Sorting** - `sort=field,-other` with multi-field and descending support
68+
- **Pagination** - `page[number]` / `page[size]` with link generation, total counts, and clamping
69+
- **Sparse fieldsets** - `fields[type]=a,b` to limit returned attributes per resource type
70+
- **Included resources** - `include=author,publisher.country` with allowlisting via `[AllowedIncludes]`
71+
- **EF Core integration** - query operators translate directly to SQL via `IQueryable`
72+
- **Strict mode** - return 404 for out-of-range pages and validate filter paths against allowed includes
7973

80-
// JsonApiQueryAsync applies filtering, sorting, includes, and pagination automatically.
81-
return await JsonApiQueryAsync(query, "book");
82-
}
83-
```
74+
## Documentation
8475

85-
[More examples (WIP)](https://congenial-telegram-prep6vq.pages.github.io/docs/api-controller-examples.html)
76+
Full documentation is at <https://intility.github.io/json-api-toolkit/>.
8677

87-
## Documentation
88-
For complete documentation and detailed usage instructions, please visit our
89-
[documentation page.](https://intility.github.io/Intility.JsonApiToolkit/)

docs/contributing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ Branch names: `feat/`, `fix/`, `refactor/`, `docs/`, `test/`, `chore/`, etc.
6363

6464
1. Branch from `main`.
6565
2. Format (`dotnet csharpier format .`) and run tests locally.
66-
3. Open a PR with a descriptive title and bullet summary.
67-
4. CI must pass `build-and-test` and `Docs: Build` (required status checks).
68-
5. Squash merge (the only merge method allowed on `main`).
66+
3. Open a PR with a descriptive title and summary.
67+
4. CI must pass.
68+
5. At least one approving review is required.
6969

7070
## Releases
7171

7272
Handled by [Release Please](https://github.com/googleapis/release-please). Merging to `main` updates a release PR that accumulates changes. Merging the release PR cuts a GitHub Release, publishes to NuGet, and bumps the version in `JsonApiToolkit.csproj` and `mkdocs.yaml`.
7373

7474
## Questions
7575

76-
Open an issue: <https://github.com/intility/Intility.JsonApiToolkit/issues>
76+
Open an issue: <https://github.com/intility/json-api-toolkit/issues>

docs/getting-started.md

Lines changed: 1 addition & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,6 @@ This guide walks you through installing and configuring JsonApiToolkit in your .
99

1010
## Installation
1111

12-
To install this package from Intility's GitHub Packages, add this to your NuGet.config file:
13-
14-
```xml
15-
<?xml version="1.0" encoding="utf-8"?>
16-
<configuration>
17-
<packageSources>
18-
<add key="github" value="https://nuget.pkg.github.com/Intility/index.json" />
19-
</packageSources>
20-
<packageSourceCredentials>
21-
<github>
22-
<add key="Username" value="YOUR_GITHUB_USERNAME" />
23-
<add key="ClearTextPassword" value="YOUR_GITHUB_PAT" />
24-
</github>
25-
</packageSourceCredentials>
26-
</configuration>
27-
```
28-
29-
Then install the package via NuGet:
30-
3112
```bash
3213
dotnet add package Intility.JsonApiToolkit
3314
```
@@ -72,51 +53,5 @@ dotnet add package Intility.JsonApiToolkit
7253
The toolkit automatically configures JSON serialization settings (camelCase properties, ignoring nulls, etc.) and adds the JSON:API media type to the supported output formatters.
7354

7455
> [!NOTE]
75-
> Now your API is ready to return responses that fully comply with the JSON:API specification!
76-
77-
78-
## GitHub Actions
79-
To get fetch the package in your GitHub Actions workflow, add the following to your workflow file:
80-
81-
```yaml
82-
- name: Add Intility NuGet Package Source
83-
run: |
84-
dotnet nuget add source https://nuget.pkg.github.com/Intility/index.json \
85-
--name Intility \
86-
--username ${{ github.actor }} \
87-
--password ${{ secrets.GITHUB_TOKEN }} \
88-
--store-password-in-clear-text
89-
```
90-
91-
> [!IMPORTANT]
92-
> Your Github token must have the `read:packages` scope to access the package.
93-
94-
## Dependabot
95-
To enable Dependabot to fetch the package, add the registry to your `dependabot.yml` file. Example:
96-
97-
```yaml
98-
version: 2
99-
100-
registries:
101-
intility:
102-
type: "nuget-feed"
103-
url: "https://nuget.pkg.github.com/Intility/index.json"
104-
username: "x-access-token"
105-
password: ${{ secrets.INTILITY_NUGET_DEPENDABOT }}
106-
107-
updates:
108-
- package-ecosystem: "nuget"
109-
directory: "/"
110-
registries: "*"
111-
schedule:
112-
interval: "weekly"
113-
open-pull-requests-limit: 5
114-
commit-message:
115-
prefix: "🤖"
116-
labels:
117-
- "dependencies"
118-
```
56+
> Now your API is ready to return responses that fully comply with the JSON:API specification!
11957
120-
> [!IMPORTANT]
121-
> You need to create a token with `read:packages` that you add to
122-
> your dependabot secrets.

docs/integrations/ts-tools.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
**jsonapi-ts-tools** is a lightweight, Deno-based TypeScript library designed
66
to make working with
7-
[JsonApiToolkit](https://github.com/intility/Intility.JsonApiToolkit) responses
7+
[JsonApiToolkit](https://github.com/intility/json-api-toolkit) responses
88
in TypeScript applications easier.
99

1010
## Features
@@ -15,11 +15,11 @@ in TypeScript applications easier.
1515
and inclusion.
1616

1717
## Prerequisites
18-
- **JsonApiToolkit**: This library is designed to work with [JsonApiToolkit](https://github.com/intility/Intility.JsonApiToolkit). Make sure the api you want to interact with is using JsonApiToolkit.
18+
- **JsonApiToolkit**: This library is designed to work with [JsonApiToolkit](https://github.com/intility/json-api-toolkit). Make sure the api you want to interact with is using JsonApiToolkit.
1919

2020
## Getting Started
2121

22-
You can read more about jsonapi-ts-tools & JsonApiToolkit [**here**](https://intility.github.io/Intility.JsonApiToolkit/docs/integrations/ts-tools.html), or follow the instructions below for a quick start.
22+
You can read more about jsonapi-ts-tools & JsonApiToolkit [**here**](https://intility.github.io/json-api-toolkit/docs/integrations/ts-tools.html), or follow the instructions below for a quick start.
2323

2424
### Installation
2525

0 commit comments

Comments
 (0)