Skip to content

feat: use camelCase as default #618

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 11 commits into from
Nov 7, 2019
Merged

feat: use camelCase as default #618

merged 11 commits into from
Nov 7, 2019

Conversation

maurei
Copy link
Member

@maurei maurei commented Nov 6, 2019

Sets the default formatting to camelCase instead of kebab-case. This is the new recommendation by the json:api spec. Also see #555 for discussion.

  • set formatting default from kebab-case to camelCase
  • port all tests from kebab-case to camel-case
  • redo the CamelCaseControllerTest to test the same "exception" where the exception is now kebab-case

While redoing the CamelCaseControllerTests I did more research on the intended usage of WebApplicationFactory and worked out a clean way to define the Startup "overloads" in the test assemblies. See KebabCaseFormatterTests and CreatingDataTests.

@maurei maurei marked this pull request as ready for review November 7, 2019 12:13
@maurei maurei requested a review from wisepotato November 7, 2019 12:13
@@ -93,7 +93,7 @@ public virtual async Task<TResource> CreateAsync(TResource entity)
/// entity when we're using a different instance of the relationship (because this different one
/// was already tracked) than the one assigned to the to-be-created entity.
/// Alternatively, even if we don't have to reassign anything because of already tracked
/// entities, we still need to assign the "through" entities in the case of many-to-many.
/// entities, we still need to assign the "through" entities in the case of manyToMany.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the correct word is still many-to-many, or did you go crazy with the camelcasificiation?

@@ -358,7 +358,7 @@ public async Task<IReadOnlyList<TResource>> ToListAsync(IQueryable<TResource> en
/// Before assigning new relationship values (UpdateAsync), we need to
/// attach the current database values of the relationship to the dbcontext, else
/// it will not perform a complete-replace which is required for
/// one-to-many and many-to-many.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@@ -8,7 +8,7 @@
namespace JsonApiDotNetCore.Graph
{
/// <summary>
/// Used to locate types and facilitate auto-resource discovery
/// Used to locate types and facilitate autoResource discovery
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

camelfication

@@ -6,7 +6,7 @@
/// </summary>
public enum ResourceHook
{
None, // https://stackoverflow.com/questions/24151354/is-it-a-good-practice-to-add-a-null-or-none-member-to-the-enum
None, // https://stackoverflow.com/questions/24151354/is-it-a-good-practiceTo-add-a-null-or-noneMemberTo-the-enum
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

camel

@@ -107,7 +107,7 @@ public interface IUpdateHookContainer<TResource> where TResource : class, IIdent
/// hook is fired after the execution of this hook.
/// <para />
/// If by the creation of these relationships, any other relationships (eg
/// in the case of an already populated one-to-one relationship) are implicitly
/// in the case of an already populated oneToOne relationship) are implicitly
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

camel

@@ -165,7 +165,7 @@ public interface IUpdateHookContainer<TResource> where TResource : class, IIdent
/// This hook is fired when a relationship to entities of type
/// <typeparamref name="TResource"/> is implicitly affected from a dependent pipeline (<see cref="ResourcePipeline.Patch"/>
/// or <see cref="ResourcePipeline.Delete"/>). For example, if an Article was updated
/// by setting its author relationship (one-to-one) to an existing Person,
/// by setting its author relationship (oneToOne) to an existing Person,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

camel

_dbContext.SaveChanges();
}

private async Task<(string, HttpResponseMessage)> SendRequest(string method, string route, string content = null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so in general i would suggest a HttpRequest instead of method, route and content, this would make for a more broadly appealing helper class, but this works for now

@maurei maurei merged commit 07b393f into develop Nov 7, 2019
@maurei maurei deleted the feat/camelCase-default branch November 7, 2019 17:37
@maurei maurei mentioned this pull request Nov 7, 2019
wisepotato pushed a commit that referenced this pull request Nov 11, 2019
* Fix/deviating dbset name (#603)

* test: expose dbset name bug

* fix: deviating dbset name

* chore: add launchSettings.json to gitignore

* chore: delete launchSettings.json from git

* Fix/pagesize (#601)

* feat: new startup for test

* chore: rename startup class

* test: reproduce #599 in test

* fix: zero division error

* chore: remove redundant DefaultPageSize on IPageService

* chore: update .gitignore

* fix: typo LoaDatabaseValues (#608)

* fix: typo

* fix: typo in fix of typo

* chore: enable sql logging in JsonApiDotNetCoreExample

* Acceptance tests EF inheritance (#610)

* chore: create inheritance model + controller

* test: create and patch acceptance test

* chore: close issue

* Improve usability RequestSerializer (#613)

* feat: remove inability to use request serializer with unknown type at runtime

* fix: typo in test setup

* chore: spacing

* fix: add IResourceQueryService and IResourceCmdService to DI container in application builder

* chore: update comments IRequestSerializer

* Move EF core related building to extension methods (#616)

* feat: remove inability to use request serializer with unknown type at runtime

* fix: typo in test setup

* chore: spacing

* fix: add IResourceQueryService and IResourceCmdService to DI container in application builder

* chore: update comments IRequestSerializer

* chore: moved ef core related building to extension methods

* chore: spacing, rename file

* refactor: remove need for internal modifier

* refactor: minor refactor id type retrieval

* Hooks discovery detection of implemented hooks issue (#617)

* fix: discovery issue related to assemblies

* fix: LoaDatabaseValue typo

* fix: set EnableResourceHooks to true by default

* chore: add comment in code in hooksdiscovery

* fix: use IServiceProvider instead of IScopedServiceProvider

* fix: discovery unit test with ServiceProvider instead of ScopedServiceProvider

* refactor: TResource instead of TEntity

* chore: process PR review

* chore: move comment to separate line (stylecop)

* feat: use camelCase as default (#618)

* feat: use camelCase as default

* refactor: massive replace all to replace kebab-case with camelCase default

* chore: fix remaining unit tests

* fix: fix  remaining JsonApiDotNetCoreExampleTests

* feat: introduce proper usage of WebApplicationFactory in KebabCaseFormatterTests

* fix: remaining functional tests

* fix: minor changes PR review

* fix: camelCase revert in comments

* fix: camelCase revert in comments

* fix: camelCase revert in comments

* fix: camelCase revert in comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants