Skip to content

Naming consistency #909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@
<img src ="https://raw.githubusercontent.com/json-api-dotnet/JsonApiDotnetCore/master/logo.png" />
</p>

# JSON:API Framework for ASP.NET Core
# JsonApiDotNetCore
A framework for building [JSON:API](http://jsonapi.org/) compliant REST APIs using .NET Core and Entity Framework Core.

[![Build status](https://ci.appveyor.com/api/projects/status/5go47hrm0iik0ls3/branch/master?svg=true)](https://ci.appveyor.com/project/jaredcnance/jsonapidotnetcore/branch/master)
[![Travis](https://travis-ci.org/json-api-dotnet/JsonApiDotNetCore.svg?branch=master)](https://travis-ci.org/json-api-dotnet/JsonApiDotNetCore)
[![NuGet](https://img.shields.io/nuget/v/JsonApiDotNetCore.svg)](https://www.nuget.org/packages/JsonApiDotNetCore/)
[![Join the chat at https://gitter.im/json-api-dotnet-core/Lobby](https://badges.gitter.im/json-api-dotnet-core/Lobby.svg)](https://gitter.im/json-api-dotnet-core/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![FIRST-TIMERS](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](http://www.firsttimersonly.com/)

A framework for building [json:api](http://jsonapi.org/) compliant web APIs. The ultimate goal of this library is to eliminate as much boilerplate as possible by offering out-of-the-box features such as sorting, filtering and pagination. You just need to focus on defining the resources and implementing your custom business logic. This library has been designed around dependency injection making extensibility incredibly easy.
The ultimate goal of this library is to eliminate as much boilerplate as possible by offering out-of-the-box features such as sorting, filtering and pagination. You just need to focus on defining the resources and implementing your custom business logic. This library has been designed around dependency injection, making extensibility incredibly easy.

## Getting Started

These are some steps you can take to help you understand what this project is and how you can use it:

- [What is json:api and why should I use it?](https://nordicapis.com/the-benefits-of-using-json-api/)
- [The json:api specification](http://jsonapi.org/format/)
- [What is JSON:API and why should I use it?](https://nordicapis.com/the-benefits-of-using-json-api/)
- [The JSON:API specification](http://jsonapi.org/format/)
- [Demo [Video]](https://youtu.be/KAMuo6K7VcE)
- [Our documentation](https://json-api-dotnet.github.io/JsonApiDotNetCore/)
- [Check out the example projects](https://github.com/json-api-dotnet/JsonApiDotNetCore/tree/master/src/Examples)
Expand Down
12 changes: 6 additions & 6 deletions docs/home/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<title>JSON:API .NET Core</title>
<meta content="A framework for building json:api compliant REST APIs using .NET Core and Entity Framework Core" name="description">
<meta content="jsonapidotnetcore jsonapi json:api dotnetcore" name="keywords">
<title>JsonApiDotNetCore documentation</title>
<meta content="A framework for building JSON:API compliant REST APIs using .NET Core and Entity Framework Core" name="description">
<meta content="jsonapidotnetcore jsonapi json:api dotnet asp.net" name="keywords">
<link href="favicon.ico" rel="icon">
<link href="favicon.ico" rel="apple-touch-icon">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Raleway:300,300i,400,400i,600,600i,700,700i" rel="stylesheet">
Expand All @@ -21,8 +21,8 @@
<div class="container">
<div class="row">
<div class="col-lg-7 pt-5 pt-lg-0 order-2 order-lg-1">
<h1>JSON:API .NET Core</h1>
<h2>A framework for building <a href="https://jsonapi.org/" target="_blank">json:api</a> compliant REST APIs using .NET Core and Entity Framework Core</h2>
<h1>JsonApiDotNetCore</h1>
<h2>A framework for building <a href="https://jsonapi.org/" target="_blank">JSON:API</a> compliant REST APIs using .NET Core and Entity Framework Core</h2>
<a href="#about" class="btn-get-started scrollto">Read more</a>
<a href="../../getting-started/install.html" class="btn-get-started">Getting started</a>
<a href="https://github.com/json-api-dotnet/JsonApiDotNetCore/" target="_blank" class="btn-get-started">Contribute on GitHub</a>
Expand All @@ -43,7 +43,7 @@ <h2>A framework for building <a href="https://jsonapi.org/" target="_blank">json
<div class="col-lg-6 pt-5 pt-lg-0">
<h3 data-aos="fade-up">Objectives</h3>
<p data-aos="fade-up" data-aos-delay="100">
The goal of this library is to simplify the development of APIs that leverage the full range of features provided by the <a href="https://jsonapi.org/" target="_blank">json:api</a> specification.
The goal of this library is to simplify the development of APIs that leverage the full range of features provided by the <a href="https://jsonapi.org/" target="_blank">JSON:API</a> specification.
You just need to focus on defining the resources and implementing your custom business logic.
</p>
<div class="row">
Expand Down
4 changes: 2 additions & 2 deletions docs/usage/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Errors returned will contain only the properties that are set on the `Error` class. Custom fields can be added through `Error.Meta`.
You can create a custom error by throwing a `JsonApiException` (which accepts an `Error` instance), or returning an `Error` instance from an `ActionResult` in a controller.
Please keep in mind that json:api requires Title to be a generic message, while Detail should contain information about the specific problem occurence.
Please keep in mind that JSON:API requires Title to be a generic message, while Detail should contain information about the specific problem occurence.

From a controller method:
```c#
Expand All @@ -22,7 +22,7 @@ throw new JsonApiException(new Error(HttpStatusCode.Conflict)
});
```

In both cases, the middleware will properly serialize it and return it as a json:api error.
In both cases, the middleware will properly serialize it and return it as a JSON:API error.

# Exception handling

Expand Down
2 changes: 1 addition & 1 deletion docs/usage/meta.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Metadata

We support two ways to add json:api meta to your responses: global and per resource.
We support two ways to add JSON:API meta to your responses: global and per resource.

## Global Meta

Expand Down
2 changes: 1 addition & 1 deletion docs/usage/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ options.UseRelativeLinks = true;

## Unknown Query String Parameters

If you would like to allow unknown query string parameters (parameters not reserved by the json:api specification or registered using resource definitions), you can set `AllowUnknownQueryStringParameters = true`. When set to `false` (the default), an HTTP 400 Bad Request is returned for unknown query string parameters.
If you would like to allow unknown query string parameters (parameters not reserved by the JSON:API specification or registered using resource definitions), you can set `AllowUnknownQueryStringParameters = true`. When set to `false` (the default), an HTTP 400 Bad Request is returned for unknown query string parameters.

```c#
options.AllowUnknownQueryStringParameters = true;
Expand Down
6 changes: 3 additions & 3 deletions docs/usage/resource-graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

_NOTE: prior to v4 this was called the `ContextGraph`_

The `ResourceGraph` is a map of all the json:api resources and their relationships that your API serves.
The `ResourceGraph` is a map of all the JSON:API resources and their relationships that your API serves.

It is built at app startup and available as a singleton through Dependency Injection.

Expand All @@ -21,7 +21,7 @@ is prioritized by the list above in descending order.
### Auto-discovery

Auto-discovery refers to the process of reflecting on an assembly and
detecting all of the json:api resources, resource definitions, resource services and repositories.
detecting all of the JSON:API resources, resource definitions, resource services and repositories.

The following command builds the resource graph using all `IIdentifiable` implementations and registers the services mentioned.
You can enable auto-discovery for the current assembly by adding the following to your `Startup` class.
Expand Down Expand Up @@ -73,7 +73,7 @@ public void ConfigureServices(IServiceCollection services)

## Resource Name

The public resource name is exposed through the `type` member in the json:api payload. This can be configured by the following approaches (in order of priority):
The public resource name is exposed through the `type` member in the JSON:API payload. This can be configured by the following approaches (in order of priority):

1. The `publicName` parameter when manually adding a resource to the graph
```c#
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/resources/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class Person : Identifiable

_since v4.0_

Default json:api attribute capabilities are specified in @JsonApiDotNetCore.Configuration.JsonApiOptions#JsonApiDotNetCore_Configuration_JsonApiOptions_DefaultAttrCapabilities:
Default JSON:API attribute capabilities are specified in @JsonApiDotNetCore.Configuration.JsonApiOptions#JsonApiDotNetCore_Configuration_JsonApiOptions_DefaultAttrCapabilities:

```c#
options.DefaultAttrCapabilities = AttrCapabilities.None; // default: All
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/resources/relationships.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public class TodoItem : Identifiable

_since v4.0_

Your resource may expose a calculated property, whose value depends on a related entity that is not exposed as a json:api resource.
Your resource may expose a calculated property, whose value depends on a related entity that is not exposed as a JSON:API resource.
So for the calculated property to be evaluated correctly, the related entity must always be retrieved. You can achieve that using `EagerLoad`, for example:

```c#
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/resources/resource-definitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ For various reasons (see examples below) you may need to change parts of the que
`JsonApiResourceDefinition<TResource>` (which is an empty implementation of `IResourceDefinition<TResource>`) provides overridable methods that pass you the result of query string parameter parsing.
The value returned by you determines what will be used to execute the query.

An intermediate format (`QueryExpression` and derived types) is used, which enables us to separate json:api implementation
An intermediate format (`QueryExpression` and derived types) is used, which enables us to separate JSON:API implementation
from Entity Framework Core `IQueryable` execution.

### Excluding fields
Expand Down
6 changes: 3 additions & 3 deletions docs/usage/routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Which results in URLs like: https://yourdomain.com/api/v1/people

## Default Routing Convention

The library will configure routes for all controllers in your project. By default, routes are camel-cased. This is based on the [recommendations](https://jsonapi.org/recommendations/) outlined in the json:api spec.
The library will configure routes for all controllers in your project. By default, routes are camel-cased. This is based on the [recommendations](https://jsonapi.org/recommendations/) outlined in the JSON:API spec.

```c#
public class OrderLine : Identifiable { }
Expand All @@ -35,7 +35,7 @@ GET /orderLines HTTP/1.1

The exposed name of the resource ([which can be customized](~/usage/resource-graph.md#resource-name)) is used for the route, instead of the controller name.

### Non-json:api controllers
### Non-JSON:API controllers

If a controller does not inherit from `JsonApiController<TResource>`, the [configured naming convention](~/usage/options.md#custom-serializer-settings) is applied to the name of the controller.
```c#
Expand Down Expand Up @@ -69,4 +69,4 @@ public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<IJsonApiRoutingConvention, CustomRoutingConvention>();
}
```
```
10 changes: 5 additions & 5 deletions src/JsonApiDotNetCore/Configuration/IJsonApiOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public interface IJsonApiOptions
string Namespace { get; }

/// <summary>
/// Specifies the default query string capabilities that can be used on exposed json:api attributes.
/// Specifies the default query string capabilities that can be used on exposed JSON:API attributes.
/// Defaults to <see cref="AttrCapabilities.All"/>.
/// </summary>
AttrCapabilities DefaultAttrCapabilities { get; }
Expand Down Expand Up @@ -56,21 +56,21 @@ public interface IJsonApiOptions
bool UseRelativeLinks { get; }

/// <summary>
/// Configures globally which links to show in the <see cref="TopLevelLinks"/>
/// Configures globally which links to show in the <see cref="Serialization.Objects.TopLevelLinks"/>
/// object for a requested resource. Setting can be overridden per resource by
/// adding a <see cref="ResourceLinksAttribute"/> to the class definition of that resource.
/// </summary>
LinkTypes TopLevelLinks { get; }

/// <summary>
/// Configures globally which links to show in the <see cref="ResourceLinks"/>
/// Configures globally which links to show in the <see cref="Serialization.Objects.ResourceLinks"/>
/// object for a requested resource. Setting can be overridden per resource by
/// adding a <see cref="ResourceLinksAttribute"/> to the class definition of that resource.
/// </summary>
LinkTypes ResourceLinks { get; }

/// <summary>
/// Configures globally which links to show in the <see cref="RelationshipLinks"/>
/// Configures globally which links to show in the <see cref="Serialization.Objects.RelationshipLinks"/>
/// object for a requested resource. Setting can be overridden per resource by
/// adding a <see cref="ResourceLinksAttribute"/> to the class definition of that resource.
/// This option can also be specified per relationship by using the associated links argument
Expand Down Expand Up @@ -174,7 +174,7 @@ public interface IJsonApiOptions

/// <summary>
/// Specifies the settings that are used by the <see cref="JsonSerializer"/>.
/// Note that at some places a few settings are ignored, to ensure json:api spec compliance.
/// Note that at some places a few settings are ignored, to ensure JSON:API spec compliance.
/// <example>
/// The next example changes the naming convention to kebab casing.
/// <code><![CDATA[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace JsonApiDotNetCore.Configuration
{
/// <summary>
/// Custom implementation of <see cref="IModelMetadataProvider"/> to support json:api partial patching.
/// Custom implementation of <see cref="IModelMetadataProvider"/> to support JSON:API partial patching.
/// </summary>
internal class JsonApiModelMetadataProvider : DefaultModelMetadataProvider
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace JsonApiDotNetCore.Configuration
{
/// <summary>
/// Validation filter that blocks ASP.NET Core ModelState validation on data according to the json:api spec.
/// Validation filter that blocks ASP.NET Core ModelState validation on data according to the JSON:API spec.
/// </summary>
internal sealed class JsonApiValidationFilter : IPropertyValidationFilter
{
Expand Down
6 changes: 3 additions & 3 deletions src/JsonApiDotNetCore/Configuration/ResourceContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,23 @@ public class ResourceContext
public IReadOnlyCollection<ResourceFieldAttribute> Fields => _fields ??= Attributes.Cast<ResourceFieldAttribute>().Concat(Relationships).ToArray();

/// <summary>
/// Configures which links to show in the <see cref="TopLevelLinks"/>
/// Configures which links to show in the <see cref="Serialization.Objects.TopLevelLinks"/>
/// object for this resource. If set to <see cref="LinkTypes.NotConfigured"/>,
/// the configuration will be read from <see cref="IJsonApiOptions"/>.
/// Defaults to <see cref="LinkTypes.NotConfigured"/>.
/// </summary>
public LinkTypes TopLevelLinks { get; internal set; } = LinkTypes.NotConfigured;

/// <summary>
/// Configures which links to show in the <see cref="ResourceLinks"/>
/// Configures which links to show in the <see cref="Serialization.Objects.ResourceLinks"/>
/// object for this resource. If set to <see cref="LinkTypes.NotConfigured"/>,
/// the configuration will be read from <see cref="IJsonApiOptions"/>.
/// Defaults to <see cref="LinkTypes.NotConfigured"/>.
/// </summary>
public LinkTypes ResourceLinks { get; internal set; } = LinkTypes.NotConfigured;

/// <summary>
/// Configures which links to show in the <see cref="RelationshipLinks"/>
/// Configures which links to show in the <see cref="Serialization.Objects.RelationshipLinks"/>
/// for all relationships of the resource for which this attribute was instantiated.
/// If set to <see cref="LinkTypes.NotConfigured"/>, the configuration will
/// be read from <see cref="RelationshipAttribute.Links"/> or
Expand Down
2 changes: 1 addition & 1 deletion src/JsonApiDotNetCore/Configuration/ResourceGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ private static Expression RemoveConvert(Expression expression)

private void ThrowNotExposedError(string memberName, FieldFilterType type)
{
throw new ArgumentException($"{memberName} is not an json:api exposed {type:g}.");
throw new ArgumentException($"{memberName} is not a JSON:API exposed {type:g}.");
}

private enum FieldFilterType
Expand Down
6 changes: 3 additions & 3 deletions src/JsonApiDotNetCore/Configuration/ResourceGraphBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private void SetResourceLinksOptions(ResourceContext resourceContext)
}

/// <summary>
/// Adds a json:api resource with <code>int</code> as the identifier type.
/// Adds a JSON:API resource with <code>int</code> as the identifier type.
/// </summary>
/// <typeparam name="TResource">The resource model type.</typeparam>
/// <param name="publicName">
Expand All @@ -58,7 +58,7 @@ public ResourceGraphBuilder Add<TResource>(string publicName = null) where TReso
=> Add<TResource, int>(publicName);

/// <summary>
/// Adds a json:api resource.
/// Adds a JSON:API resource.
/// </summary>
/// <typeparam name="TResource">The resource model type.</typeparam>
/// <typeparam name="TId">The resource model identifier type.</typeparam>
Expand All @@ -70,7 +70,7 @@ public ResourceGraphBuilder Add<TResource, TId>(string publicName = null) where
=> Add(typeof(TResource), typeof(TId), publicName);

/// <summary>
/// Adds a json:api resource.
/// Adds a JSON:API resource.
/// </summary>
/// <param name="resourceType">The resource model type.</param>
/// <param name="idType">The resource model identifier type.</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private static void SetupApplicationBuilder(IServiceCollection services, Action<

/// <summary>
/// Enables client serializers for sending requests and receiving responses
/// in json:api format. Internally only used for testing.
/// in JSON:API format. Internally only used for testing.
/// Will be extended in the future to be part of a JsonApiClientDotNetCore package.
/// </summary>
public static IServiceCollection AddClientSerialization(this IServiceCollection services)
Expand Down
2 changes: 1 addition & 1 deletion src/JsonApiDotNetCore/Controllers/CoreJsonApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace JsonApiDotNetCore.Controllers
{
/// <summary>
/// Provides helper methods to raise json:api compliant errors from controller actions.
/// Provides helper methods to raise JSON:API compliant errors from controller actions.
/// </summary>
public abstract class CoreJsonApiController : ControllerBase
{
Expand Down
2 changes: 1 addition & 1 deletion src/JsonApiDotNetCore/Errors/JsonApiException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace JsonApiDotNetCore.Errors
{
/// <summary>
/// The base class for an <see cref="Exception"/> that represents one or more json:api error objects in an unsuccessful response.
/// The base class for an <see cref="Exception"/> that represents one or more JSON:API error objects in an unsuccessful response.
/// </summary>
public class JsonApiException : Exception
{
Expand Down
Loading