Skip to content

Commit a6feeeb

Browse files
committed
Drop /v1 from API namespace, because it suggests API versioning should be done this way
1 parent 94719ea commit a6feeeb

File tree

16 files changed

+27
-27
lines changed

16 files changed

+27
-27
lines changed

docs/internals/queries.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Processing a request involves the following steps:
2929
To get a sense of what this all looks like, let's look at an example query string:
3030

3131
```
32-
/api/v1/blogs?
32+
/api/blogs?
3333
include=owner,posts.comments.author&
3434
filter=has(posts)&
3535
sort=count(posts)&

docs/usage/options.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ options.UseRelativeLinks = true;
5555
"relationships": {
5656
"author": {
5757
"links": {
58-
"self": "/api/v1/articles/4309/relationships/author",
59-
"related": "/api/v1/articles/4309/author"
58+
"self": "/articles/4309/relationships/author",
59+
"related": "/articles/4309/author"
6060
}
6161
}
6262
}

docs/usage/routing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ You can add a namespace to all URLs by specifying it at startup.
1111

1212
```c#
1313
// Program.cs
14-
builder.Services.AddJsonApi<AppDbContext>(options => options.Namespace = "api/v1");
14+
builder.Services.AddJsonApi<AppDbContext>(options => options.Namespace = "api/shopping");
1515
```
1616

17-
Which results in URLs like: https://yourdomain.com/api/v1/people
17+
Which results in URLs like: https://yourdomain.com/api/shopping/articles
1818

1919
## Default routing convention
2020

@@ -66,14 +66,14 @@ It is possible to override the default routing convention for an auto-generated
6666
```c#
6767
// Auto-generated
6868
[DisableRoutingConvention]
69-
[Route("v1/custom/route/summaries-for-orders")]
69+
[Route("custom/route/summaries-for-orders")]
7070
partial class OrderSummariesController
7171
{
7272
}
7373

7474
// Hand-written
7575
[DisableRoutingConvention]
76-
[Route("v1/custom/route/lines-in-order")]
76+
[Route("custom/route/lines-in-order")]
7777
public class OrderLineController : JsonApiController<OrderLine, int>
7878
{
7979
public OrderLineController(IJsonApiOptions options, IResourceGraph resourceGraph,

src/Examples/JsonApiDotNetCoreExample/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static void ConfigureServices(WebApplicationBuilder builder)
6060
{
6161
builder.Services.AddJsonApi<AppDbContext>(options =>
6262
{
63-
options.Namespace = "api/v1";
63+
options.Namespace = "api";
6464
options.UseRelativeLinks = true;
6565
options.IncludeTotalResourceCount = true;
6666
options.SerializerOptions.WriteIndented = true;

src/Examples/JsonApiDotNetCoreExample/Properties/launchSettings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
"IIS Express": {
1313
"commandName": "IISExpress",
1414
"launchBrowser": false,
15-
"launchUrl": "api/v1/todoItems",
15+
"launchUrl": "api/todoItems",
1616
"environmentVariables": {
1717
"ASPNETCORE_ENVIRONMENT": "Development"
1818
}
1919
},
2020
"Kestrel": {
2121
"commandName": "Project",
2222
"launchBrowser": false,
23-
"launchUrl": "api/v1/todoItems",
23+
"launchUrl": "api/todoItems",
2424
"applicationUrl": "https://localhost:44340;http://localhost:14140",
2525
"environmentVariables": {
2626
"ASPNETCORE_ENVIRONMENT": "Development"

src/Examples/NoEntityFrameworkExample/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
string? connectionString = GetConnectionString(builder.Configuration);
1111
builder.Services.AddNpgsql<AppDbContext>(connectionString);
1212

13-
builder.Services.AddJsonApi(options => options.Namespace = "api/v1", resources: resourceGraphBuilder => resourceGraphBuilder.Add<WorkItem, int>());
13+
builder.Services.AddJsonApi(options => options.Namespace = "api", resources: resourceGraphBuilder => resourceGraphBuilder.Add<WorkItem, int>());
1414

1515
builder.Services.AddResourceService<WorkItemService>();
1616

src/Examples/NoEntityFrameworkExample/Properties/launchSettings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
"IIS Express": {
1313
"commandName": "IISExpress",
1414
"launchBrowser": true,
15-
"launchUrl": "api/v1/workItems",
15+
"launchUrl": "api/workItems",
1616
"environmentVariables": {
1717
"ASPNETCORE_ENVIRONMENT": "Development"
1818
}
1919
},
2020
"Kestrel": {
2121
"commandName": "Project",
2222
"launchBrowser": true,
23-
"launchUrl": "api/v1/workItems",
23+
"launchUrl": "api/workItems",
2424
"applicationUrl": "https://localhost:44349;http://localhost:14149",
2525
"environmentVariables": {
2626
"ASPNETCORE_ENVIRONMENT": "Development"

src/JsonApiDotNetCore/Configuration/IJsonApiOptions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public interface IJsonApiOptions
1515
/// </summary>
1616
/// <example>
1717
/// <code><![CDATA[
18-
/// options.Namespace = "api/v1";
18+
/// options.Namespace = "api/shopping";
1919
/// ]]></code>
2020
/// </example>
2121
string? Namespace { get; }
@@ -64,8 +64,8 @@ public interface IJsonApiOptions
6464
/// "relationships": {
6565
/// "author": {
6666
/// "links": {
67-
/// "self": "/api/v1/articles/4309/relationships/author",
68-
/// "related": "/api/v1/articles/4309/author"
67+
/// "self": "/api/shopping/articles/4309/relationships/author",
68+
/// "related": "/api/shopping/articles/4309/author"
6969
/// }
7070
/// }
7171
/// }

test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ public async Task Cannot_create_resource_for_href_element()
501501
new
502502
{
503503
op = "add",
504-
href = "/api/v1/musicTracks"
504+
href = "/api/musicTracks"
505505
}
506506
}
507507
};

test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Deleting/AtomicDeleteResourceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ public async Task Cannot_delete_resource_for_href_element()
334334
new
335335
{
336336
op = "remove",
337-
href = "/api/v1/musicTracks/1"
337+
href = "/api/musicTracks/1"
338338
}
339339
}
340340
};

test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicAddToToManyRelationshipTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public async Task Cannot_add_for_href_element()
244244
new
245245
{
246246
op = "add",
247-
href = "/api/v1/musicTracks/1/relationships/performers"
247+
href = "/api/musicTracks/1/relationships/performers"
248248
}
249249
}
250250
};

test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicRemoveFromToManyRelationshipTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public async Task Cannot_remove_for_href_element()
243243
new
244244
{
245245
op = "remove",
246-
href = "/api/v1/musicTracks/1/relationships/performers"
246+
href = "/api/musicTracks/1/relationships/performers"
247247
}
248248
}
249249
};

test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicReplaceToManyRelationshipTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ public async Task Cannot_replace_for_href_element()
278278
new
279279
{
280280
op = "update",
281-
href = "/api/v1/musicTracks/1/relationships/performers"
281+
href = "/api/musicTracks/1/relationships/performers"
282282
}
283283
}
284284
};

test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicUpdateToOneRelationshipTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ public async Task Cannot_create_for_href_element()
531531
new
532532
{
533533
op = "update",
534-
href = "/api/v1/musicTracks/1/relationships/ownedBy"
534+
href = "/api/musicTracks/1/relationships/ownedBy"
535535
}
536536
}
537537
};

test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateResourceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ public async Task Cannot_update_resource_for_href_element()
620620
new
621621
{
622622
op = "update",
623-
href = "/api/v1/musicTracks/1"
623+
href = "/api/musicTracks/1"
624624
}
625625
}
626626
};

test/NoEntityFrameworkTests/WorkItemTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ await RunOnDatabaseAsync(async dbContext =>
4545
await dbContext.SaveChangesAsync();
4646
});
4747

48-
const string route = "/api/v1/workItems";
48+
const string route = "/api/workItems";
4949

5050
// Act
5151
(HttpResponseMessage httpResponse, Document responseDocument) = await ExecuteGetAsync<Document>(route);
@@ -71,7 +71,7 @@ await RunOnDatabaseAsync(async dbContext =>
7171
await dbContext.SaveChangesAsync();
7272
});
7373

74-
string route = $"/api/v1/workItems/{workItem.StringId}";
74+
string route = $"/api/workItems/{workItem.StringId}";
7575

7676
// Act
7777
(HttpResponseMessage httpResponse, Document responseDocument) = await ExecuteGetAsync<Document>(route);
@@ -110,7 +110,7 @@ public async Task Can_create_WorkItem()
110110
}
111111
};
112112

113-
const string route = "/api/v1/workItems/";
113+
const string route = "/api/workItems/";
114114

115115
// Act
116116
(HttpResponseMessage httpResponse, Document responseDocument) = await ExecutePostAsync<Document>(route, requestBody);
@@ -140,7 +140,7 @@ await RunOnDatabaseAsync(async dbContext =>
140140
await dbContext.SaveChangesAsync();
141141
});
142142

143-
string route = $"/api/v1/workItems/{workItem.StringId}";
143+
string route = $"/api/workItems/{workItem.StringId}";
144144

145145
// Act
146146
(HttpResponseMessage httpResponse, string responseDocument) = await ExecuteDeleteAsync<string>(route);

0 commit comments

Comments
 (0)